aboutsummaryrefslogtreecommitdiffstats
path: root/subversion/libsvn_wc/wc-queries.h
blob: ad5ccb57355dc4fd09f24a82012363dd39581ac5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
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
/* This file is automatically generated from wc-queries.sql and .dist_sandbox/subversion-1.9.4/subversion/libsvn_wc/token-map.h.
 * Do not edit this file -- edit the source and rerun gen-make.py */

#define STMT_SELECT_NODE_INFO 0
#define STMT_0_INFO {"STMT_SELECT_NODE_INFO", NULL}
#define STMT_0 \
  "SELECT op_depth, repos_id, repos_path, presence, kind, revision, checksum, " \
  "  translated_size, changed_revision, changed_date, changed_author, depth, " \
  "  symlink_target, last_mod_time, properties, moved_here, inherited_props, " \
  "  moved_to " \
  "FROM nodes " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 " \
  "ORDER BY op_depth DESC " \
  ""

#define STMT_SELECT_NODE_INFO_WITH_LOCK 1
#define STMT_1_INFO {"STMT_SELECT_NODE_INFO_WITH_LOCK", NULL}
#define STMT_1 \
  "SELECT op_depth, nodes.repos_id, nodes.repos_path, presence, kind, revision, " \
  "  checksum, translated_size, changed_revision, changed_date, changed_author, " \
  "  depth, symlink_target, last_mod_time, properties, moved_here, " \
  "  inherited_props, " \
  "  lock_token, lock_owner, lock_comment, lock_date " \
  "FROM nodes " \
  "LEFT OUTER JOIN lock ON nodes.repos_id = lock.repos_id " \
  "  AND nodes.repos_path = lock.repos_relpath " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 " \
  "ORDER BY op_depth DESC " \
  ""

#define STMT_SELECT_BASE_NODE 2
#define STMT_2_INFO {"STMT_SELECT_BASE_NODE", NULL}
#define STMT_2 \
  "SELECT repos_id, repos_path, presence, kind, revision, checksum, " \
  "  translated_size, changed_revision, changed_date, changed_author, depth, " \
  "  symlink_target, last_mod_time, properties, file_external " \
  "FROM nodes " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0 " \
  ""

#define STMT_SELECT_BASE_NODE_WITH_LOCK 3
#define STMT_3_INFO {"STMT_SELECT_BASE_NODE_WITH_LOCK", NULL}
#define STMT_3 \
  "SELECT nodes.repos_id, nodes.repos_path, presence, kind, revision, " \
  "  checksum, translated_size, changed_revision, changed_date, changed_author, " \
  "  depth, symlink_target, last_mod_time, properties, file_external, " \
  "  lock_token, lock_owner, lock_comment, lock_date " \
  "FROM nodes " \
  "LEFT OUTER JOIN lock ON nodes.repos_id = lock.repos_id " \
  "  AND nodes.repos_path = lock.repos_relpath " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0 " \
  ""

#define STMT_SELECT_BASE_CHILDREN_INFO 4
#define STMT_4_INFO {"STMT_SELECT_BASE_CHILDREN_INFO", NULL}
#define STMT_4 \
  "SELECT local_relpath, nodes.repos_id, nodes.repos_path, presence, kind, " \
  "  revision, depth, file_external " \
  "FROM nodes " \
  "WHERE wc_id = ?1 AND parent_relpath = ?2 AND op_depth = 0 " \
  ""

#define STMT_SELECT_BASE_CHILDREN_INFO_LOCK 5
#define STMT_5_INFO {"STMT_SELECT_BASE_CHILDREN_INFO_LOCK", NULL}
#define STMT_5 \
  "SELECT local_relpath, nodes.repos_id, nodes.repos_path, presence, kind, " \
  "  revision, depth, file_external, " \
  "  lock_token, lock_owner, lock_comment, lock_date " \
  "FROM nodes " \
  "LEFT OUTER JOIN lock ON nodes.repos_id = lock.repos_id " \
  "  AND nodes.repos_path = lock.repos_relpath " \
  "WHERE wc_id = ?1 AND parent_relpath = ?2 AND op_depth = 0 " \
  ""

#define STMT_SELECT_WORKING_NODE 6
#define STMT_6_INFO {"STMT_SELECT_WORKING_NODE", NULL}
#define STMT_6 \
  "SELECT op_depth, presence, kind, checksum, translated_size, " \
  "  changed_revision, changed_date, changed_author, depth, symlink_target, " \
  "  repos_id, repos_path, revision, " \
  "  moved_here, moved_to, last_mod_time, properties " \
  "FROM nodes " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > 0 " \
  "ORDER BY op_depth DESC " \
  "LIMIT 1 " \
  ""

#define STMT_SELECT_DEPTH_NODE 7
#define STMT_7_INFO {"STMT_SELECT_DEPTH_NODE", NULL}
#define STMT_7 \
  "SELECT repos_id, repos_path, presence, kind, revision, checksum, " \
  "  translated_size, changed_revision, changed_date, changed_author, depth, " \
  "  symlink_target, properties, moved_to, moved_here " \
  "FROM nodes " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?3 " \
  ""

#define STMT_SELECT_LOWEST_WORKING_NODE 8
#define STMT_8_INFO {"STMT_SELECT_LOWEST_WORKING_NODE", NULL}
#define STMT_8 \
  "SELECT op_depth, presence, kind, moved_to " \
  "FROM nodes " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > ?3 " \
  "ORDER BY op_depth " \
  "LIMIT 1 " \
  ""

#define STMT_SELECT_HIGHEST_WORKING_NODE 9
#define STMT_9_INFO {"STMT_SELECT_HIGHEST_WORKING_NODE", NULL}
#define STMT_9 \
  "SELECT op_depth " \
  "FROM nodes " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth < ?3 " \
  "ORDER BY op_depth DESC " \
  "LIMIT 1 " \
  ""

#define STMT_SELECT_ACTUAL_NODE 10
#define STMT_10_INFO {"STMT_SELECT_ACTUAL_NODE", NULL}
#define STMT_10 \
  "SELECT changelist, properties, conflict_data " \
  "FROM actual_node " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 " \
  ""

#define STMT_SELECT_NODE_CHILDREN_INFO 11
#define STMT_11_INFO {"STMT_SELECT_NODE_CHILDREN_INFO", NULL}
#define STMT_11 \
  "SELECT op_depth, nodes.repos_id, nodes.repos_path, presence, kind, revision, " \
  "  checksum, translated_size, changed_revision, changed_date, changed_author, " \
  "  depth, symlink_target, last_mod_time, properties, lock_token, lock_owner, " \
  "  lock_comment, lock_date, local_relpath, moved_here, moved_to, file_external " \
  "FROM nodes " \
  "LEFT OUTER JOIN lock ON nodes.repos_id = lock.repos_id " \
  "  AND nodes.repos_path = lock.repos_relpath AND op_depth = 0 " \
  "WHERE wc_id = ?1 AND parent_relpath = ?2 " \
  "ORDER BY local_relpath DESC, op_depth DESC " \
  ""

#define STMT_SELECT_BASE_NODE_CHILDREN_INFO 12
#define STMT_12_INFO {"STMT_SELECT_BASE_NODE_CHILDREN_INFO", NULL}
#define STMT_12 \
  "SELECT op_depth, nodes.repos_id, nodes.repos_path, presence, kind, revision, " \
  "  checksum, translated_size, changed_revision, changed_date, changed_author, " \
  "  depth, symlink_target, last_mod_time, properties, lock_token, lock_owner, " \
  "  lock_comment, lock_date, local_relpath, moved_here, moved_to, file_external " \
  "FROM nodes " \
  "LEFT OUTER JOIN lock ON nodes.repos_id = lock.repos_id " \
  "  AND nodes.repos_path = lock.repos_relpath AND op_depth = 0 " \
  "WHERE wc_id = ?1 AND parent_relpath = ?2 AND op_depth = 0 " \
  "ORDER BY local_relpath DESC " \
  ""

#define STMT_SELECT_NODE_CHILDREN_WALKER_INFO 13
#define STMT_13_INFO {"STMT_SELECT_NODE_CHILDREN_WALKER_INFO", NULL}
#define STMT_13 \
  "SELECT local_relpath, op_depth, presence, kind " \
  "FROM nodes_current " \
  "WHERE wc_id = ?1 AND parent_relpath = ?2 " \
  "ORDER BY local_relpath " \
  ""

#define STMT_SELECT_ACTUAL_CHILDREN_INFO 14
#define STMT_14_INFO {"STMT_SELECT_ACTUAL_CHILDREN_INFO", NULL}
#define STMT_14 \
  "SELECT local_relpath, changelist, properties, conflict_data " \
  "FROM actual_node " \
  "WHERE wc_id = ?1 AND parent_relpath = ?2 " \
  ""

#define STMT_SELECT_REPOSITORY_BY_ID 15
#define STMT_15_INFO {"STMT_SELECT_REPOSITORY_BY_ID", NULL}
#define STMT_15 \
  "SELECT root, uuid FROM repository WHERE id = ?1 " \
  ""

#define STMT_SELECT_WCROOT_NULL 16
#define STMT_16_INFO {"STMT_SELECT_WCROOT_NULL", NULL}
#define STMT_16 \
  "SELECT id FROM wcroot WHERE local_abspath IS NULL " \
  ""

#define STMT_SELECT_REPOSITORY 17
#define STMT_17_INFO {"STMT_SELECT_REPOSITORY", NULL}
#define STMT_17 \
  "SELECT id FROM repository WHERE root = ?1 " \
  ""

#define STMT_INSERT_REPOSITORY 18
#define STMT_18_INFO {"STMT_INSERT_REPOSITORY", NULL}
#define STMT_18 \
  "INSERT INTO repository (root, uuid) VALUES (?1, ?2) " \
  ""

#define STMT_INSERT_NODE 19
#define STMT_19_INFO {"STMT_INSERT_NODE", NULL}
#define STMT_19 \
  "INSERT OR REPLACE INTO nodes ( " \
  "  wc_id, local_relpath, op_depth, parent_relpath, repos_id, repos_path, " \
  "  revision, presence, depth, kind, changed_revision, changed_date, " \
  "  changed_author, checksum, properties, translated_size, last_mod_time, " \
  "  dav_cache, symlink_target, file_external, moved_to, moved_here, " \
  "  inherited_props) " \
  "VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, " \
  "        ?15, ?16, ?17, ?18, ?19, ?20, ?21, ?22, ?23) " \
  ""

#define STMT_SELECT_WORKING_PRESENT 20
#define STMT_20_INFO {"STMT_SELECT_WORKING_PRESENT", NULL}
#define STMT_20 \
  "SELECT local_relpath, kind, checksum, translated_size, last_mod_time " \
  "FROM nodes n " \
  "WHERE wc_id = ?1 " \
  "  AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  "  AND presence in ('normal', 'incomplete') " \
  "  AND op_depth = (SELECT MAX(op_depth) " \
  "                  FROM NODES w " \
  "                  WHERE w.wc_id = ?1 " \
  "                    AND w.local_relpath = n.local_relpath) " \
  "ORDER BY local_relpath DESC " \
  ""

#define STMT_DELETE_NODE_RECURSIVE 21
#define STMT_21_INFO {"STMT_DELETE_NODE_RECURSIVE", NULL}
#define STMT_21 \
  "DELETE FROM NODES " \
  "WHERE wc_id = ?1 " \
  "  AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  ""

#define STMT_DELETE_NODE 22
#define STMT_22_INFO {"STMT_DELETE_NODE", NULL}
#define STMT_22 \
  "DELETE " \
  "FROM NODES " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?3 " \
  ""

#define STMT_DELETE_ACTUAL_FOR_BASE_RECURSIVE 23
#define STMT_23_INFO {"STMT_DELETE_ACTUAL_FOR_BASE_RECURSIVE", NULL}
#define STMT_23 \
  "DELETE FROM actual_node " \
  "WHERE wc_id = ?1 AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  "  AND EXISTS(SELECT 1 FROM NODES b " \
  "             WHERE b.wc_id = ?1 " \
  "               AND b.local_relpath = actual_node.local_relpath " \
  "               AND op_depth = 0) " \
  "  AND NOT EXISTS(SELECT 1 FROM NODES w " \
  "                 WHERE w.wc_id = ?1 " \
  "                   AND w.local_relpath = actual_node.local_relpath " \
  "                   AND op_depth > 0 " \
  "                   AND presence in ('normal', 'incomplete', 'not-present')) " \
  ""

#define STMT_DELETE_WORKING_BASE_DELETE 24
#define STMT_24_INFO {"STMT_DELETE_WORKING_BASE_DELETE", NULL}
#define STMT_24 \
  "DELETE FROM nodes " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 " \
  "  AND presence = 'base-deleted' " \
  "  AND op_depth > ?3 " \
  "  AND op_depth = (SELECT MIN(op_depth) FROM nodes n " \
  "                    WHERE n.wc_id = ?1 " \
  "                      AND n.local_relpath = nodes.local_relpath " \
  "                      AND op_depth > ?3) " \
  ""

#define STMT_DELETE_WORKING_BASE_DELETE_RECURSIVE 25
#define STMT_25_INFO {"STMT_DELETE_WORKING_BASE_DELETE_RECURSIVE", NULL}
#define STMT_25 \
  "DELETE FROM nodes " \
  "WHERE wc_id = ?1 AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  "  AND presence = 'base-deleted' " \
  "  AND op_depth > ?3 " \
  "  AND op_depth = (SELECT MIN(op_depth) FROM nodes n " \
  "                    WHERE n.wc_id = ?1 " \
  "                      AND n.local_relpath = nodes.local_relpath " \
  "                      AND op_depth > ?3) " \
  ""

#define STMT_DELETE_WORKING_RECURSIVE 26
#define STMT_26_INFO {"STMT_DELETE_WORKING_RECURSIVE", NULL}
#define STMT_26 \
  "DELETE FROM nodes " \
  "WHERE wc_id = ?1 AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  "  AND op_depth > 0 " \
  ""

#define STMT_DELETE_BASE_RECURSIVE 27
#define STMT_27_INFO {"STMT_DELETE_BASE_RECURSIVE", NULL}
#define STMT_27 \
  "DELETE FROM nodes " \
  "WHERE wc_id = ?1 AND (local_relpath = ?2 " \
  "                      OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \
  "  AND op_depth = 0 " \
  ""

#define STMT_DELETE_WORKING_OP_DEPTH 28
#define STMT_28_INFO {"STMT_DELETE_WORKING_OP_DEPTH", NULL}
#define STMT_28 \
  "DELETE FROM nodes " \
  "WHERE wc_id = ?1 " \
  "  AND (local_relpath = ?2 OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \
  "  AND op_depth = ?3 " \
  ""

#define STMT_SELECT_LAYER_FOR_REPLACE 29
#define STMT_29_INFO {"STMT_SELECT_LAYER_FOR_REPLACE", NULL}
#define STMT_29 \
  "SELECT s.local_relpath, s.kind, " \
  "  (CASE WHEN (?2) = '' THEN (CASE WHEN (?4) = '' THEN (s.local_relpath) WHEN (s.local_relpath) = '' THEN (?4) ELSE (?4) || '/' || (s.local_relpath) END) WHEN (?4) = '' THEN (CASE WHEN (?2) = '' THEN (s.local_relpath)  WHEN SUBSTR((s.local_relpath), 1, LENGTH(?2)) = (?2)  THEN CASE WHEN LENGTH(?2) = LENGTH(s.local_relpath) THEN '' WHEN SUBSTR((s.local_relpath), LENGTH(?2)+1, 1) = '/' THEN SUBSTR((s.local_relpath), LENGTH(?2)+2) END END) WHEN SUBSTR((s.local_relpath), 1, LENGTH(?2)) = (?2) THEN CASE WHEN LENGTH(?2) = LENGTH(s.local_relpath) THEN (?4) WHEN SUBSTR((s.local_relpath), LENGTH(?2)+1, 1) = '/' THEN (?4) || SUBSTR((s.local_relpath), LENGTH(?2)+1) END END) drp, 'normal' " \
  "FROM nodes s " \
  "WHERE s.wc_id = ?1 AND s.local_relpath = ?2 AND s.op_depth = ?3 " \
  "UNION ALL " \
  "SELECT s.local_relpath, s.kind, " \
  "  (CASE WHEN (?2) = '' THEN (CASE WHEN (?4) = '' THEN (s.local_relpath) WHEN (s.local_relpath) = '' THEN (?4) ELSE (?4) || '/' || (s.local_relpath) END) WHEN (?4) = '' THEN (CASE WHEN (?2) = '' THEN (s.local_relpath)  WHEN SUBSTR((s.local_relpath), 1, LENGTH(?2)) = (?2)  THEN CASE WHEN LENGTH(?2) = LENGTH(s.local_relpath) THEN '' WHEN SUBSTR((s.local_relpath), LENGTH(?2)+1, 1) = '/' THEN SUBSTR((s.local_relpath), LENGTH(?2)+2) END END) WHEN SUBSTR((s.local_relpath), 1, LENGTH(?2)) = (?2) THEN CASE WHEN LENGTH(?2) = LENGTH(s.local_relpath) THEN (?4) WHEN SUBSTR((s.local_relpath), LENGTH(?2)+1, 1) = '/' THEN (?4) || SUBSTR((s.local_relpath), LENGTH(?2)+1) END END) drp, d.presence " \
  "FROM nodes s " \
  "LEFT OUTER JOIN nodes d ON d.wc_id= ?1 AND d.op_depth = ?5 " \
  "     AND d.local_relpath = drp " \
  "WHERE s.wc_id = ?1 " \
  "  AND (((s.local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((s.local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  "  AND s.op_depth = ?3 " \
  "ORDER BY s.local_relpath " \
  ""

#define STMT_SELECT_DESCENDANTS_OP_DEPTH_RV 30
#define STMT_30_INFO {"STMT_SELECT_DESCENDANTS_OP_DEPTH_RV", NULL}
#define STMT_30 \
  "SELECT local_relpath, kind " \
  "FROM nodes " \
  "WHERE wc_id = ?1 " \
  "  AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  "  AND op_depth = ?3 " \
  "  AND presence in ('normal', 'incomplete') " \
  "ORDER BY local_relpath DESC " \
  ""

#define STMT_COPY_NODE_MOVE 31
#define STMT_31_INFO {"STMT_COPY_NODE_MOVE", NULL}
#define STMT_31 \
  "INSERT OR REPLACE INTO nodes ( " \
  "    wc_id, local_relpath, op_depth, parent_relpath, repos_id, repos_path, " \
  "    revision, presence, depth, kind, changed_revision, changed_date, " \
  "    changed_author, checksum, properties, translated_size, last_mod_time, " \
  "    symlink_target, moved_here, moved_to ) " \
  "SELECT " \
  "    s.wc_id, ?4 , ?5 , ?6 , " \
  "    s.repos_id, " \
  "    s.repos_path, s.revision, s.presence, s.depth, s.kind, s.changed_revision, " \
  "    s.changed_date, s.changed_author, s.checksum, s.properties, " \
  "    CASE WHEN d.checksum=s.checksum THEN d.translated_size END, " \
  "    CASE WHEN d.checksum=s.checksum THEN d.last_mod_time END, " \
  "    s.symlink_target, 1, d.moved_to " \
  "FROM nodes s " \
  "LEFT JOIN nodes d ON d.wc_id=?1 AND d.local_relpath=?4 AND d.op_depth=?5 " \
  "WHERE s.wc_id = ?1 AND s.local_relpath = ?2 AND s.op_depth = ?3 " \
  ""

#define STMT_SELECT_NO_LONGER_MOVED_RV 32
#define STMT_32_INFO {"STMT_SELECT_NO_LONGER_MOVED_RV", NULL}
#define STMT_32 \
  "SELECT d.local_relpath, (CASE WHEN (?2) = '' THEN (CASE WHEN (?4) = '' THEN (d.local_relpath) WHEN (d.local_relpath) = '' THEN (?4) ELSE (?4) || '/' || (d.local_relpath) END) WHEN (?4) = '' THEN (CASE WHEN (?2) = '' THEN (d.local_relpath)  WHEN SUBSTR((d.local_relpath), 1, LENGTH(?2)) = (?2)  THEN CASE WHEN LENGTH(?2) = LENGTH(d.local_relpath) THEN '' WHEN SUBSTR((d.local_relpath), LENGTH(?2)+1, 1) = '/' THEN SUBSTR((d.local_relpath), LENGTH(?2)+2) END END) WHEN SUBSTR((d.local_relpath), 1, LENGTH(?2)) = (?2) THEN CASE WHEN LENGTH(?2) = LENGTH(d.local_relpath) THEN (?4) WHEN SUBSTR((d.local_relpath), LENGTH(?2)+1, 1) = '/' THEN (?4) || SUBSTR((d.local_relpath), LENGTH(?2)+1) END END) srp, " \
  "       b.presence, b.op_depth " \
  "FROM nodes d " \
  "LEFT OUTER JOIN nodes b ON b.wc_id = ?1 AND b.local_relpath = d.local_relpath " \
  "            AND b.op_depth = (SELECT MAX(x.op_depth) FROM nodes x " \
  "                              WHERE x.wc_id = ?1 " \
  "                                AND x.local_relpath = b.local_relpath " \
  "                                AND x.op_depth < ?3) " \
  "WHERE d.wc_id = ?1 " \
  "  AND (((d.local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((d.local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  "  AND d.op_depth = ?3 " \
  "  AND NOT EXISTS(SELECT * FROM nodes s " \
  "                 WHERE s.wc_id = ?1 " \
  "                   AND s.local_relpath = srp " \
  "                   AND s.op_depth = ?5) " \
  "ORDER BY d.local_relpath DESC " \
  ""

