-
Notifications
You must be signed in to change notification settings - Fork 0
/
sql.cpp
906 lines (882 loc) · 48.3 KB
/
sql.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
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
#include "sql.h"
const char *SQL_schema = "CREATE TABLE SCHEMA ( version INTEGER ); INSERT INTO \"SCHEMA\" VALUES(" DB_VERSION ");";
const char *dailyObsSchema = "CREATE TABLE dailyObs ( time INTEGER PRIMARY KEY,"
"insideTemp FLOAT,"
"insideHumidity FLOAT,"
"outsideTemp FLOAT,"
"outsideHumidity FLOAT,"
"windSpeed FLOAT,"
"windDirection FLOAT,"
"windGust FLOAT,"
"windGustDir FLOAT,"
"rainRate FLOAT,"
"rain24Hour FLOAT,"
"dailyRain FLOAT,"
"dailyET FLOAT,"
"instantRain FLOAT,"
"UV FLOAT,"
"solarRadiation FLOAT,"
"solarRadiationPercent FLOAT,"
"barometricTrend TREND,"
"rawBarometer FLOAT,"
"SLP FLOAT,"
"altimeter FLOAT,"
"dewPoint FLOAT,"
"heatIndex FLOAT,"
"humidex FLOAT,"
"windChill FLOAT,"
"apparentTemp FLOAT,"
"cloudHeight INT,"
"extraTemp1 FLOAT,"
"extraTemp2 FLOAT,"
"extraTemp3 FLOAT,"
"extraTemp4 FLOAT,"
"extraTemp5 FLOAT,"
"extraTemp6 FLOAT,"
"extraTemp7 FLOAT,"
"extraTemp8 FLOAT,"
"extraHumidity1 FLOAT,"
"extraHumidity2 FLOAT,"
"extraHumidity3 FLOAT,"
"extraHumidity4 FLOAT,"
"extraHumidity5 FLOAT,"
"extraHumidity6 FLOAT,"
"extraHumidity7 FLOAT,"
"extraHumidity8 FLOAT,"
"soilTemp1 FLOAT,"
"soilTemp2 FLOAT,"
"soilTemp3 FLOAT,"
"soilTemp4 FLOAT,"
"soilTemp5 FLOAT,"
"soilTemp6 FLOAT,"
"soilTemp7 FLOAT,"
"soilTemp8 FLOAT,"
"soilMoisture1 FLOAT,"
"soilMoisture2 FLOAT,"
"soilMoisture3 FLOAT,"
"soilMoisture4 FLOAT,"
"soilMoisture5 FLOAT,"
"soilMoisture6 FLOAT,"
"soilMoisture7 FLOAT,"
"soilMoisture8 FLOAT,"
"leafTemp1 FLOAT,"
"leafTemp2 FLOAT,"
"leafTemp3 FLOAT,"
"leafTemp4 FLOAT,"
"leafTemp5 FLOAT,"
"leafTemp6 FLOAT,"
"leafTemp7 FLOAT,"
"leafTemp8 FLOAT,"
"leafWetness1 FLOAT,"
"leafWetness2 FLOAT,"
"leafWetness3 FLOAT,"
"leafWetness4 FLOAT,"
"leafWetness5 FLOAT,"
"leafWetness6 FLOAT,"
"leafWetness7 FLOAT,"
"leafWetness8 FLOAT );";
const char *hourlySummarySchema =
"CREATE TABLE hourlySummary ( time INTEGER PRIMARY KEY,"
"insideTempMin FLOAT,"
"insideTempMinTime TIME,"
"insideTempMax FLOAT,"
"insideTempMaxTime TIME,"
"insideTempAvg FLOAT,"
"insideHumidityMin FLOAT,"
"insideHumidityMinTime TIME,"
"insideHumidityMax FLOAT,"
"insideHumidityMaxTime TIME,"
"insideHumidityAvg FLOAT,"
"outsideTempMin FLOAT,"
"outsideTempMinTime TIME,"
"outsideTempMax FLOAT,"
"outsideTempMaxTime TIME,"
"outsideTempAvg FLOAT,"
"outsideHumidityMin FLOAT,"
"outsideHumidityMinTime TIME,"
"outsideHumidityMax FLOAT,"
"outsideHumidityMaxTime TIME,"
"outsideHumidityAvg FLOAT,"
"windSpeedMin FLOAT,"
"windSpeedMinTime TIME,"
"windSpeedMax FLOAT,"
"windSpeedMaxTime TIME,"
"windSpeedAvg FLOAT,"
"windGustMin FLOAT,"
"windGustMinTime TIME,"
"windGustMax FLOAT,"
"windGustMaxTime TIME,"
"windGustAvg FLOAT,"
"windDirectionAvg FLOAT,"
"windGustDirAvg FLOAT,"
"rainRateMin FLOAT,"
"rainRateMinTime TIME,"
"rainRateMax FLOAT,"
"rainRateMaxTime TIME,"
"rainRateAvg FLOAT,"
"rain24HourMin FLOAT,"
"rain24HourMinTime TIME,"
"rain24HourMax FLOAT,"
"rain24HourMaxTime TIME,"
"rain24HourAvg FLOAT,"
"dailyRain FLOAT,"
"dailyET FLOAT,"
"instantRainMax FLOAT,"
"instantRainMaxTime TIME,"
"UVMin FLOAT,"
"UVMinTime TIME,"
"UVMax FLOAT,"
"UVMaxTime TIME,"
"UVAvg FLOAT,"
"solarRadiationMin FLOAT,"
"solarRadiationMinTime TIME,"
"solarRadiationMax FLOAT,"
"solarRadiationMaxTime TIME,"
"solarRadiationAvg FLOAT,"
"solarRadiationPercentMin FLOAT,"
"solarRadiationPercentMinTime TIME,"
"solarRadiationPercentMax FLOAT,"
"solarRadiationPercentMaxTime TIME,"
"solarRadiationPercentAvg FLOAT,"
"rawBarometerMin FLOAT,"
"rawBarometerMinTime TIME,"
"rawBarometerMax FLOAT,"
"rawBarometerMaxTime TIME,"
"rawBarometerAvg FLOAT,"
"SLPMin FLOAT,"
"SLPMinTime TIME,"
"SLPMax FLOAT,"
"SLPMaxTime TIME,"
"SLPAvg FLOAT,"
"altimeterMin FLOAT,"
"altimeterMinTime TIME,"
"altimeterMax FLOAT,"
"altimeterMaxTime TIME,"
"altimeterAvg FLOAT,"
"heatIndexMin FLOAT,"
"heatIndexMinTime TIME,"
"heatIndexMax FLOAT,"
"heatIndexMaxTime TIME,"
"heatIndexAvg FLOAT,"
"humidexMin FLOAT,"
"humidexMinTime TIME,"
"humidexMax FLOAT,"
"humidexMaxTime TIME,"
"humidexAvg FLOAT,"
"windChillMin FLOAT,"
"windChillMinTime TIME,"
"windChillMax FLOAT,"
"windChillMaxTime TIME,"
"windChillAvg FLOAT,"
"apparentTempMin FLOAT,"
"apparentTempMinTime TIME,"
"apparentTempMax FLOAT,"
"apparentTempMaxTime TIME,"
"apparentTempAvg FLOAT,"
"cloudHeightMin FLOAT,"
"cloudHeightMinTime TIME,"
"cloudHeightMax FLOAT,"
"cloudHeightMaxTime TIME,"
"cloudHeightAvg FLOAT,"
"dewPointMin FLOAT,"
"dewPointMinTime TIME,"
"dewPointMax FLOAT,"
"dewPointMaxTime TIME,"
"dewPointAvg FLOAT,"
"extraTemp1Min FLOAT,"
"extraTemp1MinTime TIME,"
"extraTemp1Max FLOAT,"
"extraTemp1MaxTime TIME,"
"extraTemp1Avg FLOAT,"
"extraTemp2Min FLOAT,"
"extraTemp2MinTime TIME,"
"extraTemp2Max FLOAT,"
"extraTemp2MaxTime TIME,"
"extraTemp2Avg FLOAT,"
"extraTemp3Min FLOAT,"
"extraTemp3MinTime TIME,"
"extraTemp3Max FLOAT,"
"extraTemp3MaxTime TIME,"
"extraTemp3Avg FLOAT,"
"extraTemp4Min FLOAT,"
"extraTemp4MinTime TIME,"
"extraTemp4Max FLOAT,"
"extraTemp4MaxTime TIME,"
"extraTemp4Avg FLOAT,"
"extraTemp5Min FLOAT,"
"extraTemp5MinTime TIME,"
"extraTemp5Max FLOAT,"
"extraTemp5MaxTime TIME,"
"extraTemp5Avg FLOAT,"
"extraTemp6Min FLOAT,"
"extraTemp6MinTime TIME,"
"extraTemp6Max FLOAT,"
"extraTemp6MaxTime TIME,"
"extraTemp6Avg FLOAT,"
"extraTemp7Min FLOAT,"
"extraTemp7MinTime TIME,"
"extraTemp7Max FLOAT,"
"extraTemp7MaxTime TIME,"
"extraTemp7Avg FLOAT,"
"extraTemp8Min FLOAT,"
"extraTemp8MinTime TIME,"
"extraTemp8Max FLOAT,"
"extraTemp8MaxTime TIME,"
"extraTemp8Avg FLOAT,"
"extraHumidity1Min FLOAT,"
"extraHumidity1MinTime TIME,"
"extraHumidity1Max FLOAT,"
"extraHumidity1MaxTime TIME,"
"extraHumidity1Avg FLOAT,"
"extraHumidity2Min FLOAT,"
"extraHumidity2MinTime TIME,"
"extraHumidity2Max FLOAT,"
"extraHumidity2MaxTime TIME,"
"extraHumidity2Avg FLOAT,"
"extraHumidity3Min FLOAT,"
"extraHumidity3MinTime TIME,"
"extraHumidity3Max FLOAT,"
"extraHumidity3MaxTime TIME,"
"extraHumidity3Avg FLOAT,"
"extraHumidity4Min FLOAT,"
"extraHumidity4MinTime TIME,"
"extraHumidity4Max FLOAT,"
"extraHumidity4MaxTime TIME,"
"extraHumidity4Avg FLOAT,"
"extraHumidity5Min FLOAT,"
"extraHumidity5MinTime TIME,"
"extraHumidity5Max FLOAT,"
"extraHumidity5MaxTime TIME,"
"extraHumidity5Avg FLOAT,"
"extraHumidity6Min FLOAT,"
"extraHumidity6MinTime TIME,"
"extraHumidity6Max FLOAT,"
"extraHumidity6MaxTime TIME,"
"extraHumidity6Avg FLOAT,"
"extraHumidity7Min FLOAT,"
"extraHumidity7MinTime TIME,"
"extraHumidity7Max FLOAT,"
"extraHumidity7MaxTime TIME,"
"extraHumidity7Avg FLOAT,"
"extraHumidity8Min FLOAT,"
"extraHumidity8MinTime TIME,"
"extraHumidity8Max FLOAT,"
"extraHumidity8MaxTime TIME,"
"extraHumidity8Avg FLOAT,"
"soilTemp1Min FLOAT,"
"soilTemp1MinTime TIME,"
"soilTemp1Max FLOAT,"
"soilTemp1MaxTime TIME,"
"soilTemp1Avg FLOAT,"
"soilTemp2Min FLOAT,"
"soilTemp2MinTime TIME,"
"soilTemp2Max FLOAT,"
"soilTemp2MaxTime TIME,"
"soilTemp2Avg FLOAT,"
"soilTemp3Min FLOAT,"
"soilTemp3MinTime TIME,"
"soilTemp3Max FLOAT,"
"soilTemp3MaxTime TIME,"
"soilTemp3Avg FLOAT,"
"soilTemp4Min FLOAT,"
"soilTemp4MinTime TIME,"
"soilTemp4Max FLOAT,"
"soilTemp4MaxTime TIME,"
"soilTemp4Avg FLOAT,"
"soilTemp5Min FLOAT,"
"soilTemp5MinTime TIME,"
"soilTemp5Max FLOAT,"
"soilTemp5MaxTime TIME,"
"soilTemp5Avg FLOAT,"
"soilTemp6Min FLOAT,"
"soilTemp6MinTime TIME,"
"soilTemp6Max FLOAT,"
"soilTemp6MaxTime TIME,"
"soilTemp6Avg FLOAT,"
"soilTemp7Min FLOAT,"
"soilTemp7MinTime TIME,"
"soilTemp7Max FLOAT,"
"soilTemp7MaxTime TIME,"
"soilTemp7Avg FLOAT,"
"soilTemp8Min FLOAT,"
"soilTemp8MinTime TIME,"
"soilTemp8Max FLOAT,"
"soilTemp8MaxTime TIME,"
"soilTemp8Avg FLOAT,"
"soilMoisture1Min FLOAT,"
"soilMoisture1MinTime TIME,"
"soilMoisture1Max FLOAT,"
"soilMoisture1MaxTime TIME,"
"soilMoisture1Avg FLOAT,"
"soilMoisture2Min FLOAT,"
"soilMoisture2MinTime TIME,"
"soilMoisture2Max FLOAT,"
"soilMoisture2MaxTime TIME,"
"soilMoisture2Avg FLOAT,"
"soilMoisture3Min FLOAT,"
"soilMoisture3MinTime TIME,"
"soilMoisture3Max FLOAT,"
"soilMoisture3MaxTime TIME,"
"soilMoisture3Avg FLOAT,"
"soilMoisture4Min FLOAT,"
"soilMoisture4MinTime TIME,"
"soilMoisture4Max FLOAT,"
"soilMoisture4MaxTime TIME,"
"soilMoisture4Avg FLOAT,"
"soilMoisture5Min FLOAT,"
"soilMoisture5MinTime TIME,"
"soilMoisture5Max FLOAT,"
"soilMoisture5MaxTime TIME,"
"soilMoisture5Avg FLOAT,"
"soilMoisture6Min FLOAT,"
"soilMoisture6MinTime TIME,"
"soilMoisture6Max FLOAT,"
"soilMoisture6MaxTime TIME,"
"soilMoisture6Avg FLOAT,"
"soilMoisture7Min FLOAT,"
"soilMoisture7MinTime TIME,"
"soilMoisture7Max FLOAT,"
"soilMoisture7MaxTime TIME,"
"soilMoisture7Avg FLOAT,"
"soilMoisture8Min FLOAT,"
"soilMoisture8MinTime TIME,"
"soilMoisture8Max FLOAT,"
"soilMoisture8MaxTime TIME,"
"soilMoisture8Avg FLOAT,"
"leafTemperature1Min FLOAT,"
"leafTemperature1MinTime TIME,"
"leafTemperature1Max FLOAT,"
"leafTemperature1MaxTime TIME,"
"leafTemperature1Avg FLOAT,"
"leafTemperature2Min FLOAT,"
"leafTemperature2MinTime TIME,"
"leafTemperature2Max FLOAT,"
"leafTemperature2MaxTime TIME,"
"leafTemperature2Avg FLOAT,"
"leafTemperature3Min FLOAT,"
"leafTemperature3MinTime TIME,"
"leafTemperature3Max FLOAT,"
"leafTemperature3MaxTime TIME,"
"leafTemperature3Avg FLOAT,"
"leafTemperature4Min FLOAT,"
"leafTemperature4MinTime TIME,"
"leafTemperature4Max FLOAT,"
"leafTemperature4MaxTime TIME,"
"leafTemperature4Avg FLOAT,"
"leafTemperature5Min FLOAT,"
"leafTemperature5MinTime TIME,"
"leafTemperature5Max FLOAT,"
"leafTemperature5MaxTime TIME,"
"leafTemperature5Avg FLOAT,"
"leafTemperature6Min FLOAT,"
"leafTemperature6MinTime TIME,"
"leafTemperature6Max FLOAT,"
"leafTemperature6MaxTime TIME,"
"leafTemperature6Avg FLOAT,"
"leafTemperature7Min FLOAT,"
"leafTemperature7MinTime TIME,"
"leafTemperature7Max FLOAT,"
"leafTemperature7MaxTime TIME,"
"leafTemperature7Avg FLOAT,"
"leafTemperature8Min FLOAT,"
"leafTemperature8MinTime TIME,"
"leafTemperature8Max FLOAT,"
"leafTemperature8MaxTime TIME,"
"leafTemperature8Avg FLOAT,"
"leafWetness1Min FLOAT,"
"leafWetness1MinTime TIME,"
"leafWetness1Max FLOAT,"
"leafWetness1MaxTime TIME,"
"leafWetness1Avg FLOAT,"
"leafWetness2Min FLOAT,"
"leafWetness2MinTime TIME,"
"leafWetness2Max FLOAT,"
"leafWetness2MaxTime TIME,"
"leafWetness2Avg FLOAT,"
"leafWetness3Min FLOAT,"
"leafWetness3MinTime TIME,"
"leafWetness3Max FLOAT,"
"leafWetness3MaxTime TIME,"
"leafWetness3Avg FLOAT,"
"leafWetness4Min FLOAT,"
"leafWetness4MinTime TIME,"
"leafWetness4Max FLOAT,"
"leafWetness4MaxTime TIME,"
"leafWetness4Avg FLOAT,"
"leafWetness5Min FLOAT,"
"leafWetness5MinTime TIME,"
"leafWetness5Max FLOAT,"
"leafWetness5MaxTime TIME,"
"leafWetness5Avg FLOAT,"
"leafWetness6Min FLOAT,"
"leafWetness6MinTime TIME,"
"leafWetness6Max FLOAT,"
"leafWetness6MaxTime TIME,"
"leafWetness6Avg FLOAT,"
"leafWetness7Min FLOAT,"
"leafWetness7MinTime TIME,"
"leafWetness7Max FLOAT,"
"leafWetness7MaxTime TIME,"
"leafWetness7Avg FLOAT,"
"leafWetness8Min FLOAT,"
"leafWetness8MinTime TIME,"
"leafWetness8Max FLOAT,"
"leafWetness8MaxTime TIME,"
"leafWetness8Avg FLOAT );";
const char *windSchema = "create table windData ( time INTEGEER PRIMARY KEY,"
"speed FLOAT,"
"dirSin FLOAT,"
"dirCos FLOAT);";
const char *rainSchema = "create table rainData ( time INTEGEER PRIMARY KEY,"
"amount FLOAT);";
const char *dailySummarySchema =
"CREATE TABLE dailySummary ( time INTEGER PRIMARY KEY,"
"insideTempMin FLOAT,"
"insideTempMinTime TIME,"
"insideTempMax FLOAT,"
"insideTempMaxTime TIME,"
"insideTempAvg FLOAT,"
"insideHumidityMin FLOAT,"
"insideHumidityMinTime TIME,"
"insideHumidityMax FLOAT,"
"insideHumidityMaxTime TIME,"
"insideHumidityAvg FLOAT,"
"outsideTempMin FLOAT,"
"outsideTempMinTime TIME,"
"outsideTempMax FLOAT,"
"outsideTempMaxTime TIME,"
"outsideTempAvg FLOAT,"
"outsideHumidityMin FLOAT,"
"outsideHumidityMinTime TIME,"
"outsideHumidityMax FLOAT,"
"outsideHumidityMaxTime TIME,"
"outsideHumidityAvg FLOAT,"
"windSpeedMin FLOAT,"
"windSpeedMinTime TIME,"
"windSpeedMax FLOAT,"
"windSpeedMaxTime TIME,"
"windSpeedAvg FLOAT,"
"windGustMin FLOAT,"
"windGustMinTime TIME,"
"windGustMax FLOAT,"
"windGustMaxTime TIME,"
"windGustAvg FLOAT,"
"windDirectionAvg FLOAT,"
"windGustDirAvg FLOAT,"
"rainRateMin FLOAT,"
"rainRateMinTime TIME,"
"rainRateMax FLOAT,"
"rainRateMaxTime TIME,"
"rainRateAvg FLOAT,"
"rain24HourMin FLOAT,"
"rain24HourMinTime TIME,"
"rain24HourMax FLOAT,"
"rain24HourMaxTime TIME,"
"rain24HourAvg FLOAT,"
"instantRainMax FLOAT,"
"instantRainMaxTime TIME,"
"dailyRain FLOAT,"
"dailyET FLOAT,"
"UVMin FLOAT,"
"UVMinTime TIME,"
"UVMax FLOAT,"
"UVMaxTime TIME,"
"UVAvg FLOAT,"
"solarRadiationMin FLOAT,"
"solarRadiationMinTime TIME,"
"solarRadiationMax FLOAT,"
"solarRadiationMaxTime TIME,"
"solarRadiationAvg FLOAT,"
"solarRadiationPercentMin FLOAT,"
"solarRadiationPercentMinTime TIME,"
"solarRadiationPercentMax FLOAT,"
"solarRadiationPercentMaxTime TIME,"
"solarRadiationPercentAvg FLOAT,"
"rawBarometerMin FLOAT,"
"rawBarometerMinTime TIME,"
"rawBarometerMax FLOAT,"
"rawBarometerMaxTime TIME,"
"rawBarometerAvg FLOAT,"
"SLPMin FLOAT,"
"SLPMinTime TIME,"
"SLPMax FLOAT,"
"SLPMaxTime TIME,"
"SLPAvg FLOAT,"
"altimeterMin FLOAT,"
"altimeterMinTime TIME,"
"altimeterMax FLOAT,"
"altimeterMaxTime TIME,"
"altimeterAvg FLOAT,"
"heatIndexMin FLOAT,"
"heatIndexMinTime TIME,"
"heatIndexMax FLOAT,"
"heatIndexMaxTime TIME,"
"heatIndexAvg FLOAT,"
"humidexMin FLOAT,"
"humidexMinTime TIME,"
"humidexMax FLOAT,"
"humidexMaxTime TIME,"
"humidexAvg FLOAT,"
"windChillMin FLOAT,"
"windChillMinTime TIME,"
"windChillMax FLOAT,"
"windChillMaxTime TIME,"
"windChillAvg FLOAT,"
"apparentTempMin FLOAT,"
"apparentTempMinTime TIME,"
"apparentTempMax FLOAT,"
"apparentTempMaxTime TIME,"
"apparentTempAvg FLOAT,"
"cloudHeightMin FLOAT,"
"cloudHeightMinTime TIME,"
"cloudHeightMax FLOAT,"
"cloudHeightMaxTime TIME,"
"cloudHeightAvg FLOAT,"
"dewPointMin FLOAT,"
"dewPointMinTime TIME,"
"dewPointMax FLOAT,"
"dewPointMaxTime TIME,"
"dewPointAvg FLOAT,"
"extraTemp1Min FLOAT,"
"extraTemp1MinTime TIME,"
"extraTemp1Max FLOAT,"
"extraTemp1MaxTime TIME,"
"extraTemp1Avg FLOAT,"
"extraTemp2Min FLOAT,"
"extraTemp2MinTime TIME,"
"extraTemp2Max FLOAT,"
"extraTemp2MaxTime TIME,"
"extraTemp2Avg FLOAT,"
"extraTemp3Min FLOAT,"
"extraTemp3MinTime TIME,"
"extraTemp3Max FLOAT,"
"extraTemp3MaxTime TIME,"
"extraTemp3Avg FLOAT,"
"extraTemp4Min FLOAT,"
"extraTemp4MinTime TIME,"
"extraTemp4Max FLOAT,"
"extraTemp4MaxTime TIME,"
"extraTemp4Avg FLOAT,"
"extraTemp5Min FLOAT,"
"extraTemp5MinTime TIME,"
"extraTemp5Max FLOAT,"
"extraTemp5MaxTime TIME,"
"extraTemp5Avg FLOAT,"
"extraTemp6Min FLOAT,"
"extraTemp6MinTime TIME,"
"extraTemp6Max FLOAT,"
"extraTemp6MaxTime TIME,"
"extraTemp6Avg FLOAT,"
"extraTemp7Min FLOAT,"
"extraTemp7MinTime TIME,"
"extraTemp7Max FLOAT,"
"extraTemp7MaxTime TIME,"
"extraTemp7Avg FLOAT,"
"extraTemp8Min FLOAT,"
"extraTemp8MinTime TIME,"
"extraTemp8Max FLOAT,"
"extraTemp8MaxTime TIME,"
"extraTemp8Avg FLOAT,"
"extraHumidity1Min FLOAT,"
"extraHumidity1MinTime TIME,"
"extraHumidity1Max FLOAT,"
"extraHumidity1MaxTime TIME,"
"extraHumidity1Avg FLOAT,"
"extraHumidity2Min FLOAT,"
"extraHumidity2MinTime TIME,"
"extraHumidity2Max FLOAT,"
"extraHumidity2MaxTime TIME,"
"extraHumidity2Avg FLOAT,"
"extraHumidity3Min FLOAT,"
"extraHumidity3MinTime TIME,"
"extraHumidity3Max FLOAT,"
"extraHumidity3MaxTime TIME,"
"extraHumidity3Avg FLOAT,"
"extraHumidity4Min FLOAT,"
"extraHumidity4MinTime TIME,"
"extraHumidity4Max FLOAT,"
"extraHumidity4MaxTime TIME,"
"extraHumidity4Avg FLOAT,"
"extraHumidity5Min FLOAT,"
"extraHumidity5MinTime TIME,"
"extraHumidity5Max FLOAT,"
"extraHumidity5MaxTime TIME,"
"extraHumidity5Avg FLOAT,"
"extraHumidity6Min FLOAT,"
"extraHumidity6MinTime TIME,"
"extraHumidity6Max FLOAT,"
"extraHumidity6MaxTime TIME,"
"extraHumidity6Avg FLOAT,"
"extraHumidity7Min FLOAT,"
"extraHumidity7MinTime TIME,"
"extraHumidity7Max FLOAT,"
"extraHumidity7MaxTime TIME,"
"extraHumidity7Avg FLOAT,"
"extraHumidity8Min FLOAT,"
"extraHumidity8MinTime TIME,"
"extraHumidity8Max FLOAT,"
"extraHumidity8MaxTime TIME,"
"extraHumidity8Avg FLOAT,"
"soilTemp1Min FLOAT,"
"soilTemp1MinTime TIME,"
"soilTemp1Max FLOAT,"
"soilTemp1MaxTime TIME,"
"soilTemp1Avg FLOAT,"
"soilTemp2Min FLOAT,"
"soilTemp2MinTime TIME,"
"soilTemp2Max FLOAT,"
"soilTemp2MaxTime TIME,"
"soilTemp2Avg FLOAT,"
"soilTemp3Min FLOAT,"
"soilTemp3MinTime TIME,"
"soilTemp3Max FLOAT,"
"soilTemp3MaxTime TIME,"
"soilTemp3Avg FLOAT,"
"soilTemp4Min FLOAT,"
"soilTemp4MinTime TIME,"
"soilTemp4Max FLOAT,"
"soilTemp4MaxTime TIME,"
"soilTemp4Avg FLOAT,"
"soilTemp5Min FLOAT,"
"soilTemp5MinTime TIME,"
"soilTemp5Max FLOAT,"
"soilTemp5MaxTime TIME,"
"soilTemp5Avg FLOAT,"
"soilTemp6Min FLOAT,"
"soilTemp6MinTime TIME,"
"soilTemp6Max FLOAT,"
"soilTemp6MaxTime TIME,"
"soilTemp6Avg FLOAT,"
"soilTemp7Min FLOAT,"
"soilTemp7MinTime TIME,"
"soilTemp7Max FLOAT,"
"soilTemp7MaxTime TIME,"
"soilTemp7Avg FLOAT,"
"soilTemp8Min FLOAT,"
"soilTemp8MinTime TIME,"
"soilTemp8Max FLOAT,"
"soilTemp8MaxTime TIME,"
"soilTemp8Avg FLOAT,"
"soilMoisture1Min FLOAT,"
"soilMoisture1MinTime TIME,"
"soilMoisture1Max FLOAT,"
"soilMoisture1MaxTime TIME,"
"soilMoisture1Avg FLOAT,"
"soilMoisture2Min FLOAT,"
"soilMoisture2MinTime TIME,"
"soilMoisture2Max FLOAT,"
"soilMoisture2MaxTime TIME,"
"soilMoisture2Avg FLOAT,"
"soilMoisture3Min FLOAT,"
"soilMoisture3MinTime TIME,"
"soilMoisture3Max FLOAT,"
"soilMoisture3MaxTime TIME,"
"soilMoisture3Avg FLOAT,"
"soilMoisture4Min FLOAT,"
"soilMoisture4MinTime TIME,"
"soilMoisture4Max FLOAT,"
"soilMoisture4MaxTime TIME,"
"soilMoisture4Avg FLOAT,"
"soilMoisture5Min FLOAT,"
"soilMoisture5MinTime TIME,"
"soilMoisture5Max FLOAT,"
"soilMoisture5MaxTime TIME,"
"soilMoisture5Avg FLOAT,"
"soilMoisture6Min FLOAT,"
"soilMoisture6MinTime TIME,"
"soilMoisture6Max FLOAT,"
"soilMoisture6MaxTime TIME,"
"soilMoisture6Avg FLOAT,"
"soilMoisture7Min FLOAT,"
"soilMoisture7MinTime TIME,"
"soilMoisture7Max FLOAT,"
"soilMoisture7MaxTime TIME,"
"soilMoisture7Avg FLOAT,"
"soilMoisture8Min FLOAT,"
"soilMoisture8MinTime TIME,"
"soilMoisture8Max FLOAT,"
"soilMoisture8MaxTime TIME,"
"soilMoisture8Avg FLOAT,"
"leafTemperature1Min FLOAT,"
"leafTemperature1MinTime TIME,"
"leafTemperature1Max FLOAT,"
"leafTemperature1MaxTime TIME,"
"leafTemperature1Avg FLOAT,"
"leafTemperature2Min FLOAT,"
"leafTemperature2MinTime TIME,"
"leafTemperature2Max FLOAT,"
"leafTemperature2MaxTime TIME,"
"leafTemperature2Avg FLOAT,"
"leafTemperature3Min FLOAT,"
"leafTemperature3MinTime TIME,"
"leafTemperature3Max FLOAT,"
"leafTemperature3MaxTime TIME,"
"leafTemperature3Avg FLOAT,"
"leafTemperature4Min FLOAT,"
"leafTemperature4MinTime TIME,"
"leafTemperature4Max FLOAT,"
"leafTemperature4MaxTime TIME,"
"leafTemperature4Avg FLOAT,"
"leafTemperature5Min FLOAT,"
"leafTemperature5MinTime TIME,"
"leafTemperature5Max FLOAT,"
"leafTemperature5MaxTime TIME,"
"leafTemperature5Avg FLOAT,"
"leafTemperature6Min FLOAT,"
"leafTemperature6MinTime TIME,"
"leafTemperature6Max FLOAT,"
"leafTemperature6MaxTime TIME,"
"leafTemperature6Avg FLOAT,"
"leafTemperature7Min FLOAT,"
"leafTemperature7MinTime TIME,"
"leafTemperature7Max FLOAT,"
"leafTemperature7MaxTime TIME,"
"leafTemperature7Avg FLOAT,"
"leafTemperature8Min FLOAT,"
"leafTemperature8MinTime TIME,"
"leafTemperature8Max FLOAT,"
"leafTemperature8MaxTime TIME,"
"leafTemperature8Avg FLOAT,"
"leafWetness1Min FLOAT,"
"leafWetness1MinTime TIME,"
"leafWetness1Max FLOAT,"
"leafWetness1MaxTime TIME,"
"leafWetness1Avg FLOAT,"
"leafWetness2Min FLOAT,"
"leafWetness2MinTime TIME,"
"leafWetness2Max FLOAT,"
"leafWetness2MaxTime TIME,"
"leafWetness2Avg FLOAT,"
"leafWetness3Min FLOAT,"
"leafWetness3MinTime TIME,"
"leafWetness3Max FLOAT,"
"leafWetness3MaxTime TIME,"
"leafWetness3Avg FLOAT,"
"leafWetness4Min FLOAT,"
"leafWetness4MinTime TIME,"
"leafWetness4Max FLOAT,"
"leafWetness4MaxTime TIME,"
"leafWetness4Avg FLOAT,"
"leafWetness5Min FLOAT,"
"leafWetness5MinTime TIME,"
"leafWetness5Max FLOAT,"
"leafWetness5MaxTime TIME,"
"leafWetness5Avg FLOAT,"
"leafWetness6Min FLOAT,"
"leafWetness6MinTime TIME,"
"leafWetness6Max FLOAT,"
"leafWetness6MaxTime TIME,"
"leafWetness6Avg FLOAT,"
"leafWetness7Min FLOAT,"
"leafWetness7MinTime TIME,"
"leafWetness7Max FLOAT,"
"leafWetness7MaxTime TIME,"
"leafWetness7Avg FLOAT,"
"leafWetness8Min FLOAT,"
"leafWetness8MinTime TIME,"
"leafWetness8Max FLOAT,"
"leafWetness8MaxTime TIME,"
"leafWetness8Avg FLOAT,"
"summaryType ENUM" // 0 = daily, 1 = daytime, 2 = nighttime
");";
const char *update1to2 = "alter table dailyObs ADD COLUMN heatIndex FLOAT;"
"alter table dailyObs ADD COLUMN humidex FLOAT;"
"alter table dailyObs ADD COLUMN windChill FLOAT;"
"alter table hourlySummary ADD COLUMN heatIndexMin FLOAT;"
"alter table hourlySummary ADD COLUMN heatIndexMinTime FLOAT;"
"alter table hourlySummary ADD COLUMN heatIndexMax FLOAT;"
"alter table hourlySummary ADD COLUMN heatIndexMaxTime FLOAT;"
"alter table hourlySummary ADD COLUMN heatIndexAvg FLOAT;"
"alter table hourlySummary ADD COLUMN humidexMin FLOAT;"
"alter table hourlySummary ADD COLUMN humidexMinTime FLOAT;"
"alter table hourlySummary ADD COLUMN humidexMax FLOAT;"
"alter table hourlySummary ADD COLUMN humidexMaxTime FLOAT;"
"alter table hourlySummary ADD COLUMN humidexAvg FLOAT;"
"alter table hourlySummary ADD COLUMN windChillMin FLOAT;"
"alter table hourlySummary ADD COLUMN windChillMinTime FLOAT;"
"alter table hourlySummary ADD COLUMN windChillMax FLOAT;"
"alter table hourlySummary ADD COLUMN windChillMaxTime FLOAT;"
"alter table hourlySummary ADD COLUMN windChillAvg FLOAT;"
"alter table dailySummary ADD COLUMN heatIndexMin FLOAT;"
"alter table dailySummary ADD COLUMN heatIndexMinTime FLOAT;"
"alter table dailySummary ADD COLUMN heatIndexMax FLOAT;"
"alter table dailySummary ADD COLUMN heatIndexMaxTime FLOAT;"
"alter table dailySummary ADD COLUMN heatIndexAvg FLOAT;"
"alter table dailySummary ADD COLUMN humidexMin FLOAT;"
"alter table dailySummary ADD COLUMN humidexMinTime FLOAT;"
"alter table dailySummary ADD COLUMN humidexMax FLOAT;"
"alter table dailySummary ADD COLUMN humidexMaxTime FLOAT;"
"alter table dailySummary ADD COLUMN humidexAvg FLOAT;"
"alter table dailySummary ADD COLUMN windChillMin FLOAT;"
"alter table dailySummary ADD COLUMN windChillMinTime FLOAT;"
"alter table dailySummary ADD COLUMN windChillMax FLOAT;"
"alter table dailySummary ADD COLUMN windChillMaxTime FLOAT;"
"alter table dailySummary ADD COLUMN windChillAvg FLOAT;"
"update schema set version = 2;"
"VACUUM";
const char *update2to3 = "alter table dailyObs ADD COLUMN apparentTemp FLOAT;"
"alter table dailyObs ADD COLUMN cloudHeight FLOAT;"
"alter table hourlySummary ADD COLUMN apparentTempMin FLOAT;"
"alter table hourlySummary ADD COLUMN apparentTempMinTime FLOAT;"
"alter table hourlySummary ADD COLUMN apparentTempMax FLOAT;"
"alter table hourlySummary ADD COLUMN apparentTempMaxTime FLOAT;"
"alter table hourlySummary ADD COLUMN apparentTempAvg FLOAT;"
"alter table hourlySummary ADD COLUMN cloudHeightMin FLOAT;"
"alter table hourlySummary ADD COLUMN cloudHeightMinTime FLOAT;"
"alter table hourlySummary ADD COLUMN cloudHeightMax FLOAT;"
"alter table hourlySummary ADD COLUMN cloudHeightMaxTime FLOAT;"
"alter table hourlySummary ADD COLUMN cloudHeightAvg FLOAT;"
"alter table dailySummary ADD COLUMN apparentTempMin FLOAT;"
"alter table dailySummary ADD COLUMN apparentTempMinTime FLOAT;"
"alter table dailySummary ADD COLUMN apparentTempMax FLOAT;"
"alter table dailySummary ADD COLUMN apparentTempMaxTime FLOAT;"
"alter table dailySummary ADD COLUMN apparentTempAvg FLOAT;"
"alter table dailySummary ADD COLUMN cloudHeightMin FLOAT;"
"alter table dailySummary ADD COLUMN cloudHeightMinTime FLOAT;"
"alter table dailySummary ADD COLUMN cloudHeightMax FLOAT;"
"alter table dailySummary ADD COLUMN cloudHeightMaxTime FLOAT;"
"alter table dailySummary ADD COLUMN cloudHeightAvg FLOAT;"
"update schema set version = 3;"
"VACUUM";
const char *update3to4 = "alter table dailyObs ADD COLUMN windGustDir FLOAT;"
"alter table hourlySummary ADD COLUMN windGustDirAvg FLOAT;"
"alter table dailySummary ADD COLUMN windGustDirAvg FLOAT;"
"update schema set version = 4;"
"VACUUM";
const char *update4to5 = "create table windData ( time INTEGEER PRIMARY KEY,"
"speed FLOAT,"
"dirSin FLOAT,"
"dirCos FLOAT);"
"update schema set version = 5;"
"VACUUM";
const char *update5to6 = "create table rainData ( time INTEGEER PRIMARY KEY,"
"amount FLOAT);"
"update schema set version = 6;"
"VACUUM";
const char *update6to7 =
"alter table dailyObs ADD COLUMN rain24Hour FLOAT;"
"alter table hourlySummary ADD COLUMN rain24HourMin FLOAT;"
"alter table hourlySummary ADD COLUMN rain24HourMinTime TIME;"
"alter table hourlySummary ADD COLUMN rain24HourMax FLOAT;"
"alter table hourlySummary ADD COLUMN rain24HourMaxTime TIME;"
"alter table hourlySummary ADD COLUMN rain24HourAvg FLOAT;"
"alter table dailySummary ADD COLUMN rain24HourMin FLOAT;"
"alter table dailySummary ADD COLUMN rain24HourMinTime TIME;"
"alter table dailySummary ADD COLUMN rain24HourMax FLOAT;"
"alter table dailySummary ADD COLUMN rain24HourMaxTime TIME;"
"alter table dailySummary ADD COLUMN rain24HourAvg FLOAT;"
"update schema set version = 7;"
"VACUUM";
const char *update7to8 =
"alter table dailySummary ADD COLUMN summaryType ENUM;"
"update schema set version = 8;"
"update dailySummary set summaryType = 0;"
"VACUUM";
const char *update8to9 =
"alter table dailyObs ADD COLUMN instantRain FLOAT;"
"alter table hourlySummary ADD COLUMN instantRainMax FLOAT;"
"alter table hourlySummary ADD COLUMN instantRainMaxTime TIME;"
"alter table dailySummary ADD COLUMN instantRainMax FLOAT;"
"alter table dailySummary ADD COLUMN instantRainMaxTime TIME;"
"update schema set version = 9;"
"VACUUM";