#define STMT_SELECT_OP_DEPTH_CHILDREN 33
#define STMT_33_INFO {"STMT_SELECT_OP_DEPTH_CHILDREN", NULL}
#define STMT_33 \
  "SELECT local_relpath, kind FROM nodes " \
  "WHERE wc_id = ?1 " \
  "  AND parent_relpath = ?2 " \
  "  AND op_depth = ?3 " \
  "  AND presence != 'base-deleted' " \
  "  AND file_external is NULL " \
  "ORDER BY local_relpath " \
  ""

#define STMT_SELECT_OP_DEPTH_CHILDREN_EXISTS 34
#define STMT_34_INFO {"STMT_SELECT_OP_DEPTH_CHILDREN_EXISTS", NULL}
#define STMT_34 \
  "SELECT local_relpath, kind FROM nodes " \
  "WHERE wc_id = ?1 " \
  "  AND parent_relpath = ?2 " \
  "  AND op_depth = ?3 " \
  "  AND presence IN ('normal', 'incomplete') " \
  "ORDER BY local_relpath " \
  ""

#define STMT_SELECT_GE_OP_DEPTH_CHILDREN 35
#define STMT_35_INFO {"STMT_SELECT_GE_OP_DEPTH_CHILDREN", NULL}
#define STMT_35 \
  "SELECT 1 FROM nodes " \
  "WHERE wc_id = ?1 AND parent_relpath = ?2 " \
  "  AND (op_depth > ?3 OR (op_depth = ?3 " \
  "                         AND presence IN ('normal', 'incomplete'))) " \
  "UNION ALL " \
  "SELECT 1 FROM ACTUAL_NODE a " \
  "WHERE wc_id = ?1 AND parent_relpath = ?2 " \
  "  AND NOT EXISTS (SELECT 1 FROM nodes n " \
  "                   WHERE wc_id = ?1 AND n.local_relpath = a.local_relpath) " \
  ""

#define STMT_DELETE_SHADOWED_RECURSIVE 36
#define STMT_36_INFO {"STMT_DELETE_SHADOWED_RECURSIVE", NULL}
#define STMT_36 \
  "DELETE FROM nodes " \
  "WHERE wc_id = ?1 " \
  "  AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  "  AND (op_depth < ?3 " \
  "       OR (op_depth = ?3 AND presence = 'base-deleted')) " \
  ""

#define STMT_CLEAR_MOVED_TO_FROM_DEST 37
#define STMT_37_INFO {"STMT_CLEAR_MOVED_TO_FROM_DEST", NULL}
#define STMT_37 \
  "UPDATE NODES SET moved_to = NULL " \
  "WHERE wc_id = ?1 " \
  "  AND moved_to = ?2 " \
  ""

#define STMT_SELECT_NOT_PRESENT_DESCENDANTS 38
#define STMT_38_INFO {"STMT_SELECT_NOT_PRESENT_DESCENDANTS", NULL}
#define STMT_38 \
  "SELECT local_relpath FROM nodes " \
  "WHERE wc_id = ?1 AND op_depth = ?3 " \
  "  AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  "  AND presence = 'not-present' " \
  ""

#define STMT_COMMIT_DESCENDANTS_TO_BASE 39
#define STMT_39_INFO {"STMT_COMMIT_DESCENDANTS_TO_BASE", NULL}
#define STMT_39 \
  "UPDATE NODES SET op_depth = 0, " \
  "                 repos_id = ?4, " \
  "                 repos_path = (CASE WHEN (?2) = '' THEN (CASE WHEN (?5) = '' THEN (local_relpath) WHEN (local_relpath) = '' THEN (?5) ELSE (?5) || '/' || (local_relpath) END) WHEN (?5) = '' THEN (CASE WHEN (?2) = '' THEN (local_relpath)  WHEN SUBSTR((local_relpath), 1, LENGTH(?2)) = (?2)  THEN CASE WHEN LENGTH(?2) = LENGTH(local_relpath) THEN '' WHEN SUBSTR((local_relpath), LENGTH(?2)+1, 1) = '/' THEN SUBSTR((local_relpath), LENGTH(?2)+2) END END) WHEN SUBSTR((local_relpath), 1, LENGTH(?2)) = (?2) THEN CASE WHEN LENGTH(?2) = LENGTH(local_relpath) THEN (?5) WHEN SUBSTR((local_relpath), LENGTH(?2)+1, 1) = '/' THEN (?5) || SUBSTR((local_relpath), LENGTH(?2)+1) END END), " \
  "                 revision = ?6, " \
  "                 dav_cache = NULL, " \
  "                 moved_here = NULL, " \
  "                 moved_to = NULL, " \
  "                 presence = CASE presence " \
  "                              WHEN 'normal' THEN 'normal' " \
  "                              WHEN 'excluded' THEN 'excluded' " \
  "                              ELSE 'not-present' " \
  "                            END " \
  "WHERE wc_id = ?1 " \
  "  AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  "  AND op_depth = ?3 " \
  ""

#define STMT_SELECT_NODE_CHILDREN 40
#define STMT_40_INFO {"STMT_SELECT_NODE_CHILDREN", NULL}
#define STMT_40 \
  "SELECT DISTINCT local_relpath FROM nodes " \
  "WHERE wc_id = ?1 AND parent_relpath = ?2 " \
  "ORDER BY local_relpath " \
  ""

#define STMT_SELECT_WORKING_CHILDREN 41
#define STMT_41_INFO {"STMT_SELECT_WORKING_CHILDREN", NULL}
#define STMT_41 \
  "SELECT DISTINCT local_relpath FROM nodes " \
  "WHERE wc_id = ?1 AND parent_relpath = ?2 " \
  "  AND (op_depth > (SELECT MAX(op_depth) FROM nodes " \
  "                   WHERE wc_id = ?1 AND local_relpath = ?2) " \
  "       OR " \
  "       (op_depth = (SELECT MAX(op_depth) FROM nodes " \
  "                    WHERE wc_id = ?1 AND local_relpath = ?2) " \
  "        AND presence IN ('normal', 'incomplete'))) " \
  "ORDER BY local_relpath " \
  ""

#define STMT_SELECT_BASE_NOT_PRESENT_CHILDREN 42
#define STMT_42_INFO {"STMT_SELECT_BASE_NOT_PRESENT_CHILDREN", NULL}
#define STMT_42 \
  "SELECT local_relpath FROM nodes " \
  "WHERE wc_id = ?1 AND parent_relpath = ?2 AND op_depth = 0 " \
  "  AND presence = 'not-present' " \
  "ORDER BY local_relpath " \
  ""

#define STMT_SELECT_NODE_PROPS 43
#define STMT_43_INFO {"STMT_SELECT_NODE_PROPS", NULL}
#define STMT_43 \
  "SELECT properties, presence FROM nodes " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 " \
  "ORDER BY op_depth DESC " \
  ""

#define STMT_SELECT_ACTUAL_PROPS 44
#define STMT_44_INFO {"STMT_SELECT_ACTUAL_PROPS", NULL}
#define STMT_44 \
  "SELECT properties FROM actual_node " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 " \
  ""

#define STMT_UPDATE_ACTUAL_PROPS 45
#define STMT_45_INFO {"STMT_UPDATE_ACTUAL_PROPS", NULL}
#define STMT_45 \
  "UPDATE actual_node SET properties = ?3 " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 " \
  ""

#define STMT_INSERT_ACTUAL_PROPS 46
#define STMT_46_INFO {"STMT_INSERT_ACTUAL_PROPS", NULL}
#define STMT_46 \
  "INSERT INTO actual_node (wc_id, local_relpath, parent_relpath, properties) " \
  "VALUES (?1, ?2, ?3, ?4) " \
  ""

#define STMT_INSERT_LOCK 47
#define STMT_47_INFO {"STMT_INSERT_LOCK", NULL}
#define STMT_47 \
  "INSERT OR REPLACE INTO lock " \
  "(repos_id, repos_relpath, lock_token, lock_owner, lock_comment, " \
  " lock_date) " \
  "VALUES (?1, ?2, ?3, ?4, ?5, ?6) " \
  ""

#define STMT_SELECT_BASE_NODE_LOCK_TOKENS_RECURSIVE 48
#define STMT_48_INFO {"STMT_SELECT_BASE_NODE_LOCK_TOKENS_RECURSIVE", NULL}
#define STMT_48 \
  "SELECT nodes.repos_id, nodes.repos_path, lock_token " \
  "FROM nodes " \
  "LEFT JOIN lock ON nodes.repos_id = lock.repos_id " \
  "  AND nodes.repos_path = lock.repos_relpath " \
  "WHERE wc_id = ?1 AND op_depth = 0 " \
  "  AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  ""

#define STMT_INSERT_WCROOT 49
#define STMT_49_INFO {"STMT_INSERT_WCROOT", NULL}
#define STMT_49 \
  "INSERT INTO wcroot (local_abspath) " \
  "VALUES (?1) " \
  ""

#define STMT_UPDATE_BASE_NODE_DAV_CACHE 50
#define STMT_50_INFO {"STMT_UPDATE_BASE_NODE_DAV_CACHE", NULL}
#define STMT_50 \
  "UPDATE nodes SET dav_cache = ?3 " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0 " \
  ""

#define STMT_SELECT_BASE_DAV_CACHE 51
#define STMT_51_INFO {"STMT_SELECT_BASE_DAV_CACHE", NULL}
#define STMT_51 \
  "SELECT dav_cache FROM nodes " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0 " \
  ""

#define STMT_SELECT_DELETION_INFO 52
#define STMT_52_INFO {"STMT_SELECT_DELETION_INFO", NULL}
#define STMT_52 \
  "SELECT b.presence, w.presence, w.op_depth, w.moved_to " \
  "FROM nodes w " \
  "LEFT JOIN nodes b ON b.wc_id = ?1 AND b.local_relpath = ?2 AND b.op_depth = 0 " \
  "WHERE w.wc_id = ?1 AND w.local_relpath = ?2 " \
  "  AND w.op_depth = (SELECT MAX(op_depth) FROM nodes d " \
  "                    WHERE d.wc_id = ?1 AND d.local_relpath = ?2 " \
  "                      AND d.op_depth > 0) " \
  "LIMIT 1 " \
  ""

#define STMT_SELECT_MOVED_TO_NODE 53
#define STMT_53_INFO {"STMT_SELECT_MOVED_TO_NODE", NULL}
#define STMT_53 \
  "SELECT op_depth, moved_to " \
  "FROM nodes " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 AND moved_to IS NOT NULL " \
  "ORDER BY op_depth DESC " \
  ""

#define STMT_SELECT_OP_DEPTH_MOVED_TO 54
#define STMT_54_INFO {"STMT_SELECT_OP_DEPTH_MOVED_TO", NULL}
#define STMT_54 \
  "SELECT op_depth, moved_to " \
  "FROM nodes " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > ?3 " \
  "  AND EXISTS(SELECT * from nodes " \
  "             WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?3 " \
  "             AND presence IN ('normal', 'incomplete')) " \
  "ORDER BY op_depth ASC " \
  "LIMIT 1 " \
  ""

#define STMT_SELECT_MOVED_TO 55
#define STMT_55_INFO {"STMT_SELECT_MOVED_TO", NULL}
#define STMT_55 \
  "SELECT moved_to " \
  "FROM nodes " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?3 " \
  ""

#define STMT_SELECT_MOVED_BACK 56
#define STMT_56_INFO {"STMT_SELECT_MOVED_BACK", NULL}
#define STMT_56 \
  "SELECT u.local_relpath, " \
  "       u.presence, u.repos_id, u.repos_path, u.revision, " \
  "       l.presence, l.repos_id, l.repos_path, l.revision, " \
  "       u.moved_here, u.moved_to " \
  "FROM nodes u " \
  "LEFT OUTER JOIN nodes l ON l.wc_id = ?1 " \
  "                       AND l.local_relpath = u.local_relpath " \
  "                       AND l.op_depth = ?3 " \
  "WHERE u.wc_id = ?1 " \
  "  AND u.local_relpath = ?2 " \
  "  AND u.op_depth = ?4 " \
  "UNION ALL " \
  "SELECT u.local_relpath, " \
  "       u.presence, u.repos_id, u.repos_path, u.revision, " \
  "       l.presence, l.repos_id, l.repos_path, l.revision, " \
  "       u.moved_here, NULL " \
  "FROM nodes u " \
  "LEFT OUTER JOIN nodes l ON l.wc_id=?1 " \
  "                       AND l.local_relpath=u.local_relpath " \
  "                       AND l.op_depth=?3 " \
  "WHERE u.wc_id = ?1 " \
  "  AND (((u.local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((u.local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  "  AND u.op_depth = ?4 " \
  ""

#define STMT_DELETE_LOCK 57
#define STMT_57_INFO {"STMT_DELETE_LOCK", NULL}
#define STMT_57 \
  "DELETE FROM lock " \
  "WHERE repos_id = ?1 AND repos_relpath = ?2 " \
  ""

#define STMT_DELETE_LOCK_RECURSIVELY 58
#define STMT_58_INFO {"STMT_DELETE_LOCK_RECURSIVELY", NULL}
#define STMT_58 \
  "DELETE FROM lock " \
  "WHERE repos_id = ?1 AND (repos_relpath = ?2 OR (((repos_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((repos_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \
  ""

#define STMT_CLEAR_BASE_NODE_RECURSIVE_DAV_CACHE 59
#define STMT_59_INFO {"STMT_CLEAR_BASE_NODE_RECURSIVE_DAV_CACHE", NULL}
#define STMT_59 \
  "UPDATE nodes SET dav_cache = NULL " \
  "WHERE dav_cache IS NOT NULL AND wc_id = ?1 AND op_depth = 0 " \
  "  AND (local_relpath = ?2 " \
  "       OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \
  ""

#define STMT_RECURSIVE_UPDATE_NODE_REPO 60
#define STMT_60_INFO {"STMT_RECURSIVE_UPDATE_NODE_REPO", NULL}
#define STMT_60 \
  "UPDATE nodes SET repos_id = ?4, dav_cache = NULL " \
  "WHERE (wc_id = ?1 AND local_relpath = ?2 AND repos_id = ?3) " \
  "   OR (wc_id = ?1 AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  "       AND repos_id = ?3) " \
  ""

#define STMT_UPDATE_LOCK_REPOS_ID 61
#define STMT_61_INFO {"STMT_UPDATE_LOCK_REPOS_ID", NULL}
#define STMT_61 \
  "UPDATE lock SET repos_id = ?2 " \
  "WHERE repos_id = ?1 " \
  ""

#define STMT_UPDATE_NODE_FILEINFO 62
#define STMT_62_INFO {"STMT_UPDATE_NODE_FILEINFO", NULL}
#define STMT_62 \
  "UPDATE nodes SET translated_size = ?3, last_mod_time = ?4 " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 " \
  "  AND op_depth = (SELECT MAX(op_depth) FROM nodes " \
  "                  WHERE wc_id = ?1 AND local_relpath = ?2) " \
  ""

#define STMT_INSERT_ACTUAL_CONFLICT 63
#define STMT_63_INFO {"STMT_INSERT_ACTUAL_CONFLICT", NULL}
#define STMT_63 \
  "INSERT INTO actual_node (wc_id, local_relpath, conflict_data, parent_relpath) " \
  "VALUES (?1, ?2, ?3, ?4) " \
  ""

#define STMT_UPDATE_ACTUAL_CONFLICT 64
#define STMT_64_INFO {"STMT_UPDATE_ACTUAL_CONFLICT", NULL}
#define STMT_64 \
  "UPDATE actual_node SET conflict_data = ?3 " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 " \
  ""

#define STMT_UPDATE_ACTUAL_CHANGELISTS 65
#define STMT_65_INFO {"STMT_UPDATE_ACTUAL_CHANGELISTS", NULL}
#define STMT_65 \
  "UPDATE actual_node SET changelist = ?3 " \
  "WHERE wc_id = ?1 " \
  "  AND (local_relpath = ?2 OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \
  "  AND local_relpath = (SELECT local_relpath FROM targets_list AS t " \
  "                       WHERE wc_id = ?1 " \
  "                         AND t.local_relpath = actual_node.local_relpath " \
  "                         AND kind = 'file') " \
  ""

#define STMT_UPDATE_ACTUAL_CLEAR_CHANGELIST 66
#define STMT_66_INFO {"STMT_UPDATE_ACTUAL_CLEAR_CHANGELIST", NULL}
#define STMT_66 \
  "UPDATE actual_node SET changelist = NULL " \
  " WHERE wc_id = ?1 AND local_relpath = ?2 " \
  ""

#define STMT_MARK_SKIPPED_CHANGELIST_DIRS 67
#define STMT_67_INFO {"STMT_MARK_SKIPPED_CHANGELIST_DIRS", NULL}
#define STMT_67 \
  "INSERT INTO changelist_list (wc_id, local_relpath, notify, changelist) " \
  "SELECT wc_id, local_relpath, 7, ?3 " \
  "FROM targets_list " \
  "WHERE wc_id = ?1 " \
  "  AND (local_relpath = ?2 OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \
  "  AND kind = 'dir' " \
  ""

#define STMT_RESET_ACTUAL_WITH_CHANGELIST 68
#define STMT_68_INFO {"STMT_RESET_ACTUAL_WITH_CHANGELIST", NULL}
#define STMT_68 \
  "REPLACE INTO actual_node ( " \
  "  wc_id, local_relpath, parent_relpath, changelist) " \
  "VALUES (?1, ?2, ?3, ?4) " \
  ""

#define STMT_CREATE_CHANGELIST_LIST 69
#define STMT_69_INFO {"STMT_CREATE_CHANGELIST_LIST", NULL}
#define STMT_69 \
  "DROP TABLE IF EXISTS changelist_list; " \
  "CREATE TEMPORARY TABLE changelist_list ( " \
  "  wc_id  INTEGER NOT NULL, " \
  "  local_relpath TEXT NOT NULL, " \
  "  notify INTEGER NOT NULL, " \
  "  changelist TEXT NOT NULL, " \
  "  PRIMARY KEY (wc_id, local_relpath, notify DESC) " \
  ") " \
  ""

#define STMT_CREATE_CHANGELIST_TRIGGER 70
#define STMT_70_INFO {"STMT_CREATE_CHANGELIST_TRIGGER", NULL}
#define STMT_70 \
  "DROP TRIGGER IF EXISTS   trigger_changelist_list_change; " \
  "CREATE TEMPORARY TRIGGER trigger_changelist_list_change " \
  "BEFORE UPDATE ON actual_node " \
  "WHEN old.changelist IS NOT new.changelist " \
  "BEGIN " \
  "  INSERT INTO changelist_list(wc_id, local_relpath, notify, changelist) " \
  "  SELECT old.wc_id, old.local_relpath, 27, old.changelist " \
  "   WHERE old.changelist is NOT NULL; " \
  "  INSERT INTO changelist_list(wc_id, local_relpath, notify, changelist) " \
  "  SELECT new.wc_id, new.local_relpath, 26, new.changelist " \
  "   WHERE new.changelist IS NOT NULL; " \
  "END " \
  ""

#define STMT_FINALIZE_CHANGELIST 71
#define STMT_71_INFO {"STMT_FINALIZE_CHANGELIST", NULL}
#define STMT_71 \
  "DROP TRIGGER trigger_changelist_list_change; " \
  "DROP TABLE changelist_list; " \
  "DROP TABLE targets_list " \
  ""

#define STMT_SELECT_CHANGELIST_LIST 72
#define STMT_72_INFO {"STMT_SELECT_CHANGELIST_LIST", NULL}
#define STMT_72 \
  "SELECT wc_id, local_relpath, notify, changelist " \
  "FROM changelist_list " \
  "ORDER BY wc_id, local_relpath ASC, notify DESC " \
  ""

#define STMT_CREATE_TARGETS_LIST 73
#define STMT_73_INFO {"STMT_CREATE_TARGETS_LIST", NULL}
#define STMT_73 \
  "DROP TABLE IF EXISTS targets_list; " \
  "CREATE TEMPORARY TABLE targets_list ( " \
  "  wc_id  INTEGER NOT NULL, " \
  "  local_relpath TEXT NOT NULL, " \
  "  parent_relpath TEXT, " \
  "  kind TEXT NOT NULL, " \
  "  PRIMARY KEY (wc_id, local_relpath) " \
  "  ); " \
  ""

#define STMT_DROP_TARGETS_LIST 74
#define STMT_74_INFO {"STMT_DROP_TARGETS_LIST", NULL}
#define STMT_74 \
  "DROP TABLE targets_list " \
  ""

#define STMT_INSERT_TARGET 75
#define STMT_75_INFO {"STMT_INSERT_TARGET", NULL}
#define STMT_75 \
  "INSERT INTO targets_list(wc_id, local_relpath, parent_relpath, kind) " \
  "SELECT wc_id, local_relpath, parent_relpath, kind " \
  "FROM nodes_current " \
  "WHERE wc_id = ?1 " \
  "  AND local_relpath = ?2 " \
  ""

#define STMT_INSERT_TARGET_DEPTH_FILES 76
#define STMT_76_INFO {"STMT_INSERT_TARGET_DEPTH_FILES", NULL}
#define STMT_76 \
  "INSERT INTO targets_list(wc_id, local_relpath, parent_relpath, kind) " \
  "SELECT wc_id, local_relpath, parent_relpath, kind " \
  "FROM nodes_current " \
  "WHERE wc_id = ?1 " \
  "  AND parent_relpath = ?2 " \
  "  AND kind = 'file' " \
  ""

#define STMT_INSERT_TARGET_DEPTH_IMMEDIATES 77
#define STMT_77_INFO {"STMT_INSERT_TARGET_DEPTH_IMMEDIATES", NULL}
#define STMT_77 \
  "INSERT INTO targets_list(wc_id, local_relpath, parent_relpath, kind) " \
  "SELECT wc_id, local_relpath, parent_relpath, kind " \
  "FROM nodes_current " \
  "WHERE wc_id = ?1 " \
  "  AND parent_relpath = ?2 " \
  ""

#define STMT_INSERT_TARGET_DEPTH_INFINITY 78
#define STMT_78_INFO {"STMT_INSERT_TARGET_DEPTH_INFINITY", NULL}
#define STMT_78 \
  "INSERT INTO targets_list(wc_id, local_relpath, parent_relpath, kind) " \
  "SELECT wc_id, local_relpath, parent_relpath, kind " \
  "FROM nodes_current " \
  "WHERE wc_id = ?1 " \
  "  AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  ""

#define STMT_INSERT_TARGET_WITH_CHANGELIST 79
#define STMT_79_INFO {"STMT_INSERT_TARGET_WITH_CHANGELIST", NULL}
#define STMT_79 \
  "INSERT INTO targets_list(wc_id, local_relpath, parent_relpath, kind) " \
  "SELECT N.wc_id, N.local_relpath, N.parent_relpath, N.kind " \
  "  FROM actual_node AS A JOIN nodes_current AS N " \
  "    ON A.wc_id = N.wc_id AND A.local_relpath = N.local_relpath " \
  " WHERE N.wc_id = ?1 " \
  "   AND N.local_relpath = ?2 " \
  "   AND A.changelist = ?3 " \
  ""

#define STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_FILES 80
#define STMT_80_INFO {"STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_FILES", NULL}
#define STMT_80 \
  "INSERT INTO targets_list(wc_id, local_relpath, parent_relpath, kind) " \
  "SELECT N.wc_id, N.local_relpath, N.parent_relpath, N.kind " \
  "  FROM actual_node AS A JOIN nodes_current AS N " \
  "    ON A.wc_id = N.wc_id AND A.local_relpath = N.local_relpath " \
  " WHERE N.wc_id = ?1 " \
  "   AND N.parent_relpath = ?2 " \
  "   AND kind = 'file' " \
  "   AND A.changelist = ?3 " \
  ""

#define STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_IMMEDIATES 81
#define STMT_81_INFO {"STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_IMMEDIATES", NULL}
#define STMT_81 \
  "INSERT INTO targets_list(wc_id, local_relpath, parent_relpath, kind) " \
  "SELECT N.wc_id, N.local_relpath, N.parent_relpath, N.kind " \
  "  FROM actual_node AS A JOIN nodes_current AS N " \
  "    ON A.wc_id = N.wc_id AND A.local_relpath = N.local_relpath " \
  " WHERE N.wc_id = ?1 " \
  "   AND N.parent_relpath = ?2 " \
  "  AND A.changelist = ?3 " \
  ""

#define STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_INFINITY 82
#define STMT_82_INFO {"STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_INFINITY", NULL}
#define STMT_82 \
  "INSERT INTO targets_list(wc_id, local_relpath, parent_relpath, kind) " \
  "SELECT N.wc_id, N.local_relpath, N.parent_relpath, N.kind " \
  "  FROM actual_node AS A JOIN nodes_current AS N " \
  "    ON A.wc_id = N.wc_id AND A.local_relpath = N.local_relpath " \
  " WHERE N.wc_id = ?1 " \
  "   AND (((N.local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((N.local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  "   AND A.changelist = ?3 " \
  ""

#define STMT_INSERT_ACTUAL_EMPTIES 83
#define STMT_83_INFO {"STMT_INSERT_ACTUAL_EMPTIES", NULL}
#define STMT_83 \
  "INSERT OR IGNORE INTO actual_node ( " \
  "     wc_id, local_relpath, parent_relpath) " \
  "SELECT wc_id, local_relpath, parent_relpath " \
  "FROM targets_list " \
  ""

#define STMT_INSERT_ACTUAL_EMPTIES_FILES 84
#define STMT_84_INFO {"STMT_INSERT_ACTUAL_EMPTIES_FILES", NULL}
#define STMT_84 \
  "INSERT OR IGNORE INTO actual_node ( " \
  "     wc_id, local_relpath, parent_relpath) " \
  "SELECT wc_id, local_relpath, parent_relpath " \
  "FROM targets_list " \
  "WHERE kind='file' " \
  ""

#define STMT_DELETE_ACTUAL_EMPTY 85
#define STMT_85_INFO {"STMT_DELETE_ACTUAL_EMPTY", NULL}
#define STMT_85 \
  "DELETE FROM actual_node " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 " \
  "  AND properties IS NULL " \
  "  AND conflict_data IS NULL " \
  "  AND changelist IS NULL " \
  "  AND text_mod IS NULL " \
  "  AND older_checksum IS NULL " \
  "  AND right_checksum IS NULL " \
  "  AND left_checksum IS NULL " \
  ""

#define STMT_DELETE_ACTUAL_EMPTIES 86
#define STMT_86_INFO {"STMT_DELETE_ACTUAL_EMPTIES", NULL}
#define STMT_86 \
  "DELETE FROM actual_node " \
  "WHERE wc_id = ?1 " \
  "  AND (local_relpath = ?2 OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \
  "  AND properties IS NULL " \
  "  AND conflict_data IS NULL " \
  "  AND changelist IS NULL " \
  "  AND text_mod IS NULL " \
  "  AND older_checksum IS NULL " \
  "  AND right_checksum IS NULL " \
  "  AND left_checksum IS NULL " \
  ""

#define STMT_DELETE_BASE_NODE 87
#define STMT_87_INFO {"STMT_DELETE_BASE_NODE", NULL}
#define STMT_87 \
  "DELETE FROM nodes " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0 " \
  ""

#define STMT_DELETE_WORKING_NODE 88
#define STMT_88_INFO {"STMT_DELETE_WORKING_NODE", NULL}
#define STMT_88 \
  "DELETE FROM nodes " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 " \
  "  AND op_depth = (SELECT MAX(op_depth) FROM nodes " \
  "                  WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > 0) " \
  ""

#define STMT_DELETE_LOWEST_WORKING_NODE 89
#define STMT_89_INFO {"STMT_DELETE_LOWEST_WORKING_NODE", NULL}
#define STMT_89 \
  "DELETE FROM nodes " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 " \
  "  AND op_depth = (SELECT MIN(op_depth) FROM nodes " \
  "                  WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > ?3) " \
  "  AND presence = 'base-deleted' " \
  ""

#define STMT_DELETE_NODE_ALL_LAYERS 90
#define STMT_90_INFO {"STMT_DELETE_NODE_ALL_LAYERS", NULL}
#define STMT_90 \
  "DELETE FROM nodes " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 " \
  ""

#define STMT_DELETE_NODES_ABOVE_DEPTH_RECURSIVE 91
#define STMT_91_INFO {"STMT_DELETE_NODES_ABOVE_DEPTH_RECURSIVE", NULL}
#define STMT_91 \
  "DELETE FROM nodes " \
  "WHERE wc_id = ?1 " \
  "  AND (local_relpath = ?2 " \
  "       OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \
  "  AND op_depth >= ?3 " \
  ""

#define STMT_DELETE_ACTUAL_NODE 92
#define STMT_92_INFO {"STMT_DELETE_ACTUAL_NODE", NULL}
#define STMT_92 \
  "DELETE FROM actual_node " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 " \
  ""

#define STMT_DELETE_ACTUAL_NODE_RECURSIVE 93
#define STMT_93_INFO {"STMT_DELETE_ACTUAL_NODE_RECURSIVE", NULL}
#define STMT_93 \
  "DELETE FROM actual_node " \
  "WHERE wc_id = ?1 " \
  "  AND (local_relpath = ?2 " \
  "       OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \
  ""

#define STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST 94
#define STMT_94_INFO {"STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST", NULL}
#define STMT_94 \
  "DELETE FROM actual_node " \
  "WHERE wc_id = ?1 " \
  "  AND local_relpath = ?2 " \
  "  AND (changelist IS NULL " \
  "       OR NOT EXISTS (SELECT 1 FROM nodes_current c " \
  "                      WHERE c.wc_id = ?1 AND c.local_relpath = ?2 " \
  "                        AND c.kind = 'file')) " \
  ""

#define STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE 95
#define STMT_95_INFO {"STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE", NULL}
#define STMT_95 \
  "DELETE FROM actual_node " \
  "WHERE wc_id = ?1 " \
  "  AND (local_relpath = ?2 " \
  "       OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \
  "  AND (changelist IS NULL " \
  "       OR NOT EXISTS (SELECT 1 FROM nodes_current c " \
  "                      WHERE c.wc_id = ?1 " \
  "                        AND c.local_relpath = actual_node.local_relpath " \
  "                        AND c.kind = 'file')) " \
  ""

#define STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST 96
#define STMT_96_INFO {"STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST", NULL}
#define STMT_96 \
  "UPDATE actual_node " \
  "SET properties = NULL, " \
  "    text_mod = NULL, " \
  "    conflict_data = NULL, " \
  "    tree_conflict_data = NULL, " \
  "    older_checksum = NULL, " \
  "    left_checksum = NULL, " \
  "    right_checksum = NULL " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 " \
  ""

#define STMT_CLEAR_ACTUAL_NODE_LEAVING_CONFLICT 97
#define STMT_97_INFO {"STMT_CLEAR_ACTUAL_NODE_LEAVING_CONFLICT", NULL}
#define STMT_97 \
  "UPDATE actual_node " \
  "SET properties = NULL, " \
  "    text_mod = NULL, " \
  "    tree_conflict_data = NULL, " \
  "    older_checksum = NULL, " \
  "    left_checksum = NULL, " \
  "    right_checksum = NULL, " \
  "    changelist = NULL " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 " \
  ""

#define STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE 98
#define STMT_98_INFO {"STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE", NULL}
#define STMT_98 \
  "UPDATE actual_node " \
  "SET properties = NULL, " \
  "    text_mod = NULL, " \
  "    conflict_data = NULL, " \
  "    tree_conflict_data = NULL, " \
  "    older_checksum = NULL, " \
  "    left_checksum = NULL, " \
  "    right_checksum = NULL " \
  "WHERE wc_id = ?1 " \
  "  AND (local_relpath = ?2 " \
  "       OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \
  ""

#define STMT_UPDATE_NODE_BASE_DEPTH 99
#define STMT_99_INFO {"STMT_UPDATE_NODE_BASE_DEPTH", NULL}
#define STMT_99 \
  "UPDATE nodes SET depth = ?3 " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0 " \
  "  AND kind='dir' " \
  "  AND presence IN ('normal', 'incomplete') " \
  ""

#define STMT_UPDATE_NODE_BASE_PRESENCE 100
#define STMT_100_INFO {"STMT_UPDATE_NODE_BASE_PRESENCE", NULL}
#define STMT_100 \
  "UPDATE nodes SET presence = ?3 " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0 " \
  ""

#define STMT_UPDATE_BASE_NODE_PRESENCE_REVNUM_AND_REPOS_PATH 101
#define STMT_101_INFO {"STMT_UPDATE_BASE_NODE_PRESENCE_REVNUM_AND_REPOS_PATH", NULL}
#define STMT_101 \
  "UPDATE nodes SET presence = ?3, revision = ?4, repos_path = ?5 " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0 " \
  ""

#define STMT_LOOK_FOR_WORK 102
#define STMT_102_INFO {"STMT_LOOK_FOR_WORK", NULL}
#define STMT_102 \
  "SELECT id FROM work_queue LIMIT 1 " \
  ""

#define STMT_INSERT_WORK_ITEM 103
#define STMT_103_INFO {"STMT_INSERT_WORK_ITEM", NULL}
#define STMT_103 \
  "INSERT INTO work_queue (work) VALUES (?1) " \
  ""

#define STMT_SELECT_WORK_ITEM 104
#define STMT_104_INFO {"STMT_SELECT_WORK_ITEM", NULL}
#define STMT_104 \
  "SELECT id, work FROM work_queue ORDER BY id LIMIT 1 " \
  ""

#define STMT_DELETE_WORK_ITEM 105
#define STMT_105_INFO {"STMT_DELETE_WORK_ITEM", NULL}
#define STMT_105 \
  "DELETE FROM work_queue WHERE id = ?1 " \
  ""

#define STMT_INSERT_OR_IGNORE_PRISTINE 106
#define STMT_106_INFO {"STMT_INSERT_OR_IGNORE_PRISTINE", NULL}
#define STMT_106 \
  "INSERT OR IGNORE INTO pristine (checksum, md5_checksum, size, refcount) " \
  "VALUES (?1, ?2, ?3, 0) " \
  ""

#define STMT_INSERT_PRISTINE 107
#define STMT_107_INFO {"STMT_INSERT_PRISTINE", NULL}
#define STMT_107 \
  "INSERT INTO pristine (checksum, md5_checksum, size, refcount) " \
  "VALUES (?1, ?2, ?3, 0) " \
  ""

#define STMT_SELECT_PRISTINE 108
#define STMT_108_INFO {"STMT_SELECT_PRISTINE", NULL}
#define STMT_108 \
  "SELECT md5_checksum " \
  "FROM pristine " \
  "WHERE checksum = ?1 " \
  ""

#define STMT_SELECT_PRISTINE_SIZE 109
#define STMT_109_INFO {"STMT_SELECT_PRISTINE_SIZE", NULL}
#define STMT_109 \
  "SELECT size " \
  "FROM pristine " \
  "WHERE checksum = ?1 LIMIT 1 " \
  ""

#define STMT_SELECT_PRISTINE_BY_MD5 110
#define STMT_110_INFO {"STMT_SELECT_PRISTINE_BY_MD5", NULL}
#define STMT_110 \
  "SELECT checksum " \
  "FROM pristine " \
  "WHERE md5_checksum = ?1 " \
  ""

#define STMT_SELECT_UNREFERENCED_PRISTINES 111
#define STMT_111_INFO {"STMT_SELECT_UNREFERENCED_PRISTINES", NULL}
#define STMT_111 \
  "SELECT checksum " \
  "FROM pristine " \
  "WHERE refcount = 0 " \
  ""

#define STMT_DELETE_PRISTINE_IF_UNREFERENCED 112
#define STMT_112_INFO {"STMT_DELETE_PRISTINE_IF_UNREFERENCED", NULL}
#define STMT_112 \
  "DELETE FROM pristine " \
  "WHERE checksum = ?1 AND refcount = 0 " \
  ""

#define STMT_SELECT_COPY_PRISTINES 113
#define STMT_113_INFO {"STMT_SELECT_COPY_PRISTINES", NULL}
#define STMT_113 \
  "SELECT n.checksum, md5_checksum, size " \
  "FROM nodes_current n " \
  "LEFT JOIN pristine p ON n.checksum = p.checksum " \
  "WHERE wc_id = ?1 " \
  "  AND n.local_relpath = ?2 " \
  "  AND n.checksum IS NOT NULL " \
  "UNION ALL " \
  "SELECT n.checksum, md5_checksum, size " \
  "FROM nodes n " \
  "LEFT JOIN pristine p ON n.checksum = p.checksum " \
  "WHERE wc_id = ?1 " \
  "  AND (((n.local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((n.local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  "  AND op_depth >= " \
  "      (SELECT MAX(op_depth) FROM nodes WHERE wc_id = ?1 AND local_relpath = ?2) " \
  "  AND n.checksum IS NOT NULL " \
  ""

#define STMT_VACUUM 114
#define STMT_114_INFO {"STMT_VACUUM", NULL}
#define STMT_114 \
  "VACUUM " \
  ""

#define STMT_SELECT_CONFLICT_VICTIMS 115
#define STMT_115_INFO {"STMT_SELECT_CONFLICT_VICTIMS", NULL}
#define STMT_115 \
  "SELECT local_relpath, conflict_data " \
  "FROM actual_node " \
  "WHERE wc_id = ?1 AND parent_relpath = ?2 AND " \
  "  NOT (conflict_data IS NULL) " \
  ""

#define STMT_INSERT_WC_LOCK 116
#define STMT_116_INFO {"STMT_INSERT_WC_LOCK", NULL}
#define STMT_116 \
  "INSERT INTO wc_lock (wc_id, local_dir_relpath, locked_levels) " \
  "VALUES (?1, ?2, ?3) " \
  ""

#define STMT_SELECT_WC_LOCK 117
#define STMT_117_INFO {"STMT_SELECT_WC_LOCK", NULL}
#define STMT_117 \
  "SELECT locked_levels FROM wc_lock " \
  "WHERE wc_id = ?1 AND local_dir_relpath = ?2 " \
  ""

#define STMT_SELECT_ANCESTOR_WCLOCKS 118
#define STMT_118_INFO {"STMT_SELECT_ANCESTOR_WCLOCKS", NULL}
#define STMT_118 \
  "SELECT local_dir_relpath, locked_levels FROM wc_lock " \
  "WHERE wc_id = ?1 " \
  "  AND ((local_dir_relpath >= ?3 AND local_dir_relpath <= ?2) " \
  "       OR local_dir_relpath = '') " \
  ""

#define STMT_DELETE_WC_LOCK 119
#define STMT_119_INFO {"STMT_DELETE_WC_LOCK", NULL}
#define STMT_119 \
  "DELETE FROM wc_lock " \
  "WHERE wc_id = ?1 AND local_dir_relpath = ?2 " \
  ""

#define STMT_FIND_WC_LOCK 120
#define STMT_120_INFO {"STMT_FIND_WC_LOCK", NULL}
#define STMT_120 \
  "SELECT local_dir_relpath FROM wc_lock " \
  "WHERE wc_id = ?1 " \
  "  AND (((local_dir_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_dir_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  ""

#define STMT_FIND_CONFLICT_DESCENDANT 121
#define STMT_121_INFO {"STMT_FIND_CONFLICT_DESCENDANT", NULL}
#define STMT_121 \
  "SELECT 1 FROM actual_node " \
  "WHERE wc_id = ?1 " \
  "  AND local_relpath > (?2 || '/') " \
  "  AND local_relpath < (?2 || '0') " \
  "  AND conflict_data IS NOT NULL " \
  "LIMIT 1 " \
  ""

#define STMT_DELETE_WC_LOCK_ORPHAN 122
#define STMT_122_INFO {"STMT_DELETE_WC_LOCK_ORPHAN", NULL}
#define STMT_122 \
  "DELETE FROM wc_lock " \
  "WHERE wc_id = ?1 AND local_dir_relpath = ?2 " \
  "AND NOT EXISTS (SELECT 1 FROM nodes " \
  "                 WHERE nodes.wc_id = ?1 " \
  "                   AND nodes.local_relpath = wc_lock.local_dir_relpath) " \
  ""

#define STMT_DELETE_WC_LOCK_ORPHAN_RECURSIVE 123
#define STMT_123_INFO {"STMT_DELETE_WC_LOCK_ORPHAN_RECURSIVE", NULL}
#define STMT_123 \
  "DELETE FROM wc_lock " \
  "WHERE wc_id = ?1 " \
  "  AND (local_dir_relpath = ?2 " \
  "       OR (((local_dir_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_dir_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \
  "  AND NOT EXISTS (SELECT 1 FROM nodes " \
  "                   WHERE nodes.wc_id = ?1 " \
  "                     AND nodes.local_relpath = wc_lock.local_dir_relpath) " \
  ""

#define STMT_APPLY_CHANGES_TO_BASE_NODE 124
#define STMT_124_INFO {"STMT_APPLY_CHANGES_TO_BASE_NODE", NULL}
#define STMT_124 \
  "INSERT OR REPLACE INTO nodes ( " \
  "  wc_id, local_relpath, op_depth, parent_relpath, repos_id, repos_path, " \
  "  revision, presence, depth, kind, changed_revision, changed_date, " \
  "  changed_author, checksum, properties, dav_cache, symlink_target, " \
  "  inherited_props, file_external ) " \
  "VALUES (?1, ?2, 0, " \
  "        ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15, ?16, ?17, " \
  "        (SELECT file_external FROM nodes " \
  "          WHERE wc_id = ?1 " \
  "            AND local_relpath = ?2 " \
  "            AND op_depth = 0)) " \
  ""

#define STMT_INSTALL_WORKING_NODE_FOR_DELETE 125
#define STMT_125_INFO {"STMT_INSTALL_WORKING_NODE_FOR_DELETE", NULL}
#define STMT_125 \
  "INSERT INTO nodes ( " \
  "    wc_id, local_relpath, op_depth, " \
  "    parent_relpath, presence, kind) " \
  "VALUES(?1, ?2, ?3, ?4, 'base-deleted', ?5) " \
  ""

#define STMT_REPLACE_WITH_BASE_DELETED 126
#define STMT_126_INFO {"STMT_REPLACE_WITH_BASE_DELETED", NULL}
#define STMT_126 \
  "INSERT OR REPLACE INTO nodes (wc_id, local_relpath, op_depth, parent_relpath, " \
  "                              kind, moved_to, presence) " \
  "SELECT wc_id, local_relpath, op_depth, parent_relpath, " \
  "       kind, moved_to, 'base-deleted' " \
  "  FROM nodes " \
  " WHERE wc_id = ?1 " \
  "   AND local_relpath = ?2 " \
  "   AND op_depth = ?3 " \
  ""

#define STMT_INSERT_DELETE_FROM_NODE_RECURSIVE 127
#define STMT_127_INFO {"STMT_INSERT_DELETE_FROM_NODE_RECURSIVE", NULL}
#define STMT_127 \
  "INSERT INTO nodes ( " \
  "    wc_id, local_relpath, op_depth, parent_relpath, presence, kind) " \
  "SELECT wc_id, local_relpath, ?4 , parent_relpath, 'base-deleted', " \
  "       kind " \
  "FROM nodes " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?3 " \
  "UNION ALL " \
  "SELECT wc_id, local_relpath, ?4 , parent_relpath, 'base-deleted', " \
  "       kind " \
  "FROM nodes " \
  "WHERE wc_id = ?1 " \
  "  AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  "  AND op_depth = ?3 " \
  "  AND presence NOT IN ('base-deleted', 'not-present', 'excluded', 'server-excluded') " \
  "  AND file_external IS NULL " \
  "ORDER BY local_relpath " \
  ""

#define STMT_INSERT_WORKING_NODE_FROM_BASE_COPY 128
#define STMT_128_INFO {"STMT_INSERT_WORKING_NODE_FROM_BASE_COPY", NULL}
#define STMT_128 \
  "INSERT OR REPLACE INTO nodes ( " \
  "    wc_id, local_relpath, op_depth, parent_relpath, repos_id, repos_path, " \
  "    revision, presence, depth, kind, changed_revision, changed_date, " \
  "    changed_author, checksum, properties, translated_size, last_mod_time, " \
  "    symlink_target, moved_to ) " \
  "SELECT wc_id, local_relpath, ?3 , parent_relpath, repos_id, " \
  "    repos_path, revision, presence, depth, kind, changed_revision, " \
  "    changed_date, changed_author, checksum, properties, translated_size, " \
  "    last_mod_time, symlink_target, " \
  "    (SELECT moved_to FROM nodes " \
  "     WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?3) moved_to " \
  "FROM nodes " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0 " \
  ""

#define STMT_INSERT_DELETE_FROM_BASE 129
#define STMT_129_INFO {"STMT_INSERT_DELETE_FROM_BASE", NULL}
#define STMT_129 \
  "INSERT INTO nodes ( " \
  "    wc_id, local_relpath, op_depth, parent_relpath, presence, kind) " \
  "SELECT wc_id, local_relpath, ?3 , parent_relpath, " \
  "    'base-deleted', kind " \
  "FROM nodes " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0 " \
  ""

#define STMT_UPDATE_OP_DEPTH_INCREASE_RECURSIVE 130
#define STMT_130_INFO {"STMT_UPDATE_OP_DEPTH_INCREASE_RECURSIVE", NULL}
#define STMT_130 \
  "UPDATE nodes SET op_depth = ?3 + 1 " \
  "WHERE wc_id = ?1 " \
  " AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  " AND op_depth = ?3 " \
  ""

#define STMT_COPY_OP_DEPTH_RECURSIVE 131
#define STMT_131_INFO {"STMT_COPY_OP_DEPTH_RECURSIVE", NULL}
#define STMT_131 \
  "INSERT INTO nodes ( " \
  "    wc_id, local_relpath, op_depth, parent_relpath, repos_id, repos_path, " \
  "    revision, presence, depth, kind, changed_revision, changed_date, " \
  "    changed_author, checksum, properties, translated_size, last_mod_time, " \
  "    symlink_target, moved_here, moved_to ) " \
  "SELECT " \
  "    wc_id, local_relpath, ?4, parent_relpath, repos_id, " \
  "    repos_path, revision, presence, depth, kind, changed_revision, " \
  "    changed_date, changed_author, checksum, properties, translated_size, " \
  "    last_mod_time, symlink_target, NULL, NULL " \
  "FROM nodes " \
  "WHERE wc_id = ?1 AND op_depth = ?3 AND local_relpath = ?2 " \
  "UNION ALL " \
  "SELECT " \
  "    wc_id, local_relpath, ?4, parent_relpath, repos_id, " \
  "    repos_path, revision, presence, depth, kind, changed_revision, " \
  "    changed_date, changed_author, checksum, properties, translated_size, " \
  "    last_mod_time, symlink_target, NULL, NULL " \
  "FROM nodes " \
  "WHERE wc_id = ?1 AND op_depth = ?3 " \
  "  AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  "ORDER BY local_relpath " \
  ""

#define STMT_DOES_NODE_EXIST 132
#define STMT_132_INFO {"STMT_DOES_NODE_EXIST", NULL}
#define STMT_132 \
  "SELECT 1 FROM nodes WHERE wc_id = ?1 AND local_relpath = ?2 " \
  "LIMIT 1 " \
  ""

#define STMT_HAS_SERVER_EXCLUDED_DESCENDANTS 133
#define STMT_133_INFO {"STMT_HAS_SERVER_EXCLUDED_DESCENDANTS", NULL}
#define STMT_133 \
  "SELECT local_relpath FROM nodes " \
  "WHERE wc_id = ?1 " \
  "  AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  "  AND op_depth = 0 AND presence = 'server-excluded' " \
  "LIMIT 1 " \
  ""

#define STMT_SELECT_ALL_EXCLUDED_DESCENDANTS 134
#define STMT_134_INFO {"STMT_SELECT_ALL_EXCLUDED_DESCENDANTS", NULL}
#define STMT_134 \
  "SELECT local_relpath FROM nodes " \
  "WHERE wc_id = ?1 " \
  "  AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  "  AND op_depth = 0 " \
  "  AND (presence = 'server-excluded' OR presence = 'excluded') " \
  ""

#define STMT_INSERT_WORKING_NODE_COPY_FROM 135
#define STMT_135_INFO {"STMT_INSERT_WORKING_NODE_COPY_FROM", NULL}
#define STMT_135 \
  "INSERT OR REPLACE INTO nodes ( " \
  "    wc_id, local_relpath, op_depth, parent_relpath, repos_id, " \
  "    repos_path, revision, presence, depth, moved_here, kind, changed_revision, " \
  "    changed_date, changed_author, checksum, properties, translated_size, " \
  "    last_mod_time, symlink_target, moved_to ) " \
  "SELECT wc_id, ?3 , ?4 , ?5 , " \
  "    repos_id, repos_path, revision, ?6 , depth, " \
  "    ?7, kind, changed_revision, changed_date, " \
  "    changed_author, checksum, properties, translated_size, " \
  "    last_mod_time, symlink_target, " \
  "    (SELECT dst.moved_to FROM nodes AS dst " \
  "                         WHERE dst.wc_id = ?1 " \
  "                         AND dst.local_relpath = ?3 " \
  "                         AND dst.op_depth = ?4) " \
  "FROM nodes_current " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 " \
  ""

#define STMT_INSERT_WORKING_NODE_COPY_FROM_DEPTH 136
#define STMT_136_INFO {"STMT_INSERT_WORKING_NODE_COPY_FROM_DEPTH", NULL}
#define STMT_136 \
  "INSERT OR REPLACE INTO nodes ( " \
  "    wc_id, local_relpath, op_depth, parent_relpath, repos_id, " \
  "    repos_path, revision, presence, depth, moved_here, kind, changed_revision, " \
  "    changed_date, changed_author, checksum, properties, translated_size, " \
  "    last_mod_time, symlink_target, moved_to ) " \
  "SELECT wc_id, ?3 , ?4 , ?5 , " \
  "    repos_id, repos_path, revision, ?6 , depth, " \
  "    ?8 , kind, changed_revision, changed_date, " \
  "    changed_author, checksum, properties, translated_size, " \
  "    last_mod_time, symlink_target, " \
  "    (SELECT dst.moved_to FROM nodes AS dst " \
  "                         WHERE dst.wc_id = ?1 " \
  "                         AND dst.local_relpath = ?3 " \
  "                         AND dst.op_depth = ?4) " \
  "FROM nodes " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?7 " \
  ""

#define STMT_UPDATE_BASE_REVISION 137
#define STMT_137_INFO {"STMT_UPDATE_BASE_REVISION", NULL}
#define STMT_137 \
  "UPDATE nodes SET revision = ?3 " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0 " \
  ""

#define STMT_UPDATE_BASE_REPOS 138
#define STMT_138_INFO {"STMT_UPDATE_BASE_REPOS", NULL}
#define STMT_138 \
  "UPDATE nodes SET repos_id = ?3, repos_path = ?4 " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0 " \
  ""

#define STMT_ACTUAL_HAS_CHILDREN 139
#define STMT_139_INFO {"STMT_ACTUAL_HAS_CHILDREN", NULL}
#define STMT_139 \
  "SELECT 1 FROM actual_node " \
  "WHERE wc_id = ?1 AND parent_relpath = ?2 " \
  "LIMIT 1 " \
  ""

#define STMT_INSERT_EXTERNAL 140
#define STMT_140_INFO {"STMT_INSERT_EXTERNAL", NULL}
#define STMT_140 \
  "INSERT OR REPLACE INTO externals ( " \
  "    wc_id, local_relpath, parent_relpath, presence, kind, def_local_relpath, " \
  "    repos_id, def_repos_relpath, def_operational_revision, def_revision) " \
  "VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10) " \
  ""

#define STMT_SELECT_EXTERNAL_INFO 141
#define STMT_141_INFO {"STMT_SELECT_EXTERNAL_INFO", NULL}
#define STMT_141 \
  "SELECT presence, kind, def_local_relpath, repos_id, " \
  "    def_repos_relpath, def_operational_revision, def_revision " \
  "FROM externals WHERE wc_id = ?1 AND local_relpath = ?2 " \
  "LIMIT 1 " \
  ""

#define STMT_DELETE_FILE_EXTERNALS 142
#define STMT_142_INFO {"STMT_DELETE_FILE_EXTERNALS", NULL}
#define STMT_142 \
  "DELETE FROM nodes " \
  "WHERE wc_id = ?1 " \
  "  AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  "  AND op_depth = 0 " \
  "  AND file_external IS NOT NULL " \
  ""

#define STMT_DELETE_FILE_EXTERNAL_REGISTATIONS 143
#define STMT_143_INFO {"STMT_DELETE_FILE_EXTERNAL_REGISTATIONS", NULL}
#define STMT_143 \
  "DELETE FROM externals " \
  "WHERE wc_id = ?1 " \
  "  AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  "  AND kind != 'dir' " \
  ""

#define STMT_DELETE_EXTERNAL_REGISTATIONS 144
#define STMT_144_INFO {"STMT_DELETE_EXTERNAL_REGISTATIONS", NULL}
#define STMT_144 \
  "DELETE FROM externals " \
  "WHERE wc_id = ?1 " \
  "  AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  ""

#define STMT_SELECT_COMMITTABLE_EXTERNALS_BELOW 145
#define STMT_145_INFO {"STMT_SELECT_COMMITTABLE_EXTERNALS_BELOW", NULL}
#define STMT_145 \
  "SELECT local_relpath, kind, def_repos_relpath, " \
  "  (SELECT root FROM repository AS r WHERE r.id = e.repos_id) " \
  "FROM externals e " \
  "WHERE wc_id = ?1 " \
  "  AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  "  AND def_revision IS NULL " \
  "  AND repos_id = (SELECT repos_id " \
  "                  FROM nodes AS n " \
  "                  WHERE n.wc_id = ?1 " \
  "                    AND n.local_relpath = '' " \
  "                    AND n.op_depth = 0) " \
  "  AND ((kind='dir') " \
  "       OR EXISTS (SELECT 1 FROM nodes " \
  "                  WHERE nodes.wc_id = e.wc_id " \
  "                  AND nodes.local_relpath = e.parent_relpath)) " \
  ""

#define STMT_SELECT_COMMITTABLE_EXTERNALS_IMMEDIATELY_BELOW 146
#define STMT_146_INFO {"STMT_SELECT_COMMITTABLE_EXTERNALS_IMMEDIATELY_BELOW", NULL}
#define STMT_146 \
  "SELECT local_relpath, kind, def_repos_relpath, " \
  "  (SELECT root FROM repository AS r WHERE r.id = e.repos_id) " \
  "FROM externals e " \
  "WHERE wc_id = ?1 " \
  "  AND (((e.local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((e.local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  "  AND parent_relpath = ?2 " \
  "  AND def_revision IS NULL " \
  "  AND repos_id = (SELECT repos_id " \
  "                    FROM nodes AS n " \
  "                    WHERE n.wc_id = ?1 " \
  "                      AND n.local_relpath = '' " \
  "                      AND n.op_depth = 0) " \
  "  AND ((kind='dir') " \
  "       OR EXISTS (SELECT 1 FROM nodes " \
  "                  WHERE nodes.wc_id = e.wc_id " \
  "                  AND nodes.local_relpath = e.parent_relpath)) " \
  ""

#define STMT_SELECT_EXTERNALS_DEFINED 147
#define STMT_147_INFO {"STMT_SELECT_EXTERNALS_DEFINED", NULL}
#define STMT_147 \
  "SELECT local_relpath, def_local_relpath " \
  "FROM externals " \
  "WHERE (wc_id = ?1 AND def_local_relpath = ?2) " \
  "   OR (wc_id = ?1 AND (((def_local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((def_local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \
  ""

#define STMT_DELETE_EXTERNAL 148
#define STMT_148_INFO {"STMT_DELETE_EXTERNAL", NULL}
#define STMT_148 \
  "DELETE FROM externals " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 " \
  ""

#define STMT_SELECT_EXTERNAL_PROPERTIES 149
#define STMT_149_INFO {"STMT_SELECT_EXTERNAL_PROPERTIES", NULL}
#define STMT_149 \
  "SELECT IFNULL((SELECT properties FROM actual_node a " \
  "               WHERE a.wc_id = ?1 AND A.local_relpath = n.local_relpath), " \
  "              properties), " \
  "       local_relpath, depth " \
  "FROM nodes_current n " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 " \
  "  AND kind = 'dir' AND presence IN ('normal', 'incomplete') " \
  "UNION ALL " \
  "SELECT IFNULL((SELECT properties FROM actual_node a " \
  "               WHERE a.wc_id = ?1 AND A.local_relpath = n.local_relpath), " \
  "              properties), " \
  "       local_relpath, depth " \
  "FROM nodes_current n " \
  "WHERE wc_id = ?1 AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  "  AND kind = 'dir' AND presence IN ('normal', 'incomplete') " \
  ""

#define STMT_SELECT_CURRENT_PROPS_RECURSIVE 150
#define STMT_150_INFO {"STMT_SELECT_CURRENT_PROPS_RECURSIVE", NULL}
#define STMT_150 \
  "SELECT IFNULL((SELECT properties FROM actual_node a " \
  "               WHERE a.wc_id = ?1 AND A.local_relpath = n.local_relpath), " \
  "              properties), " \
  "       local_relpath " \
  "FROM nodes_current n " \
  "WHERE (wc_id = ?1 AND local_relpath = ?2) " \
  "   OR (wc_id = ?1 AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \
  ""

#define STMT_PRAGMA_LOCKING_MODE 151
#define STMT_151_INFO {"STMT_PRAGMA_LOCKING_MODE", NULL}
#define STMT_151 \
  "PRAGMA locking_mode = exclusive; " \
  "PRAGMA journal_mode = DELETE " \
  ""

#define STMT_INSERT_ACTUAL_NODE 152
#define STMT_152_INFO {"STMT_INSERT_ACTUAL_NODE", NULL}
#define STMT_152 \
  "INSERT OR REPLACE INTO actual_node ( " \
  "  wc_id, local_relpath, parent_relpath, properties, changelist, conflict_data) " \
  "VALUES (?1, ?2, ?3, ?4, ?5, ?6) " \
  ""

#define STMT_SELECT_ALL_FILES 153
#define STMT_153_INFO {"STMT_SELECT_ALL_FILES", NULL}
#define STMT_153 \
  "SELECT local_relpath FROM nodes_current " \
  "WHERE wc_id = ?1 AND parent_relpath = ?2 AND kind = 'file' " \
  ""

#define STMT_UPDATE_NODE_PROPS 154
#define STMT_154_INFO {"STMT_UPDATE_NODE_PROPS", NULL}
#define STMT_154 \
  "UPDATE nodes SET properties = ?4 " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?3 " \
  ""

#define STMT_PRAGMA_TABLE_INFO_NODES 155
#define STMT_155_INFO {"STMT_PRAGMA_TABLE_INFO_NODES", NULL}
#define STMT_155 \
  "PRAGMA table_info(\"NODES\") " \
  ""

#define STMT_CREATE_TARGET_PROP_CACHE 156
#define STMT_156_INFO {"STMT_CREATE_TARGET_PROP_CACHE", NULL}
#define STMT_156 \
  "DROP TABLE IF EXISTS target_prop_cache; " \
  "CREATE TEMPORARY TABLE target_prop_cache ( " \
  "  local_relpath TEXT NOT NULL PRIMARY KEY, " \
  "  kind TEXT NOT NULL, " \
  "  properties BLOB " \
  "); " \
  ""

#define STMT_CACHE_TARGET_PROPS 157
#define STMT_157_INFO {"STMT_CACHE_TARGET_PROPS", NULL}
#define STMT_157 \
  "INSERT INTO target_prop_cache(local_relpath, kind, properties) " \
  " SELECT n.local_relpath, n.kind, " \
  "        IFNULL((SELECT properties FROM actual_node AS a " \
  "                 WHERE a.wc_id = n.wc_id " \
  "                   AND a.local_relpath = n.local_relpath), " \
  "               n.properties) " \
  "   FROM targets_list AS t " \
  "   JOIN nodes AS n " \
  "     ON n.wc_id = ?1 " \
  "    AND n.local_relpath = t.local_relpath " \
  "    AND n.op_depth = (SELECT MAX(op_depth) FROM nodes AS n3 " \
  "                      WHERE n3.wc_id = ?1 " \
  "                        AND n3.local_relpath = t.local_relpath) " \
  "  WHERE t.wc_id = ?1 " \
  "    AND (presence='normal' OR presence='incomplete') " \
  "  ORDER BY t.local_relpath " \
  ""

#define STMT_CACHE_TARGET_PRISTINE_PROPS 158
#define STMT_158_INFO {"STMT_CACHE_TARGET_PRISTINE_PROPS", NULL}
#define STMT_158 \
  "INSERT INTO target_prop_cache(local_relpath, kind, properties) " \
  " SELECT n.local_relpath, n.kind, " \
  "        CASE n.presence " \
  "          WHEN 'base-deleted' " \
  "          THEN (SELECT properties FROM nodes AS p " \
  "                 WHERE p.wc_id = n.wc_id " \
  "                   AND p.local_relpath = n.local_relpath " \
  "                   AND p.op_depth < n.op_depth " \
  "                 ORDER BY p.op_depth DESC ) " \
  "          ELSE properties END " \
  "  FROM targets_list AS t " \
  "  JOIN nodes AS n " \
  "    ON n.wc_id = ?1 " \
  "   AND n.local_relpath = t.local_relpath " \
  "   AND n.op_depth = (SELECT MAX(op_depth) FROM nodes AS n3 " \
  "                     WHERE n3.wc_id = ?1 " \
  "                       AND n3.local_relpath = t.local_relpath) " \
  "  WHERE t.wc_id = ?1 " \
  "    AND (presence = 'normal' " \
  "         OR presence = 'incomplete' " \
  "         OR presence = 'base-deleted') " \
  "  ORDER BY t.local_relpath " \
  ""

#define STMT_SELECT_ALL_TARGET_PROP_CACHE 159
#define STMT_159_INFO {"STMT_SELECT_ALL_TARGET_PROP_CACHE", NULL}
#define STMT_159 \
  "SELECT local_relpath, properties FROM target_prop_cache " \
  "ORDER BY local_relpath " \
  ""

#define STMT_DROP_TARGET_PROP_CACHE 160
#define STMT_160_INFO {"STMT_DROP_TARGET_PROP_CACHE", NULL}
#define STMT_160 \
  "DROP TABLE target_prop_cache; " \
  ""

#define STMT_CREATE_REVERT_LIST 161
#define STMT_161_INFO {"STMT_CREATE_REVERT_LIST", NULL}
#define STMT_161 \
  "DROP TABLE IF EXISTS revert_list; " \
  "CREATE TEMPORARY TABLE revert_list ( " \
  "   local_relpath TEXT NOT NULL, " \
  "   actual INTEGER NOT NULL, " \
  "   conflict_data BLOB, " \
  "   notify INTEGER, " \
  "   op_depth INTEGER, " \
  "   repos_id INTEGER, " \
  "   kind TEXT, " \
  "   PRIMARY KEY (local_relpath, actual) " \
  "   ); " \
  "DROP TRIGGER IF EXISTS   trigger_revert_list_nodes; " \
  "CREATE TEMPORARY TRIGGER trigger_revert_list_nodes " \
  "BEFORE DELETE ON nodes " \
  "BEGIN " \
  "   INSERT OR REPLACE INTO revert_list(local_relpath, actual, op_depth, " \
  "                                      repos_id, kind) " \
  "   SELECT OLD.local_relpath, 0, OLD.op_depth, OLD.repos_id, OLD.kind; " \
  "END; " \
  "DROP TRIGGER IF EXISTS   trigger_revert_list_actual_delete; " \
  "CREATE TEMPORARY TRIGGER trigger_revert_list_actual_delete " \
  "BEFORE DELETE ON actual_node " \
  "BEGIN " \
  "   INSERT OR REPLACE INTO revert_list(local_relpath, actual, conflict_data, " \
  "                                      notify) " \
  "   SELECT OLD.local_relpath, 1, OLD.conflict_data, " \
  "          CASE " \
  "            WHEN OLD.properties IS NOT NULL " \
  "            THEN 1 " \
  "            WHEN NOT EXISTS(SELECT 1 FROM NODES n " \
  "                            WHERE n.wc_id = OLD.wc_id " \
  "                              AND n.local_relpath = OLD.local_relpath) " \
  "            THEN 1 " \
  "          END notify " \
  "   WHERE OLD.conflict_data IS NOT NULL " \
  "      OR notify IS NOT NULL; " \
  "END; " \
  "DROP TRIGGER IF EXISTS   trigger_revert_list_actual_update; " \
  "CREATE TEMPORARY TRIGGER trigger_revert_list_actual_update " \
  "BEFORE UPDATE ON actual_node " \
  "BEGIN " \
  "   INSERT OR REPLACE INTO revert_list(local_relpath, actual, conflict_data, " \
  "                                      notify) " \
  "   SELECT OLD.local_relpath, 1, OLD.conflict_data, " \
  "          CASE " \
  "            WHEN OLD.properties IS NOT NULL " \
  "            THEN 1 " \
  "            WHEN NOT EXISTS(SELECT 1 FROM NODES n " \
  "                            WHERE n.wc_id = OLD.wc_id " \
  "                              AND n.local_relpath = OLD.local_relpath) " \
  "            THEN 1 " \
  "          END notify " \
  "   WHERE OLD.conflict_data IS NOT NULL " \
  "      OR notify IS NOT NULL; " \
  "END " \
  ""

#define STMT_DROP_REVERT_LIST_TRIGGERS 162
#define STMT_162_INFO {"STMT_DROP_REVERT_LIST_TRIGGERS", NULL}
#define STMT_162 \
  "DROP TRIGGER trigger_revert_list_nodes; " \
  "DROP TRIGGER trigger_revert_list_actual_delete; " \
  "DROP TRIGGER trigger_revert_list_actual_update " \
  ""

#define STMT_SELECT_REVERT_LIST 163
#define STMT_163_INFO {"STMT_SELECT_REVERT_LIST", NULL}
#define STMT_163 \
  "SELECT actual, notify, kind, op_depth, repos_id, conflict_data " \
  "FROM revert_list " \
  "WHERE local_relpath = ?1 " \
  "ORDER BY actual DESC " \
  ""

#define STMT_SELECT_REVERT_LIST_COPIED_CHILDREN 164
#define STMT_164_INFO {"STMT_SELECT_REVERT_LIST_COPIED_CHILDREN", NULL}
#define STMT_164 \
  "SELECT local_relpath, kind " \
  "FROM revert_list " \
  "WHERE (((local_relpath) > (CASE (?1) WHEN '' THEN '' ELSE (?1) || '/' END)) AND ((local_relpath) < CASE (?1) WHEN '' THEN X'FFFF' ELSE (?1) || '0' END)) " \
  "  AND op_depth >= ?2 " \
  "  AND repos_id IS NOT NULL " \
  "ORDER BY local_relpath " \
  ""

#define STMT_DELETE_REVERT_LIST 165
#define STMT_165_INFO {"STMT_DELETE_REVERT_LIST", NULL}
#define STMT_165 \
  "DELETE FROM revert_list WHERE local_relpath = ?1 " \
  ""

#define STMT_SELECT_REVERT_LIST_RECURSIVE 166
#define STMT_166_INFO {"STMT_SELECT_REVERT_LIST_RECURSIVE", NULL}
#define STMT_166 \
  "SELECT p.local_relpath, n.kind, a.notify, a.kind " \
  "FROM (SELECT DISTINCT local_relpath " \
  "      FROM revert_list " \
  "      WHERE (local_relpath = ?1 " \
  "        OR (((local_relpath) > (CASE (?1) WHEN '' THEN '' ELSE (?1) || '/' END)) AND ((local_relpath) < CASE (?1) WHEN '' THEN X'FFFF' ELSE (?1) || '0' END)))) p " \
  "LEFT JOIN revert_list n ON n.local_relpath=p.local_relpath AND n.actual=0 " \
  "LEFT JOIN revert_list a ON a.local_relpath=p.local_relpath AND a.actual=1 " \
  "ORDER BY p.local_relpath " \
  ""

#define STMT_DELETE_REVERT_LIST_RECURSIVE 167
#define STMT_167_INFO {"STMT_DELETE_REVERT_LIST_RECURSIVE", NULL}
#define STMT_167 \
  "DELETE FROM revert_list " \
  "WHERE (local_relpath = ?1 " \
  "       OR (((local_relpath) > (CASE (?1) WHEN '' THEN '' ELSE (?1) || '/' END)) AND ((local_relpath) < CASE (?1) WHEN '' THEN X'FFFF' ELSE (?1) || '0' END))) " \
  ""

#define STMT_DROP_REVERT_LIST 168
#define STMT_168_INFO {"STMT_DROP_REVERT_LIST", NULL}
#define STMT_168 \
  "DROP TABLE IF EXISTS revert_list " \
  ""

#define STMT_CREATE_DELETE_LIST 169
#define STMT_169_INFO {"STMT_CREATE_DELETE_LIST", NULL}
#define STMT_169 \
  "DROP TABLE IF EXISTS delete_list; " \
  "CREATE TEMPORARY TABLE delete_list ( " \
  "   local_relpath TEXT PRIMARY KEY NOT NULL UNIQUE " \
  "   ) " \
  ""

#define STMT_INSERT_DELETE_LIST 170
#define STMT_170_INFO {"STMT_INSERT_DELETE_LIST", NULL}
#define STMT_170 \
  "INSERT INTO delete_list(local_relpath) " \
  "SELECT ?2 " \
  "UNION ALL " \
  "SELECT local_relpath FROM nodes AS n " \
  "WHERE wc_id = ?1 " \
  "  AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  "  AND op_depth >= ?3 " \
  "  AND op_depth = (SELECT MAX(s.op_depth) FROM nodes AS s " \
  "                  WHERE s.wc_id = ?1 " \
  "                    AND s.local_relpath = n.local_relpath) " \
  "  AND presence NOT IN ('base-deleted', 'not-present', 'excluded', 'server-excluded') " \
  "  AND file_external IS NULL " \
  "ORDER by local_relpath " \
  ""

#define STMT_SELECT_DELETE_LIST 171
#define STMT_171_INFO {"STMT_SELECT_DELETE_LIST", NULL}
#define STMT_171 \
  "SELECT local_relpath FROM delete_list " \
  "ORDER BY local_relpath " \
  ""

#define STMT_FINALIZE_DELETE 172
#define STMT_172_INFO {"STMT_FINALIZE_DELETE", NULL}
#define STMT_172 \
  "DROP TABLE IF EXISTS delete_list " \
  ""

#define STMT_CREATE_UPDATE_MOVE_LIST 173
#define STMT_173_INFO {"STMT_CREATE_UPDATE_MOVE_LIST", NULL}
#define STMT_173 \
  "DROP TABLE IF EXISTS update_move_list; " \
  "CREATE TEMPORARY TABLE update_move_list ( " \
  "  local_relpath TEXT PRIMARY KEY NOT NULL UNIQUE, " \
  "  action INTEGER NOT NULL, " \
  "  kind TEXT NOT NULL, " \
  "  content_state INTEGER NOT NULL, " \
  "  prop_state  INTEGER NOT NULL " \
  "  ) " \
  ""

#define STMT_INSERT_UPDATE_MOVE_LIST 174
#define STMT_174_INFO {"STMT_INSERT_UPDATE_MOVE_LIST", NULL}
#define STMT_174 \
  "INSERT INTO update_move_list(local_relpath, action, kind, content_state, " \
  "  prop_state) " \
  "VALUES (?1, ?2, ?3, ?4, ?5) " \
  ""

#define STMT_SELECT_UPDATE_MOVE_LIST 175
#define STMT_175_INFO {"STMT_SELECT_UPDATE_MOVE_LIST", NULL}
#define STMT_175 \
  "SELECT local_relpath, action, kind, content_state, prop_state " \
  "FROM update_move_list " \
  "ORDER BY local_relpath " \
  ""

#define STMT_FINALIZE_UPDATE_MOVE 176
#define STMT_176_INFO {"STMT_FINALIZE_UPDATE_MOVE", NULL}
#define STMT_176 \
  "DROP TABLE IF EXISTS update_move_list " \
  ""

#define STMT_MOVE_NOTIFY_TO_REVERT 177
#define STMT_177_INFO {"STMT_MOVE_NOTIFY_TO_REVERT", NULL}
#define STMT_177 \
  "INSERT INTO revert_list (local_relpath, notify, kind, actual) " \
  "       SELECT local_relpath, 2, kind, 1 FROM update_move_list; " \
  "DROP TABLE update_move_list " \
  ""

#define STMT_SELECT_MIN_MAX_REVISIONS 178
#define STMT_178_INFO {"STMT_SELECT_MIN_MAX_REVISIONS", NULL}
#define STMT_178 \
  "SELECT MIN(revision), MAX(revision), " \
  "       MIN(changed_revision), MAX(changed_revision) FROM nodes " \
  "  WHERE wc_id = ?1 " \
  "    AND (local_relpath = ?2 " \
  "         OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \
  "    AND presence IN ('normal', 'incomplete') " \
  "    AND file_external IS NULL " \
  "    AND op_depth = 0 " \
  ""

#define STMT_HAS_SPARSE_NODES 179
#define STMT_179_INFO {"STMT_HAS_SPARSE_NODES", NULL}
#define STMT_179 \
  "SELECT 1 FROM nodes " \
  "WHERE wc_id = ?1 " \
  "  AND (local_relpath = ?2 " \
  "       OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \
  "  AND op_depth = 0 " \
  "  AND (presence IN ('server-excluded', 'excluded') " \
  "        OR depth NOT IN ('infinity', 'unknown')) " \
  "  AND file_external IS NULL " \
  "LIMIT 1 " \
  ""

#define STMT_SUBTREE_HAS_TREE_MODIFICATIONS 180
#define STMT_180_INFO {"STMT_SUBTREE_HAS_TREE_MODIFICATIONS", NULL}
#define STMT_180 \
  "SELECT 1 FROM nodes " \
  "WHERE wc_id = ?1 " \
  "  AND (local_relpath = ?2 " \
  "       OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \
  "  AND op_depth > 0 " \
  "LIMIT 1 " \
  ""

#define STMT_SUBTREE_HAS_PROP_MODIFICATIONS 181
#define STMT_181_INFO {"STMT_SUBTREE_HAS_PROP_MODIFICATIONS", NULL}
#define STMT_181 \
  "SELECT 1 FROM actual_node " \
  "WHERE wc_id = ?1 " \
  "  AND (local_relpath = ?2 " \
  "       OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \
  "  AND properties IS NOT NULL " \
  "LIMIT 1 " \
  ""

#define STMT_HAS_SWITCHED 182
#define STMT_182_INFO {"STMT_HAS_SWITCHED", NULL}
#define STMT_182 \
  "SELECT 1 " \
  "FROM nodes " \
  "WHERE wc_id = ?1 " \
  "  AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  "  AND op_depth = 0 " \
  "  AND file_external IS NULL " \
  "  AND presence IN ('normal', 'incomplete') " \
  "  AND repos_path IS NOT (CASE WHEN (?2) = '' THEN (CASE WHEN (?3) = '' THEN (local_relpath) WHEN (local_relpath) = '' THEN (?3) ELSE (?3) || '/' || (local_relpath) END) WHEN (?3) = '' THEN (CASE WHEN (?2) = '' THEN (local_relpath)  WHEN SUBSTR((local_relpath), 1, LENGTH(?2)) = (?2)  THEN CASE WHEN LENGTH(?2) = LENGTH(local_relpath) THEN '' WHEN SUBSTR((local_relpath), LENGTH(?2)+1, 1) = '/' THEN SUBSTR((local_relpath), LENGTH(?2)+2) END END) WHEN SUBSTR((local_relpath), 1, LENGTH(?2)) = (?2) THEN CASE WHEN LENGTH(?2) = LENGTH(local_relpath) THEN (?3) WHEN SUBSTR((local_relpath), LENGTH(?2)+1, 1) = '/' THEN (?3) || SUBSTR((local_relpath), LENGTH(?2)+1) END END) " \
  "LIMIT 1 " \
  ""

#define STMT_SELECT_MOVED_FROM_RELPATH 183
#define STMT_183_INFO {"STMT_SELECT_MOVED_FROM_RELPATH", NULL}
#define STMT_183 \
  "SELECT local_relpath, op_depth FROM nodes " \
  "WHERE wc_id = ?1 AND moved_to = ?2 AND op_depth > 0 " \
  ""

#define STMT_UPDATE_MOVED_TO_RELPATH 184
#define STMT_184_INFO {"STMT_UPDATE_MOVED_TO_RELPATH", NULL}
#define STMT_184 \
  "UPDATE nodes SET moved_to = ?4 " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?3 " \
  ""

#define STMT_CLEAR_MOVED_TO_RELPATH 185
#define STMT_185_INFO {"STMT_CLEAR_MOVED_TO_RELPATH", NULL}
#define STMT_185 \
  "UPDATE nodes SET moved_to = NULL " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?3 " \
  ""

#define STMT_CLEAR_MOVED_HERE_RECURSIVE 186
#define STMT_186_INFO {"STMT_CLEAR_MOVED_HERE_RECURSIVE", NULL}
#define STMT_186 \
  "UPDATE nodes SET moved_here = NULL " \
  "WHERE wc_id = ?1 " \
  " AND (local_relpath = ?2 OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \
  " AND op_depth = ?3 " \
  ""

#define STMT_SELECT_MOVED_HERE_CHILDREN 187
#define STMT_187_INFO {"STMT_SELECT_MOVED_HERE_CHILDREN", NULL}
#define STMT_187 \
  "SELECT moved_to, local_relpath FROM nodes " \
  "WHERE wc_id = ?1 AND op_depth > 0 " \
  "  AND (((moved_to) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((moved_to) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  ""

#define STMT_SELECT_MOVED_FOR_DELETE 188
#define STMT_188_INFO {"STMT_SELECT_MOVED_FOR_DELETE", NULL}
#define STMT_188 \
  "SELECT local_relpath, moved_to, op_depth, " \
  "       (SELECT CASE WHEN r.moved_here THEN r.op_depth END FROM nodes r " \
  "        WHERE r.wc_id = ?1 " \
  "          AND r.local_relpath = n.local_relpath " \
  "          AND r.op_depth < n.op_depth " \
  "        ORDER BY r.op_depth DESC LIMIT 1) AS moved_here_op_depth " \
  " FROM nodes n " \
  "WHERE wc_id = ?1 " \
  "  AND (local_relpath = ?2 OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \
  "  AND moved_to IS NOT NULL " \
  "  AND op_depth >= ?3 " \
  ""

#define STMT_SELECT_MOVED_FROM_FOR_DELETE 189
#define STMT_189_INFO {"STMT_SELECT_MOVED_FROM_FOR_DELETE", NULL}
#define STMT_189 \
  "SELECT local_relpath, op_depth, " \
  "       (SELECT CASE WHEN r.moved_here THEN r.op_depth END FROM nodes r " \
  "        WHERE r.wc_id = ?1 " \
  "          AND r.local_relpath = n.local_relpath " \
  "          AND r.op_depth < n.op_depth " \
  "        ORDER BY r.op_depth DESC LIMIT 1) AS moved_here_op_depth " \
  " FROM nodes n " \
  "WHERE wc_id = ?1 AND moved_to = ?2 AND op_depth > 0 " \
  ""

#define STMT_UPDATE_MOVED_TO_DESCENDANTS 190
#define STMT_190_INFO {"STMT_UPDATE_MOVED_TO_DESCENDANTS", NULL}
#define STMT_190 \
  "UPDATE nodes SET moved_to = (CASE WHEN (?2) = '' THEN (CASE WHEN (?3) = '' THEN (moved_to) WHEN (moved_to) = '' THEN (?3) ELSE (?3) || '/' || (moved_to) END) WHEN (?3) = '' THEN (CASE WHEN (?2) = '' THEN (moved_to)  WHEN SUBSTR((moved_to), 1, LENGTH(?2)) = (?2)  THEN CASE WHEN LENGTH(?2) = LENGTH(moved_to) THEN '' WHEN SUBSTR((moved_to), LENGTH(?2)+1, 1) = '/' THEN SUBSTR((moved_to), LENGTH(?2)+2) END END) WHEN SUBSTR((moved_to), 1, LENGTH(?2)) = (?2) THEN CASE WHEN LENGTH(?2) = LENGTH(moved_to) THEN (?3) WHEN SUBSTR((moved_to), LENGTH(?2)+1, 1) = '/' THEN (?3) || SUBSTR((moved_to), LENGTH(?2)+1) END END) " \
  " WHERE wc_id = ?1 " \
  "   AND (((moved_to) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((moved_to) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  ""

#define STMT_CLEAR_MOVED_TO_DESCENDANTS 191
#define STMT_191_INFO {"STMT_CLEAR_MOVED_TO_DESCENDANTS", NULL}
#define STMT_191 \
  "UPDATE nodes SET moved_to = NULL " \
  " WHERE wc_id = ?1 " \
  "   AND (((moved_to) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((moved_to) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  ""

#define STMT_SELECT_MOVED_PAIR3 192
#define STMT_192_INFO {"STMT_SELECT_MOVED_PAIR3", NULL}
#define STMT_192 \
  "SELECT n.local_relpath, d.moved_to, d.op_depth, n.kind " \
  "FROM nodes n " \
  "JOIN nodes d ON d.wc_id = ?1 AND d.local_relpath = n.local_relpath " \
  " AND d.op_depth = (SELECT MIN(dd.op_depth) " \
  "                    FROM nodes dd " \
  "                    WHERE dd.wc_id = ?1 " \
  "                      AND dd.local_relpath = d.local_relpath " \
  "                      AND dd.op_depth > ?3) " \
  "WHERE n.wc_id = ?1 AND n.local_relpath = ?2 AND n.op_depth = ?3 " \
  "  AND d.moved_to IS NOT NULL " \
  "UNION ALL " \
  "SELECT n.local_relpath, d.moved_to, d.op_depth, n.kind " \
  "FROM nodes n " \
  "JOIN nodes d ON d.wc_id = ?1 AND d.local_relpath = n.local_relpath " \
  " AND d.op_depth = (SELECT MIN(dd.op_depth) " \
  "                    FROM nodes dd " \
  "                    WHERE dd.wc_id = ?1 " \
  "                      AND dd.local_relpath = d.local_relpath " \
  "                      AND dd.op_depth > ?3) " \
  "WHERE n.wc_id = ?1 AND (((n.local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((n.local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  "  AND n.op_depth = ?3 " \
  "  AND d.moved_to IS NOT NULL " \
  "ORDER BY n.local_relpath " \
  ""

#define STMT_SELECT_MOVED_OUTSIDE 193
#define STMT_193_INFO {"STMT_SELECT_MOVED_OUTSIDE", NULL}
#define STMT_193 \
  "SELECT local_relpath, moved_to, op_depth FROM nodes " \
  "WHERE wc_id = ?1 " \
  "  AND (local_relpath = ?2 OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \
  "  AND op_depth >= ?3 " \
  "  AND moved_to IS NOT NULL " \
  "  AND NOT (((moved_to) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((moved_to) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  ""

#define STMT_SELECT_MOVED_DESCENDANTS_SRC 194
#define STMT_194_INFO {"STMT_SELECT_MOVED_DESCENDANTS_SRC", NULL}
#define STMT_194 \
  "SELECT s.op_depth, n.local_relpath, n.kind, n.repos_path, s.moved_to " \
  "FROM nodes n " \
  "JOIN nodes s ON s.wc_id = n.wc_id AND s.local_relpath = n.local_relpath " \
  " AND s.op_depth = (SELECT MIN(d.op_depth) " \
  "                    FROM nodes d " \
  "                    WHERE d.wc_id = ?1 " \
  "                      AND d.local_relpath = s.local_relpath " \
  "                      AND d.op_depth > ?3) " \
  "WHERE n.wc_id = ?1 AND n.op_depth = ?3 " \
  "  AND (n.local_relpath = ?2 OR (((n.local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((n.local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \
  "  AND s.moved_to IS NOT NULL " \
  ""

#define STMT_COMMIT_UPDATE_ORIGIN 195
#define STMT_195_INFO {"STMT_COMMIT_UPDATE_ORIGIN", NULL}
#define STMT_195 \
  "UPDATE nodes SET repos_id = ?4, " \
  "                 repos_path = (CASE WHEN (?2) = '' THEN (CASE WHEN (?5) = '' THEN (local_relpath) WHEN (local_relpath) = '' THEN (?5) ELSE (?5) || '/' || (local_relpath) END) WHEN (?5) = '' THEN (CASE WHEN (?2) = '' THEN (local_relpath)  WHEN SUBSTR((local_relpath), 1, LENGTH(?2)) = (?2)  THEN CASE WHEN LENGTH(?2) = LENGTH(local_relpath) THEN '' WHEN SUBSTR((local_relpath), LENGTH(?2)+1, 1) = '/' THEN SUBSTR((local_relpath), LENGTH(?2)+2) END END) WHEN SUBSTR((local_relpath), 1, LENGTH(?2)) = (?2) THEN CASE WHEN LENGTH(?2) = LENGTH(local_relpath) THEN (?5) WHEN SUBSTR((local_relpath), LENGTH(?2)+1, 1) = '/' THEN (?5) || SUBSTR((local_relpath), LENGTH(?2)+1) END END), " \
  "                 revision = ?6 " \
  "WHERE wc_id = ?1 " \
  "  AND (local_relpath = ?2 " \
  "       OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \
  "  AND op_depth = ?3 " \
  ""

#define STMT_HAS_LAYER_BETWEEN 196
#define STMT_196_INFO {"STMT_HAS_LAYER_BETWEEN", NULL}
#define STMT_196 \
  "SELECT 1 FROM NODES " \
  "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > ?3 AND op_depth < ?4 " \
  ""

#define STMT_SELECT_REPOS_PATH_REVISION 197
#define STMT_197_INFO {"STMT_SELECT_REPOS_PATH_REVISION", NULL}
#define STMT_197 \
  "SELECT local_relpath, repos_path, revision FROM nodes " \
  "WHERE wc_id = ?1 " \
  "  AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  "  AND op_depth = 0 " \
  "ORDER BY local_relpath " \
  ""

#define STMT_SELECT_HAS_NON_FILE_CHILDREN 198
#define STMT_198_INFO {"STMT_SELECT_HAS_NON_FILE_CHILDREN", NULL}
#define STMT_198 \
  "SELECT 1 FROM nodes " \
  "WHERE wc_id = ?1 AND parent_relpath = ?2 AND op_depth = ?3 AND kind != 'file' " \
  "LIMIT 1 " \
  ""

#define STMT_SELECT_HAS_GRANDCHILDREN 199
#define STMT_199_INFO {"STMT_SELECT_HAS_GRANDCHILDREN", NULL}
#define STMT_199 \
  "SELECT 1 FROM nodes " \
  "WHERE wc_id = ?1 " \
  "  AND (((parent_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((parent_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  "  AND op_depth = ?3 " \
  "  AND file_external IS NULL " \
  "LIMIT 1 " \
  ""

#define STMT_SELECT_ALL_NODES 200
#define STMT_200_INFO {"STMT_SELECT_ALL_NODES", NULL}
#define STMT_200 \
  "SELECT op_depth, local_relpath, parent_relpath, file_external FROM nodes " \
  "WHERE wc_id = ?1 " \
  ""

#define STMT_SELECT_IPROPS 201
#define STMT_201_INFO {"STMT_SELECT_IPROPS", NULL}
#define STMT_201 \
  "SELECT inherited_props FROM nodes " \
  "WHERE wc_id = ?1 " \
  "  AND local_relpath = ?2 " \
  "  AND op_depth = 0 " \
  ""

#define STMT_UPDATE_IPROP 202
#define STMT_202_INFO {"STMT_UPDATE_IPROP", NULL}
#define STMT_202 \
  "UPDATE nodes " \
  "SET inherited_props = ?3 " \
  "WHERE (wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0) " \
  ""

#define STMT_SELECT_IPROPS_NODE 203
#define STMT_203_INFO {"STMT_SELECT_IPROPS_NODE", NULL}
#define STMT_203 \
  "SELECT local_relpath, repos_path FROM nodes " \
  "WHERE wc_id = ?1 " \
  "  AND local_relpath = ?2 " \
  "  AND op_depth = 0 " \
  "  AND (inherited_props not null) " \
  ""

#define STMT_SELECT_IPROPS_RECURSIVE 204
#define STMT_204_INFO {"STMT_SELECT_IPROPS_RECURSIVE", NULL}
#define STMT_204 \
  "SELECT local_relpath, repos_path FROM nodes " \
  "WHERE wc_id = ?1 " \
  "  AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \
  "  AND op_depth = 0 " \
  "  AND (inherited_props not null) " \
  ""

#define STMT_SELECT_IPROPS_CHILDREN 205
#define STMT_205_INFO {"STMT_SELECT_IPROPS_CHILDREN", NULL}
#define STMT_205 \
  "SELECT local_relpath, repos_path FROM nodes " \
  "WHERE wc_id = ?1 " \
  "  AND parent_relpath = ?2 " \
  "  AND op_depth = 0 " \
  "  AND (inherited_props not null) " \
  ""

#define STMT_HAVE_STAT1_TABLE 206
#define STMT_206_INFO {"STMT_HAVE_STAT1_TABLE", NULL}
#define STMT_206 \
  "SELECT 1 FROM sqlite_master WHERE name='sqlite_stat1' AND type='table' " \
  "LIMIT 1 " \
  ""

#define STMT_CREATE_SCHEMA 207
#define STMT_207_INFO {"STMT_CREATE_SCHEMA", NULL}
#define STMT_207 \
  "CREATE TABLE REPOSITORY ( " \
  "  id INTEGER PRIMARY KEY AUTOINCREMENT, " \
  "  root  TEXT UNIQUE NOT NULL, " \
  "  uuid  TEXT NOT NULL " \
  "  ); " \
  "CREATE INDEX I_UUID ON REPOSITORY (uuid); " \
  "CREATE INDEX I_ROOT ON REPOSITORY (root); " \
  "CREATE TABLE WCROOT ( " \
  "  id  INTEGER PRIMARY KEY AUTOINCREMENT, " \
  "  local_abspath  TEXT UNIQUE " \
  "  ); " \
  "CREATE UNIQUE INDEX I_LOCAL_ABSPATH ON WCROOT (local_abspath); " \
  "CREATE TABLE PRISTINE ( " \
  "  checksum  TEXT NOT NULL PRIMARY KEY, " \
  "  compression  INTEGER, " \
  "  size  INTEGER NOT NULL, " \
  "  refcount  INTEGER NOT NULL, " \
  "  md5_checksum  TEXT NOT NULL " \
  "  ); " \
  "CREATE INDEX I_PRISTINE_MD5 ON PRISTINE (md5_checksum); " \
  "CREATE TABLE ACTUAL_NODE ( " \
  "  wc_id  INTEGER NOT NULL REFERENCES WCROOT (id), " \
  "  local_relpath  TEXT NOT NULL, " \
  "  parent_relpath  TEXT, " \
  "  properties  BLOB, " \
  "  conflict_old  TEXT, " \
  "  conflict_new  TEXT, " \
  "  conflict_working  TEXT, " \
  "  prop_reject  TEXT, " \
  "  changelist  TEXT, " \
  "  text_mod  TEXT, " \
  "  tree_conflict_data  TEXT, " \
  "  conflict_data  BLOB, " \
  "  older_checksum  TEXT REFERENCES PRISTINE (checksum), " \
  "  left_checksum  TEXT REFERENCES PRISTINE (checksum), " \
  "  right_checksum  TEXT REFERENCES PRISTINE (checksum), " \
  "  PRIMARY KEY (wc_id, local_relpath) " \
  "  ); " \
  "CREATE UNIQUE INDEX I_ACTUAL_PARENT ON ACTUAL_NODE (wc_id, parent_relpath, " \
  "                                                    local_relpath); " \
  "CREATE TABLE LOCK ( " \
  "  repos_id  INTEGER NOT NULL REFERENCES REPOSITORY (id), " \
  "  repos_relpath  TEXT NOT NULL, " \
  "  lock_token  TEXT NOT NULL, " \
  "  lock_owner  TEXT, " \
  "  lock_comment  TEXT, " \
  "  lock_date  INTEGER, " \
  "  PRIMARY KEY (repos_id, repos_relpath) " \
  "  ); " \
  "CREATE TABLE WORK_QUEUE ( " \
  "  id  INTEGER PRIMARY KEY AUTOINCREMENT, " \
  "  work  BLOB NOT NULL " \
  "  ); " \
  "CREATE TABLE WC_LOCK ( " \
  "  wc_id  INTEGER NOT NULL  REFERENCES WCROOT (id), " \
  "  local_dir_relpath  TEXT NOT NULL, " \
  "  locked_levels  INTEGER NOT NULL DEFAULT -1, " \
  "  PRIMARY KEY (wc_id, local_dir_relpath) " \
  " ); " \
  "PRAGMA user_version = " \
  APR_STRINGIFY(SVN_WC__VERSION) \
  "; " \
  ""

#define STMT_CREATE_NODES 208
#define STMT_208_INFO {"STMT_CREATE_NODES", NULL}
#define STMT_208 \
  "CREATE TABLE NODES ( " \
  "  wc_id  INTEGER NOT NULL REFERENCES WCROOT (id), " \
  "  local_relpath  TEXT NOT NULL, " \
  "  op_depth INTEGER NOT NULL, " \
  "  parent_relpath  TEXT, " \
  "  repos_id  INTEGER REFERENCES REPOSITORY (id), " \
  "  repos_path  TEXT, " \
  "  revision  INTEGER, " \
  "  presence  TEXT NOT NULL, " \
  "  moved_here  INTEGER, " \
  "  moved_to  TEXT, " \
  "  kind  TEXT NOT NULL, " \
  "  properties  BLOB, " \
  "  depth  TEXT, " \
  "  checksum  TEXT REFERENCES PRISTINE (checksum), " \
  "  symlink_target  TEXT, " \
  "  changed_revision  INTEGER, " \
  "  changed_date      INTEGER, " \
  "  changed_author    TEXT, " \
  "  translated_size  INTEGER, " \
  "  last_mod_time  INTEGER, " \
  "  dav_cache  BLOB, " \
  "  file_external  INTEGER, " \
  "  inherited_props  BLOB, " \
  "  PRIMARY KEY (wc_id, local_relpath, op_depth) " \
  "  ); " \
  "CREATE UNIQUE INDEX I_NODES_PARENT ON NODES (wc_id, parent_relpath, " \
  "                                             local_relpath, op_depth); " \
  "CREATE UNIQUE INDEX I_NODES_MOVED ON NODES (wc_id, moved_to, op_depth); " \
  "CREATE VIEW NODES_CURRENT AS " \
  "  SELECT * FROM nodes AS n " \
  "    WHERE op_depth = (SELECT MAX(op_depth) FROM nodes AS n2 " \
  "                      WHERE n2.wc_id = n.wc_id " \
  "                        AND n2.local_relpath = n.local_relpath); " \
  "CREATE VIEW NODES_BASE AS " \
  "  SELECT * FROM nodes " \
  "  WHERE op_depth = 0; " \
  ""

#define STMT_CREATE_NODES_TRIGGERS 209
#define STMT_209_INFO {"STMT_CREATE_NODES_TRIGGERS", NULL}
#define STMT_209 \
  "CREATE TRIGGER nodes_insert_trigger " \
  "AFTER INSERT ON nodes " \
  "WHEN NEW.checksum IS NOT NULL " \
  "BEGIN " \
  "  UPDATE pristine SET refcount = refcount + 1 " \
  "  WHERE checksum = NEW.checksum; " \
  "END; " \
  "CREATE TRIGGER nodes_delete_trigger " \
  "AFTER DELETE ON nodes " \
  "WHEN OLD.checksum IS NOT NULL " \
  "BEGIN " \
  "  UPDATE pristine SET refcount = refcount - 1 " \
  "  WHERE checksum = OLD.checksum; " \
  "END; " \
  "CREATE TRIGGER nodes_update_checksum_trigger " \
  "AFTER UPDATE OF checksum ON nodes " \
  "WHEN NEW.checksum IS NOT OLD.checksum " \
  "BEGIN " \
  "  UPDATE pristine SET refcount = refcount + 1 " \
  "  WHERE checksum = NEW.checksum; " \
  "  UPDATE pristine SET refcount = refcount - 1 " \
  "  WHERE checksum = OLD.checksum; " \
  "END; " \
  ""

#define STMT_CREATE_EXTERNALS 210
#define STMT_210_INFO {"STMT_CREATE_EXTERNALS", NULL}
#define STMT_210 \
  "CREATE TABLE EXTERNALS ( " \
  "  wc_id  INTEGER NOT NULL REFERENCES WCROOT (id), " \
  "  local_relpath  TEXT NOT NULL, " \
  "  parent_relpath  TEXT NOT NULL, " \
  "  repos_id  INTEGER NOT NULL REFERENCES REPOSITORY (id), " \
  "  presence  TEXT NOT NULL, " \
  "  kind  TEXT NOT NULL, " \
  "  def_local_relpath         TEXT NOT NULL, " \
  "  def_repos_relpath         TEXT NOT NULL, " \
  "  def_operational_revision  TEXT, " \
  "  def_revision              TEXT, " \
  "  PRIMARY KEY (wc_id, local_relpath) " \
  "); " \
  "CREATE UNIQUE INDEX I_EXTERNALS_DEFINED ON EXTERNALS (wc_id, " \
  "                                                      def_local_relpath, " \
  "                                                      local_relpath); " \
  ""

#define STMT_INSTALL_SCHEMA_STATISTICS 211
#define STMT_211_INFO {"STMT_INSTALL_SCHEMA_STATISTICS", NULL}
#define STMT_211 \
  "ANALYZE sqlite_master; " \
  "DELETE FROM sqlite_stat1 " \
  "WHERE tbl in ('NODES', 'ACTUAL_NODE', 'LOCK', 'WC_LOCK', 'EXTERNALS'); " \
  "INSERT INTO sqlite_stat1(tbl, idx, stat) VALUES " \
  "    ('NODES', 'sqlite_autoindex_NODES_1',               '8000 8000 2 1'); " \
  "INSERT INTO sqlite_stat1(tbl, idx, stat) VALUES " \
  "    ('NODES', 'I_NODES_PARENT',                         '8000 8000 10 2 1'); " \
  "INSERT INTO sqlite_stat1(tbl, idx, stat) VALUES " \
  "    ('NODES', 'I_NODES_MOVED',                          '8000 8000 1 1'); " \
  "INSERT INTO sqlite_stat1(tbl, idx, stat) VALUES " \
  "    ('ACTUAL_NODE', 'sqlite_autoindex_ACTUAL_NODE_1',   '8000 8000 1'); " \
  "INSERT INTO sqlite_stat1(tbl, idx, stat) VALUES " \
  "    ('ACTUAL_NODE', 'I_ACTUAL_PARENT',                  '8000 8000 10 1'); " \
  "INSERT INTO sqlite_stat1(tbl, idx, stat) VALUES " \
  "    ('LOCK', 'sqlite_autoindex_LOCK_1',                 '100 100 1'); " \
  "INSERT INTO sqlite_stat1(tbl, idx, stat) VALUES " \
  "    ('WC_LOCK', 'sqlite_autoindex_WC_LOCK_1',           '100 100 1'); " \
  "INSERT INTO sqlite_stat1(tbl, idx, stat) VALUES " \
  "    ('EXTERNALS','sqlite_autoindex_EXTERNALS_1',        '100 100 1'); " \
  "INSERT INTO sqlite_stat1(tbl, idx, stat) VALUES " \
  "    ('EXTERNALS','I_EXTERNALS_DEFINED',                 '100 100 3 1'); " \
  "ANALYZE sqlite_master; " \
  ""

#define STMT_UPGRADE_TO_20 212
#define STMT_212_INFO {"STMT_UPGRADE_TO_20", NULL}
#define STMT_212 \
  "UPDATE BASE_NODE SET checksum = (SELECT checksum FROM pristine " \
  "                                 WHERE md5_checksum = BASE_NODE.checksum) " \
  "WHERE EXISTS (SELECT 1 FROM pristine WHERE md5_checksum = BASE_NODE.checksum); " \
  "UPDATE WORKING_NODE SET checksum = (SELECT checksum FROM pristine " \
  "                                    WHERE md5_checksum = WORKING_NODE.checksum) " \
  "WHERE EXISTS (SELECT 1 FROM pristine " \
  "              WHERE md5_checksum = WORKING_NODE.checksum); " \
  "INSERT INTO NODES ( " \
  "       wc_id, local_relpath, op_depth, parent_relpath, " \
  "       repos_id, repos_path, revision, " \
  "       presence, depth, moved_here, moved_to, kind, " \
  "       changed_revision, changed_date, changed_author, " \
  "       checksum, properties, translated_size, last_mod_time, " \
  "       dav_cache, symlink_target, file_external ) " \
  "SELECT wc_id, local_relpath, 0 , parent_relpath, " \
  "       repos_id, repos_relpath, revnum, " \
  "       presence, depth, NULL , NULL , kind, " \
  "       changed_rev, changed_date, changed_author, " \
  "       checksum, properties, translated_size, last_mod_time, " \
  "       dav_cache, symlink_target, file_external " \
  "FROM BASE_NODE; " \
  "INSERT INTO NODES ( " \
  "       wc_id, local_relpath, op_depth, parent_relpath, " \
  "       repos_id, repos_path, revision, " \
  "       presence, depth, moved_here, moved_to, kind, " \
  "       changed_revision, changed_date, changed_author, " \
  "       checksum, properties, translated_size, last_mod_time, " \
  "       dav_cache, symlink_target, file_external ) " \
  "SELECT wc_id, local_relpath, 2 , parent_relpath, " \
  "       copyfrom_repos_id, copyfrom_repos_path, copyfrom_revnum, " \
  "       presence, depth, NULL , NULL , kind, " \
  "       changed_rev, changed_date, changed_author, " \
  "       checksum, properties, translated_size, last_mod_time, " \
  "       NULL , symlink_target, NULL " \
  "FROM WORKING_NODE; " \
  "DROP TABLE BASE_NODE; " \
  "DROP TABLE WORKING_NODE; " \
  "PRAGMA user_version = 20; " \
  ""

#define STMT_UPGRADE_TO_21 213
#define STMT_213_INFO {"STMT_UPGRADE_TO_21", NULL}
#define STMT_213 \
  "PRAGMA user_version = 21; " \
  ""

#define STMT_UPGRADE_21_SELECT_OLD_TREE_CONFLICT 214
#define STMT_214_INFO {"STMT_UPGRADE_21_SELECT_OLD_TREE_CONFLICT", NULL}
#define STMT_214 \
  "SELECT wc_id, local_relpath, tree_conflict_data " \
  "FROM actual_node " \
  "WHERE tree_conflict_data IS NOT NULL " \
  ""

#define STMT_UPGRADE_21_ERASE_OLD_CONFLICTS 215
#define STMT_215_INFO {"STMT_UPGRADE_21_ERASE_OLD_CONFLICTS", NULL}
#define STMT_215 \
  "UPDATE actual_node SET tree_conflict_data = NULL " \
  ""

#define STMT_UPGRADE_TO_22 216
#define STMT_216_INFO {"STMT_UPGRADE_TO_22", NULL}
#define STMT_216 \
  "UPDATE actual_node SET tree_conflict_data = conflict_data; " \
  "UPDATE actual_node SET conflict_data = NULL; " \
  "PRAGMA user_version = 22; " \
  ""

#define STMT_UPGRADE_TO_23 217
#define STMT_217_INFO {"STMT_UPGRADE_TO_23", NULL}
#define STMT_217 \
  "PRAGMA user_version = 23; " \
  ""

#define STMT_UPGRADE_23_HAS_WORKING_NODES 218
#define STMT_218_INFO {"STMT_UPGRADE_23_HAS_WORKING_NODES", NULL}
#define STMT_218 \
  "SELECT 1 FROM nodes WHERE op_depth > 0 " \
  "LIMIT 1 " \
  ""

#define STMT_UPGRADE_TO_24 219
#define STMT_219_INFO {"STMT_UPGRADE_TO_24", NULL}
#define STMT_219 \
  "UPDATE pristine SET refcount = " \
  "  (SELECT COUNT(*) FROM nodes " \
  "   WHERE checksum = pristine.checksum ); " \
  "PRAGMA user_version = 24; " \
  ""

#define STMT_UPGRADE_TO_25 220
#define STMT_220_INFO {"STMT_UPGRADE_TO_25", NULL}
#define STMT_220 \
  "DROP VIEW IF EXISTS NODES_CURRENT; " \
  "CREATE VIEW NODES_CURRENT AS " \
  "  SELECT * FROM nodes " \
  "    JOIN (SELECT wc_id, local_relpath, MAX(op_depth) AS op_depth FROM nodes " \
  "          GROUP BY wc_id, local_relpath) AS filter " \
  "    ON nodes.wc_id = filter.wc_id " \
  "      AND nodes.local_relpath = filter.local_relpath " \
  "      AND nodes.op_depth = filter.op_depth; " \
  "PRAGMA user_version = 25; " \
  ""

#define STMT_UPGRADE_TO_26 221
#define STMT_221_INFO {"STMT_UPGRADE_TO_26", NULL}
#define STMT_221 \
  "DROP VIEW IF EXISTS NODES_BASE; " \
  "CREATE VIEW NODES_BASE AS " \
  "  SELECT * FROM nodes " \
  "  WHERE op_depth = 0; " \
  "PRAGMA user_version = 26; " \
  ""

#define STMT_UPGRADE_TO_27 222
#define STMT_222_INFO {"STMT_UPGRADE_TO_27", NULL}
#define STMT_222 \
  "PRAGMA user_version = 27; " \
  ""

#define STMT_UPGRADE_27_HAS_ACTUAL_NODES_CONFLICTS 223
#define STMT_223_INFO {"STMT_UPGRADE_27_HAS_ACTUAL_NODES_CONFLICTS", NULL}
#define STMT_223 \
  "SELECT 1 FROM actual_node " \
  "WHERE NOT ((prop_reject IS NULL) AND (conflict_old IS NULL) " \
  "           AND (conflict_new IS NULL) AND (conflict_working IS NULL) " \
  "           AND (tree_conflict_data IS NULL)) " \
  "LIMIT 1 " \
  ""

#define STMT_UPGRADE_TO_28 224
#define STMT_224_INFO {"STMT_UPGRADE_TO_28", NULL}
#define STMT_224 \
  "UPDATE NODES SET checksum = (SELECT checksum FROM pristine " \
  "                             WHERE md5_checksum = nodes.checksum) " \
  "WHERE EXISTS (SELECT 1 FROM pristine WHERE md5_checksum = nodes.checksum); " \
  "PRAGMA user_version = 28; " \
  ""

#define STMT_UPGRADE_TO_29 225
#define STMT_225_INFO {"STMT_UPGRADE_TO_29", NULL}
#define STMT_225 \
  "DROP TRIGGER IF EXISTS nodes_update_checksum_trigger; " \
  "DROP TRIGGER IF EXISTS nodes_insert_trigger; " \
  "DROP TRIGGER IF EXISTS nodes_delete_trigger; " \
  "CREATE TRIGGER nodes_update_checksum_trigger " \
  "AFTER UPDATE OF checksum ON nodes " \
  "WHEN NEW.checksum IS NOT OLD.checksum " \
  "BEGIN " \
  "  UPDATE pristine SET refcount = refcount + 1 " \
  "  WHERE checksum = NEW.checksum; " \
  "  UPDATE pristine SET refcount = refcount - 1 " \
  "  WHERE checksum = OLD.checksum; " \
  "END; " \
  "CREATE TRIGGER nodes_insert_trigger " \
  "AFTER INSERT ON nodes " \
  "WHEN NEW.checksum IS NOT NULL " \
  "BEGIN " \
  "  UPDATE pristine SET refcount = refcount + 1 " \
  "  WHERE checksum = NEW.checksum; " \
  "END; " \
  "CREATE TRIGGER nodes_delete_trigger " \
  "AFTER DELETE ON nodes " \
  "WHEN OLD.checksum IS NOT NULL " \
  "BEGIN " \
  "  UPDATE pristine SET refcount = refcount - 1 " \
  "  WHERE checksum = OLD.checksum; " \
  "END; " \
  "PRAGMA user_version = 29; " \
  ""

#define STMT_UPGRADE_TO_30 226
#define STMT_226_INFO {"STMT_UPGRADE_TO_30", NULL}
#define STMT_226 \
  "CREATE UNIQUE INDEX IF NOT EXISTS I_NODES_MOVED " \
  "ON NODES (wc_id, moved_to, op_depth); " \
  "CREATE INDEX IF NOT EXISTS I_PRISTINE_MD5 ON PRISTINE (md5_checksum); " \
  "UPDATE nodes SET presence = \"server-excluded\" WHERE presence = \"absent\"; " \
  "UPDATE nodes SET file_external=1 WHERE file_external IS NOT NULL; " \
  ""

#define STMT_UPGRADE_30_SELECT_CONFLICT_SEPARATE 227
#define STMT_227_INFO {"STMT_UPGRADE_30_SELECT_CONFLICT_SEPARATE", NULL}
#define STMT_227 \
  "SELECT wc_id, local_relpath, " \
  "  conflict_old, conflict_working, conflict_new, prop_reject, tree_conflict_data " \
  "FROM actual_node " \
  "WHERE conflict_old IS NOT NULL " \
  "   OR conflict_working IS NOT NULL " \
  "   OR conflict_new IS NOT NULL " \
  "   OR prop_reject IS NOT NULL " \
  "   OR tree_conflict_data IS NOT NULL " \
  "ORDER by wc_id, local_relpath " \
  ""

#define STMT_UPGRADE_30_SET_CONFLICT 228
#define STMT_228_INFO {"STMT_UPGRADE_30_SET_CONFLICT", NULL}
#define STMT_228 \
  "UPDATE actual_node SET conflict_data = ?3, conflict_old = NULL, " \
  "  conflict_working = NULL, conflict_new = NULL, prop_reject = NULL, " \
  "  tree_conflict_data = NULL " \
  "WHERE wc_id = ?1 and local_relpath = ?2 " \
  ""

#define STMT_UPGRADE_TO_31_ALTER_TABLE 229
#define STMT_229_INFO {"STMT_UPGRADE_TO_31_ALTER_TABLE", NULL}
#define STMT_229 \
  "ALTER TABLE NODES ADD COLUMN inherited_props BLOB; " \
  ""

#define STMT_UPGRADE_TO_31_FINALIZE 230
#define STMT_230_INFO {"STMT_UPGRADE_TO_31_FINALIZE", NULL}
#define STMT_230 \
  "DROP INDEX IF EXISTS I_ACTUAL_CHANGELIST; " \
  "DROP INDEX IF EXISTS I_EXTERNALS_PARENT; " \
  "DROP INDEX I_NODES_PARENT; " \
  "CREATE UNIQUE INDEX I_NODES_PARENT ON NODES (wc_id, parent_relpath, " \
  "                                             local_relpath, op_depth); " \
  "DROP INDEX I_ACTUAL_PARENT; " \
  "CREATE UNIQUE INDEX I_ACTUAL_PARENT ON ACTUAL_NODE (wc_id, parent_relpath, " \
  "                                                    local_relpath); " \
  "PRAGMA user_version = 31; " \
  ""

#define STMT_UPGRADE_31_SELECT_WCROOT_NODES 231
#define STMT_231_INFO {"STMT_UPGRADE_31_SELECT_WCROOT_NODES", NULL}
#define STMT_231 \
  "SELECT l.wc_id, l.local_relpath FROM nodes as l " \
  "LEFT OUTER JOIN nodes as r " \
  "ON l.wc_id = r.wc_id " \
  "   AND r.local_relpath = l.parent_relpath " \
  "   AND r.op_depth = 0 " \
  "WHERE l.op_depth = 0 " \
  "  AND l.repos_path != '' " \
  "  AND ((l.repos_id IS NOT r.repos_id) " \
  "       OR (l.repos_path IS NOT (CASE WHEN (r.local_relpath) = '' THEN (CASE WHEN (r.repos_path) = '' THEN (l.local_relpath) WHEN (l.local_relpath) = '' THEN (r.repos_path) ELSE (r.repos_path) || '/' || (l.local_relpath) END) WHEN (r.repos_path) = '' THEN (CASE WHEN (r.local_relpath) = '' THEN (l.local_relpath)  WHEN SUBSTR((l.local_relpath), 1, LENGTH(r.local_relpath)) = (r.local_relpath)  THEN CASE WHEN LENGTH(r.local_relpath) = LENGTH(l.local_relpath) THEN '' WHEN SUBSTR((l.local_relpath), LENGTH(r.local_relpath)+1, 1) = '/' THEN SUBSTR((l.local_relpath), LENGTH(r.local_relpath)+2) END END) WHEN SUBSTR((l.local_relpath), 1, LENGTH(r.local_relpath)) = (r.local_relpath) THEN CASE WHEN LENGTH(r.local_relpath) = LENGTH(l.local_relpath) THEN (r.repos_path) WHEN SUBSTR((l.local_relpath), LENGTH(r.local_relpath)+1, 1) = '/' THEN (r.repos_path) || SUBSTR((l.local_relpath), LENGTH(r.local_relpath)+1) END END))) " \
  ""

#define STMT_UPGRADE_TO_32 232
#define STMT_232_INFO {"STMT_UPGRADE_TO_32", NULL}
#define STMT_232 \
  "DROP INDEX IF EXISTS I_ACTUAL_CHANGELIST; " \
  "DROP INDEX IF EXISTS I_EXTERNALS_PARENT; " \
  "CREATE INDEX I_EXTERNALS_PARENT ON EXTERNALS (wc_id, parent_relpath); " \
  "DROP INDEX I_NODES_PARENT; " \
  "CREATE UNIQUE INDEX I_NODES_PARENT ON NODES (wc_id, parent_relpath, " \
  "                                             local_relpath, op_depth); " \
  "DROP INDEX I_ACTUAL_PARENT; " \
  "CREATE UNIQUE INDEX I_ACTUAL_PARENT ON ACTUAL_NODE (wc_id, parent_relpath, " \
  "                                                    local_relpath); " \
  "-- format: YYY " \
  ""

#define WC_QUERIES_SQL_99 \
  "CREATE TABLE ACTUAL_NODE_BACKUP ( " \
  "  wc_id  INTEGER NOT NULL, " \
  "  local_relpath  TEXT NOT NULL, " \
  "  parent_relpath  TEXT, " \
  "  properties  BLOB, " \
  "  conflict_old  TEXT, " \
  "  conflict_new  TEXT, " \
  "  conflict_working  TEXT, " \
  "  prop_reject  TEXT, " \
  "  changelist  TEXT, " \
  "  text_mod  TEXT " \
  "  ); " \
  "INSERT INTO ACTUAL_NODE_BACKUP SELECT " \
  "  wc_id, local_relpath, parent_relpath, properties, conflict_old, " \
  "  conflict_new, conflict_working, prop_reject, changelist, text_mod " \
  "FROM ACTUAL_NODE; " \
  "DROP TABLE ACTUAL_NODE; " \
  "CREATE TABLE ACTUAL_NODE ( " \
  "  wc_id  INTEGER NOT NULL REFERENCES WCROOT (id), " \
  "  local_relpath  TEXT NOT NULL, " \
  "  parent_relpath  TEXT, " \
  "  properties  BLOB, " \
  "  conflict_old  TEXT, " \
  "  conflict_new  TEXT, " \
  "  conflict_working  TEXT, " \
  "  prop_reject  TEXT, " \
  "  changelist  TEXT, " \
  "  text_mod  TEXT, " \
  "  PRIMARY KEY (wc_id, local_relpath) " \
  "  ); " \
  "CREATE UNIQUE INDEX I_ACTUAL_PARENT ON ACTUAL_NODE (wc_id, parent_relpath, " \
  "                                                    local_relpath); " \
  "INSERT INTO ACTUAL_NODE SELECT " \
  "  wc_id, local_relpath, parent_relpath, properties, conflict_old, " \
  "  conflict_new, conflict_working, prop_reject, changelist, text_mod " \
  "FROM ACTUAL_NODE_BACKUP; " \
  "DROP TABLE ACTUAL_NODE_BACKUP; " \
  ""

#define STMT_VERIFICATION_TRIGGERS 233
#define STMT_233_INFO {"STMT_VERIFICATION_TRIGGERS", NULL}
#define STMT_233 \
  "CREATE TEMPORARY TRIGGER no_repository_updates BEFORE UPDATE ON repository " \
  "BEGIN " \
  "  SELECT RAISE(FAIL, 'Updates to REPOSITORY are not allowed.'); " \
  "END; " \
  "CREATE TEMPORARY TRIGGER validation_01 BEFORE INSERT ON nodes " \
  "WHEN NOT ((new.local_relpath = '' AND new.parent_relpath IS NULL) " \
  "          OR (relpath_depth(new.local_relpath) " \
  "              = relpath_depth(new.parent_relpath) + 1)) " \
  "BEGIN " \
  "  SELECT RAISE(FAIL, 'WC DB validity check 01 failed'); " \
  "END; " \
  "CREATE TEMPORARY TRIGGER validation_02 BEFORE INSERT ON nodes " \
  "WHEN NOT new.op_depth <= relpath_depth(new.local_relpath) " \
  "BEGIN " \
  "  SELECT RAISE(FAIL, 'WC DB validity check 02 failed'); " \
  "END; " \
  "CREATE TEMPORARY TRIGGER validation_03 BEFORE INSERT ON nodes " \
  "WHEN NOT ( " \
  "    (new.op_depth = relpath_depth(new.local_relpath)) " \
  "    OR " \
  "    (EXISTS (SELECT 1 FROM nodes " \
  "              WHERE wc_id = new.wc_id AND op_depth = new.op_depth " \
  "                AND local_relpath = new.parent_relpath)) " \
  "  ) " \
  " AND NOT (new.file_external IS NOT NULL AND new.op_depth = 0) " \
  "BEGIN " \
  "  SELECT RAISE(FAIL, 'WC DB validity check 03 failed'); " \
  "END; " \
  "CREATE TEMPORARY TRIGGER validation_04 BEFORE INSERT ON actual_node " \
  "WHEN NOT (new.local_relpath = '' " \
  "          OR EXISTS (SELECT 1 FROM nodes " \
  "                       WHERE wc_id = new.wc_id " \
  "                         AND local_relpath = new.parent_relpath)) " \
  "BEGIN " \
  "  SELECT RAISE(FAIL, 'WC DB validity check 04 failed'); " \
  "END; " \
  ""

#define STMT_STATIC_VERIFY 234
#define STMT_234_INFO {"STMT_STATIC_VERIFY", NULL}
#define STMT_234 \
  "SELECT local_relpath, op_depth, 1, 'Invalid parent relpath set in NODES' " \
  "FROM nodes n WHERE local_relpath != '' " \
  " AND (parent_relpath IS NULL " \
  "      OR NOT (((local_relpath) > (CASE (parent_relpath) WHEN '' THEN '' ELSE (parent_relpath) || '/' END)) AND ((local_relpath) < CASE (parent_relpath) WHEN '' THEN X'FFFF' ELSE (parent_relpath) || '0' END)) " \
  "      OR relpath_depth(local_relpath) != relpath_depth(parent_relpath)+1) " \
  "UNION ALL " \
  "SELECT local_relpath, -1, 2, 'Invalid parent relpath set in ACTUAL' " \
  "FROM actual_node a WHERE local_relpath != '' " \
  " AND (parent_relpath IS NULL " \
  "      OR NOT (((local_relpath) > (CASE (parent_relpath) WHEN '' THEN '' ELSE (parent_relpath) || '/' END)) AND ((local_relpath) < CASE (parent_relpath) WHEN '' THEN X'FFFF' ELSE (parent_relpath) || '0' END)) " \
  "      OR relpath_depth(local_relpath) != relpath_depth(parent_relpath)+1) " \
  "UNION ALL " \
  "SELECT local_relpath, -1, 10, 'No ancestor in ACTUAL' " \
  "FROM actual_node a WHERE local_relpath != '' " \
  " AND NOT EXISTS(SELECT 1 from nodes i " \
  "                WHERE i.wc_id=a.wc_id " \
  "                  AND i.local_relpath=a.parent_relpath) " \
  " AND NOT EXISTS(SELECT 1 from nodes i " \
  "                WHERE i.wc_id=a.wc_id " \
  "                  AND i.local_relpath=a.local_relpath) " \
  "UNION ALL " \
  "SELECT a.local_relpath, -1, 11, 'Bad or Unneeded actual data' " \
  "FROM actual_node a " \
  "LEFT JOIN nodes n on n.wc_id = a.wc_id AND n.local_relpath = a.local_relpath " \
  "   AND n.op_depth = (SELECT MAX(op_depth) from nodes i " \
  "                     WHERE i.wc_id=a.wc_id AND i.local_relpath=a.local_relpath) " \
  "WHERE (a.properties IS NOT NULL " \
  "       AND (n.presence IS NULL " \
  "            OR n.presence NOT IN ('normal', 'incomplete'))) " \
  "   OR (a.changelist IS NOT NULL AND (n.kind IS NOT NULL AND n.kind != 'file')) " \
  "   OR (a.conflict_data IS NULL AND a.properties IS NULL AND a.changelist IS NULL) " \
  " AND NOT EXISTS(SELECT 1 from nodes i " \
  "                WHERE i.wc_id=a.wc_id " \
  "                  AND i.local_relpath=a.parent_relpath) " \
  "UNION ALL " \
  "SELECT local_relpath, op_depth, 20, 'No ancestor in NODES' " \
  "FROM nodes n WHERE local_relpath != '' " \
  " AND file_external IS NULL " \
  " AND NOT EXISTS(SELECT 1 from nodes i " \
  "                WHERE i.wc_id=n.wc_id " \
  "                  AND i.local_relpath=n.parent_relpath " \
  "                  AND i.op_depth <= n.op_depth) " \
  "UNION ALL " \
  "SELECT local_relpath, op_depth, 21, 'Unneeded node data' " \
  "FROM nodes " \
  "WHERE presence NOT IN ('normal', 'incomplete') " \
  "AND (properties IS NOT NULL " \
  "     OR checksum IS NOT NULL " \
  "     OR depth IS NOT NULL " \
  "     OR symlink_target IS NOT NULL " \
  "     OR changed_revision IS NOT NULL " \
  "     OR (changed_date IS NOT NULL AND changed_date != 0) " \
  "     OR changed_author IS NOT NULL " \
  "     OR translated_size IS NOT NULL " \
  "     OR last_mod_time IS NOT NULL " \
  "     OR dav_cache IS NOT NULL " \
  "     OR file_external IS NOT NULL " \
  "     OR inherited_props IS NOT NULL) " \
  "UNION ALL " \
  "SELECT local_relpath, op_depth, 22, 'Unneeded base-deleted node data' " \
  "FROM nodes " \
  "WHERE presence IN ('base-deleted') " \
  "AND (repos_id IS NOT NULL " \
  "     OR repos_path IS NOT NULL " \
  "     OR revision IS NOT NULL) " \
  "UNION ALL " \
  "SELECT local_relpath, op_depth, 23, 'Kind specific data invalid on normal' " \
  "FROM nodes " \
  "WHERE presence IN ('normal', 'incomplete') " \
  "AND (kind IS NULL " \
  "     OR (repos_path IS NULL " \
  "         AND (properties IS NOT NULL " \
  "              OR changed_revision IS NOT NULL " \
  "              OR changed_author IS NOT NULL " \
  "              OR (changed_date IS NOT NULL AND changed_date != 0))) " \
  "     OR (CASE WHEN kind = 'file' AND repos_path IS NOT NULL " \
  "                                   THEN checksum IS NULL " \
  "                                   ELSE checksum IS NOT NULL END) " \
  "     OR (CASE WHEN kind = 'dir' THEN depth IS NULL " \
  "                                  ELSE depth IS NOT NULL END) " \
  "     OR (CASE WHEN kind = 'symlink' THEN symlink_target IS NULL " \
  "                                      ELSE symlink_target IS NOT NULL END)) " \
  "UNION ALL " \
  "SELECT local_relpath, op_depth, 24, 'Invalid op-depth for local add' " \
  "FROM nodes " \
  "WHERE presence IN ('normal', 'incomplete') " \
  "  AND repos_path IS NULL " \
  "  AND op_depth != relpath_depth(local_relpath) " \
  "UNION ALL " \
  "SELECT local_relpath, op_depth, 25, 'Node missing op-depth ancestor' " \
  "FROM nodes n " \
  "WHERE op_depth < relpath_depth(local_relpath) " \
  "  AND file_external IS NULL " \
  "  AND NOT EXISTS(SELECT 1 FROM nodes p " \
  "                 WHERE p.wc_id=n.wc_id AND p.local_relpath=n.parent_relpath " \
  "                   AND p.op_depth=n.op_depth " \
  "                   AND (p.presence IN ('normal', 'incomplete') " \
  "                        OR (p.presence IN ('base-deleted', 'not-present') " \
  "                            AND n.presence = 'base-deleted'))) " \
  "UNION ALL " \
  "SELECT n.local_relpath, n.op_depth, 26, 'Copied descendant mismatch' " \
  "FROM nodes n " \
  "JOIN nodes p " \
  "  ON p.wc_id=n.wc_id AND p.local_relpath=n.parent_relpath " \
  "  AND n.op_depth=p.op_depth " \
  "WHERE n.op_depth > 0 AND n.presence IN ('normal', 'incomplete') " \
  "   AND (n.repos_id != p.repos_id " \
  "        OR n.repos_path != " \
  "           (CASE WHEN (n.parent_relpath) = '' THEN (CASE WHEN (p.repos_path) = '' THEN (n.local_relpath) WHEN (n.local_relpath) = '' THEN (p.repos_path) ELSE (p.repos_path) || '/' || (n.local_relpath) END) WHEN (p.repos_path) = '' THEN (CASE WHEN (n.parent_relpath) = '' THEN (n.local_relpath)  WHEN SUBSTR((n.local_relpath), 1, LENGTH(n.parent_relpath)) = (n.parent_relpath)  THEN CASE WHEN LENGTH(n.parent_relpath) = LENGTH(n.local_relpath) THEN '' WHEN SUBSTR((n.local_relpath), LENGTH(n.parent_relpath)+1, 1) = '/' THEN SUBSTR((n.local_relpath), LENGTH(n.parent_relpath)+2) END END) WHEN SUBSTR((n.local_relpath), 1, LENGTH(n.parent_relpath)) = (n.parent_relpath) THEN CASE WHEN LENGTH(n.parent_relpath) = LENGTH(n.local_relpath) THEN (p.repos_path) WHEN SUBSTR((n.local_relpath), LENGTH(n.parent_relpath)+1, 1) = '/' THEN (p.repos_path) || SUBSTR((n.local_relpath), LENGTH(n.parent_relpath)+1) END END) " \
  "        OR n.revision != p.revision " \
  "        OR p.kind != 'dir' " \
  "        OR n.moved_here IS NOT p.moved_here) " \
  "UNION ALL " \
  "SELECT n.local_relpath, n.op_depth, 27, 'Invalid op-root presence' " \
  "FROM nodes n " \
  "WHERE n.op_depth = relpath_depth(local_relpath) " \
  "  AND presence NOT IN ('normal', 'incomplete', 'base-deleted') " \
  "UNION ALL " \
  "SELECT n.local_relpath, s.op_depth, 28, 'Incomplete shadowing' " \
  "FROM nodes n " \
  "JOIN nodes s ON s.wc_id=n.wc_id AND s.local_relpath=n.local_relpath " \
  " AND s.op_depth = relpath_depth(s.local_relpath) " \
  " AND s.op_depth = (SELECT MIN(op_depth) FROM nodes d " \
  "                   WHERE d.wc_id=s.wc_id AND d.local_relpath=s.local_relpath " \
  "                     AND d.op_depth > n.op_depth) " \
  "WHERE n.presence IN ('normal', 'incomplete') " \
  "  AND EXISTS(SELECT 1 " \
  "             FROM nodes dn " \
  "             WHERE dn.wc_id=n.wc_id AND dn.op_depth=n.op_depth " \
  "               AND dn.presence IN ('normal', 'incomplete') " \
  "               AND (((dn.local_relpath) > (CASE (n.local_relpath) WHEN '' THEN '' ELSE (n.local_relpath) || '/' END)) AND ((dn.local_relpath) < CASE (n.local_relpath) WHEN '' THEN X'FFFF' ELSE (n.local_relpath) || '0' END)) " \
  "               AND dn.file_external IS NULL " \
  "               AND NOT EXISTS(SELECT 1 " \
  "                              FROM nodes ds " \
  "                              WHERE ds.wc_id=n.wc_id AND ds.op_depth=s.op_depth " \
  "                                AND ds.local_relpath=dn.local_relpath)) " \
  "UNION ALL " \
  "SELECT s.local_relpath, s.op_depth, 29, 'Invalid base-delete' " \
  "FROM nodes s " \
  "LEFT JOIN nodes n ON n.wc_id=s.wc_id AND n.local_relpath=s.local_relpath " \
  " AND n.op_depth = (SELECT MAX(op_depth) FROM nodes d " \
  "                   WHERE d.wc_id=s.wc_id AND d.local_relpath=s.local_relpath " \
  "                     AND d.op_depth < s.op_depth) " \
  "WHERE s.presence = 'base-deleted' " \
  "  AND (n.presence IS NULL " \
  "       OR n.presence NOT IN ('normal', 'incomplete') " \
  "       ) " \
  "UNION ALL " \
  "SELECT n.local_relpath, n.op_depth, 30, 'Invalid data for BASE' " \
  "FROM nodes n " \
  "WHERE n.op_depth = 0 " \
  "  AND (n.moved_to IS NOT NULL " \
  "       OR n.moved_here IS NOT NULL) " \
  "UNION ALL " \
  "SELECT d.local_relpath, d.op_depth, 60, 'Moved here without origin' " \
  "FROM nodes d " \
  "WHERE d.op_depth = relpath_depth(d.local_relpath) " \
  "  AND d.moved_here IS NOT NULL " \
  "  AND NOT EXISTS(SELECT 1 FROM nodes s " \
  "                 WHERE s.wc_id = d.wc_id AND s.moved_to = d.local_relpath) " \
  "UNION ALL " \
  "SELECT s.local_relpath, s.op_depth, 61, 'Moved to without target' " \
  "FROM nodes s " \
  "WHERE s.moved_to IS NOT NULL " \
  "  AND NOT EXISTS(SELECT 1 FROM nodes d " \
  "                 WHERE d.wc_id = s.wc_id AND d.local_relpath = s.moved_to " \
  "                   AND d.op_depth = relpath_depth(d.local_relpath) " \
  "                   AND d.moved_here =1 AND d.repos_path IS NOT NULL) " \
  ""

#define WC_QUERIES_SQL_DECLARE_STATEMENTS(varname) \
  static const char * const varname[] = { \
    STMT_0, \
    STMT_1, \
    STMT_2, \
    STMT_3, \
    STMT_4, \
    STMT_5, \
    STMT_6, \
    STMT_7, \
    STMT_8, \
    STMT_9, \
    STMT_10, \
    STMT_11, \
    STMT_12, \
    STMT_13, \
    STMT_14, \
    STMT_15, \
    STMT_16, \
    STMT_17, \
    STMT_18, \
    STMT_19, \
    STMT_20, \
    STMT_21, \
    STMT_22, \
    STMT_23, \
    STMT_24, \
    STMT_25, \
    STMT_26, \
    STMT_27, \
    STMT_28, \
    STMT_29, \
    STMT_30, \
    STMT_31, \
    STMT_32, \
    STMT_33, \
    STMT_34, \
    STMT_35, \
    STMT_36, \
    STMT_37, \
    STMT_38, \
    STMT_39, \
    STMT_40, \
    STMT_41, \
    STMT_42, \
    STMT_43, \
    STMT_44, \
    STMT_45, \
    STMT_46, \
    STMT_47, \
    STMT_48, \
    STMT_49, \
    STMT_50, \
    STMT_51, \
    STMT_52, \
    STMT_53, \
    STMT_54, \
    STMT_55, \
    STMT_56, \
    STMT_57, \
    STMT_58, \
    STMT_59, \
    STMT_60, \
    STMT_61, \
    STMT_62, \
    STMT_63, \
    STMT_64, \
    STMT_65, \
    STMT_66, \
    STMT_67, \
    STMT_68, \
    STMT_69, \
    STMT_70, \
    STMT_71, \
    STMT_72, \
    STMT_73, \
    STMT_74, \
    STMT_75, \
    STMT_76, \
    STMT_77, \
    STMT_78, \
    STMT_79, \
    STMT_80, \
    STMT_81, \
    STMT_82, \
    STMT_83, \
    STMT_84, \
    STMT_85, \
    STMT_86, \
    STMT_87, \
    STMT_88, \
    STMT_89, \
    STMT_90, \
    STMT_91, \
    STMT_92, \
    STMT_93, \
    STMT_94, \
    STMT_95, \
    STMT_96, \
    STMT_97, \
    STMT_98, \
    STMT_99, \
    STMT_100, \
    STMT_101, \
    STMT_102, \
    STMT_103, \
    STMT_104, \
    STMT_105, \
    STMT_106, \
    STMT_107, \
    STMT_108, \
    STMT_109, \
    STMT_110, \
    STMT_111, \
    STMT_112, \
    STMT_113, \
    STMT_114, \
    STMT_115, \
    STMT_116, \
    STMT_117, \
    STMT_118, \
    STMT_119, \
    STMT_120, \
    STMT_121, \
    STMT_122, \
    STMT_123, \
    STMT_124, \
    STMT_125, \
    STMT_126, \
    STMT_127, \
    STMT_128, \
    STMT_129, \
    STMT_130, \
    STMT_131, \
    STMT_132, \
    STMT_133, \
    STMT_134, \
    STMT_135, \
    STMT_136, \
    STMT_137, \
    STMT_138, \
    STMT_139, \
    STMT_140, \
    STMT_141, \
    STMT_142, \
    STMT_143, \
    STMT_144, \
    STMT_145, \
    STMT_146, \
    STMT_147, \
    STMT_148, \
    STMT_149, \
    STMT_150, \
    STMT_151, \
    STMT_152, \
    STMT_153, \
    STMT_154, \
    STMT_155, \
    STMT_156, \
    STMT_157, \
    STMT_158, \
    STMT_159, \
    STMT_160, \
    STMT_161, \
    STMT_162, \
    STMT_163, \
    STMT_164, \
    STMT_165, \
    STMT_166, \
    STMT_167, \
    STMT_168, \
    STMT_169, \
    STMT_170, \
    STMT_171, \
    STMT_172, \
    STMT_173, \
    STMT_174, \
    STMT_175, \
    STMT_176, \
    STMT_177, \
    STMT_178, \
    STMT_179, \
    STMT_180, \
    STMT_181, \
    STMT_182, \
    STMT_183, \
    STMT_184, \
    STMT_185, \
    STMT_186, \
    STMT_187, \
    STMT_188, \
    STMT_189, \
    STMT_190, \
    STMT_191, \
    STMT_192, \
    STMT_193, \
    STMT_194, \
    STMT_195, \
    STMT_196, \
    STMT_197, \
    STMT_198, \
    STMT_199, \
    STMT_200, \
    STMT_201, \
    STMT_202, \
    STMT_203, \
    STMT_204, \
    STMT_205, \
    STMT_206, \
    STMT_207, \
    STMT_208, \
    STMT_209, \
    STMT_210, \
    STMT_211, \
    STMT_212, \
    STMT_213, \
    STMT_214, \
    STMT_215, \
    STMT_216, \
    STMT_217, \
    STMT_218, \
    STMT_219, \
    STMT_220, \
    STMT_221, \
    STMT_222, \
    STMT_223, \
    STMT_224, \
    STMT_225, \
    STMT_226, \
    STMT_227, \
    STMT_228, \
    STMT_229, \
    STMT_230, \
    STMT_231, \
    STMT_232, \
    STMT_233, \
    STMT_234, \
    NULL \
  }

#define WC_QUERIES_SQL_DECLARE_STATEMENT_INFO(varname) \
  static const char * const varname[][2] = { \
    STMT_0_INFO, \
    STMT_1_INFO, \
    STMT_2_INFO, \
    STMT_3_INFO, \
    STMT_4_INFO, \
    STMT_5_INFO, \
    STMT_6_INFO, \
    STMT_7_INFO, \
    STMT_8_INFO, \
    STMT_9_INFO, \
    STMT_10_INFO, \
    STMT_11_INFO, \
    STMT_12_INFO, \
    STMT_13_INFO, \
    STMT_14_INFO, \
    STMT_15_INFO, \
    STMT_16_INFO, \
    STMT_17_INFO, \
    STMT_18_INFO, \
    STMT_19_INFO, \
    STMT_20_INFO, \
    STMT_21_INFO, \
    STMT_22_INFO, \
    STMT_23_INFO, \
    STMT_24_INFO, \
    STMT_25_INFO, \
    STMT_26_INFO, \
    STMT_27_INFO, \
    STMT_28_INFO, \
    STMT_29_INFO, \
    STMT_30_INFO, \
    STMT_31_INFO, \
    STMT_32_INFO, \
    STMT_33_INFO, \
    STMT_34_INFO, \
    STMT_35_INFO, \
    STMT_36_INFO, \
    STMT_37_INFO, \
    STMT_38_INFO, \
    STMT_39_INFO, \
    STMT_40_INFO, \
    STMT_41_INFO, \
    STMT_42_INFO, \
    STMT_43_INFO, \
    STMT_44_INFO, \
    STMT_45_INFO, \
    STMT_46_INFO, \
    STMT_47_INFO, \
    STMT_48_INFO, \
    STMT_49_INFO, \
    STMT_50_INFO, \
    STMT_51_INFO, \
    STMT_52_INFO, \
    STMT_53_INFO, \
    STMT_54_INFO, \
    STMT_55_INFO, \
    STMT_56_INFO, \
    STMT_57_INFO, \
    STMT_58_INFO, \
    STMT_59_INFO, \
    STMT_60_INFO, \
    STMT_61_INFO, \
    STMT_62_INFO, \
    STMT_63_INFO, \
    STMT_64_INFO, \
    STMT_65_INFO, \
    STMT_66_INFO, \
    STMT_67_INFO, \
    STMT_68_INFO, \
    STMT_69_INFO, \
    STMT_70_INFO, \
    STMT_71_INFO, \
    STMT_72_INFO, \
    STMT_73_INFO, \
    STMT_74_INFO, \
    STMT_75_INFO, \
    STMT_76_INFO, \
    STMT_77_INFO, \
    STMT_78_INFO, \
    STMT_79_INFO, \
    STMT_80_INFO, \
    STMT_81_INFO, \
    STMT_82_INFO, \
    STMT_83_INFO, \
    STMT_84_INFO, \
    STMT_85_INFO, \
    STMT_86_INFO, \
    STMT_87_INFO, \
    STMT_88_INFO, \
    STMT_89_INFO, \
    STMT_90_INFO, \
    STMT_91_INFO, \
    STMT_92_INFO, \
    STMT_93_INFO, \
    STMT_94_INFO, \
    STMT_95_INFO, \
    STMT_96_INFO, \
    STMT_97_INFO, \
    STMT_98_INFO, \
    STMT_99_INFO, \
    STMT_100_INFO, \
    STMT_101_INFO, \
    STMT_102_INFO, \
    STMT_103_INFO, \
    STMT_104_INFO, \
    STMT_105_INFO, \
    STMT_106_INFO, \
    STMT_107_INFO, \
    STMT_108_INFO, \
    STMT_109_INFO, \
    STMT_110_INFO, \
    STMT_111_INFO, \
    STMT_112_INFO, \
    STMT_113_INFO, \
    STMT_114_INFO, \
    STMT_115_INFO, \
    STMT_116_INFO, \
    STMT_117_INFO, \
    STMT_118_INFO, \
    STMT_119_INFO, \
    STMT_120_INFO, \
    STMT_121_INFO, \
    STMT_122_INFO, \
    STMT_123_INFO, \
    STMT_124_INFO, \
    STMT_125_INFO, \
    STMT_126_INFO, \
    STMT_127_INFO, \
    STMT_128_INFO, \
    STMT_129_INFO, \
    STMT_130_INFO, \
    STMT_131_INFO, \
    STMT_132_INFO, \
    STMT_133_INFO, \
    STMT_134_INFO, \
    STMT_135_INFO, \
    STMT_136_INFO, \
    STMT_137_INFO, \
    STMT_138_INFO, \
    STMT_139_INFO, \
    STMT_140_INFO, \
    STMT_141_INFO, \
    STMT_142_INFO, \
    STMT_143_INFO, \
    STMT_144_INFO, \
    STMT_145_INFO, \
    STMT_146_INFO, \
    STMT_147_INFO, \
    STMT_148_INFO, \
    STMT_149_INFO, \
    STMT_150_INFO, \
    STMT_151_INFO, \
    STMT_152_INFO, \
    STMT_153_INFO, \
    STMT_154_INFO, \
    STMT_155_INFO, \
    STMT_156_INFO, \
    STMT_157_INFO, \
    STMT_158_INFO, \
    STMT_159_INFO, \
    STMT_160_INFO, \
    STMT_161_INFO, \
    STMT_162_INFO, \
    STMT_163_INFO, \
    STMT_164_INFO, \
    STMT_165_INFO, \
    STMT_166_INFO, \
    STMT_167_INFO, \
    STMT_168_INFO, \
    STMT_169_INFO, \
    STMT_170_INFO, \
    STMT_171_INFO, \
    STMT_172_INFO, \
    STMT_173_INFO, \
    STMT_174_INFO, \
    STMT_175_INFO, \
    STMT_176_INFO, \
    STMT_177_INFO, \
    STMT_178_INFO, \
    STMT_179_INFO, \
    STMT_180_INFO, \
    STMT_181_INFO, \
    STMT_182_INFO, \
    STMT_183_INFO, \
    STMT_184_INFO, \
    STMT_185_INFO, \
    STMT_186_INFO, \
    STMT_187_INFO, \
    STMT_188_INFO, \
    STMT_189_INFO, \
    STMT_190_INFO, \
    STMT_191_INFO, \
    STMT_192_INFO, \
    STMT_193_INFO, \
    STMT_194_INFO, \
    STMT_195_INFO, \
    STMT_196_INFO, \
    STMT_197_INFO, \
    STMT_198_INFO, \
    STMT_199_INFO, \
    STMT_200_INFO, \
    STMT_201_INFO, \
    STMT_202_INFO, \
    STMT_203_INFO, \
    STMT_204_INFO, \
    STMT_205_INFO, \
    STMT_206_INFO, \
    STMT_207_INFO, \
    STMT_208_INFO, \
    STMT_209_INFO, \
    STMT_210_INFO, \
    STMT_211_INFO, \
    STMT_212_INFO, \
    STMT_213_INFO, \
    STMT_214_INFO, \
    STMT_215_INFO, \
    STMT_216_INFO, \
    STMT_217_INFO, \
    STMT_218_INFO, \
    STMT_219_INFO, \
    STMT_220_INFO, \
    STMT_221_INFO, \
    STMT_222_INFO, \
    STMT_223_INFO, \
    STMT_224_INFO, \
    STMT_225_INFO, \
    STMT_226_INFO, \
    STMT_227_INFO, \
    STMT_228_INFO, \
    STMT_229_INFO, \
    STMT_230_INFO, \
    STMT_231_INFO, \
    STMT_232_INFO, \
    STMT_233_INFO, \
    STMT_234_INFO, \
    {NULL, NULL} \
  }