1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
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
|
/* Db.c generated by valac 0.36.6, the Vala compiler
* generated from Db.vala, do not modify */
/* Copyright 2016 Software Freedom Conservancy Inc.
*
* This software is licensed under the GNU Lesser General Public License
* (version 2.1 or later). See the COPYING file in this distribution.
*/
#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#define _g_free0(var) (var = (g_free (var), NULL))
#define DB_TYPE_VERIFY_RESULT (db_verify_result_get_type ())
#define TYPE_DATABASE_TABLE (database_table_get_type ())
#define DATABASE_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATABASE_TABLE, DatabaseTable))
#define DATABASE_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATABASE_TABLE, DatabaseTableClass))
#define IS_DATABASE_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATABASE_TABLE))
#define IS_DATABASE_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATABASE_TABLE))
#define DATABASE_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATABASE_TABLE, DatabaseTableClass))
typedef struct _DatabaseTable DatabaseTable;
typedef struct _DatabaseTableClass DatabaseTableClass;
#define TYPE_VERSION_TABLE (version_table_get_type ())
#define VERSION_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_VERSION_TABLE, VersionTable))
#define VERSION_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_VERSION_TABLE, VersionTableClass))
#define IS_VERSION_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_VERSION_TABLE))
#define IS_VERSION_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_VERSION_TABLE))
#define VERSION_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_VERSION_TABLE, VersionTableClass))
typedef struct _VersionTable VersionTable;
typedef struct _VersionTableClass VersionTableClass;
#define _database_table_unref0(var) ((var == NULL) ? NULL : (var = (database_table_unref (var), NULL)))
#define TYPE_APPLICATION (application_get_type ())
#define APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_APPLICATION, Application))
#define APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_APPLICATION, ApplicationClass))
#define IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_APPLICATION))
#define IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_APPLICATION))
#define APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_APPLICATION, ApplicationClass))
typedef struct _Application Application;
typedef struct _ApplicationClass ApplicationClass;
#define _application_unref0(var) ((var == NULL) ? NULL : (var = (application_unref (var), NULL)))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
typedef enum {
DB_VERIFY_RESULT_OK,
DB_VERIFY_RESULT_FUTURE_VERSION,
DB_VERIFY_RESULT_UPGRADE_ERROR,
DB_VERIFY_RESULT_NO_UPGRADE_AVAILABLE
} DbVerifyResult;
extern gchar* db_filename;
gchar* db_filename = NULL;
#define DB_IN_MEMORY_NAME ":memory:"
void db_preconfigure (GFile* db_file);
void db_init (GError** error);
void database_table_init (const gchar* filename);
void db_terminate (void);
void database_table_terminate (void);
GType db_verify_result_get_type (void) G_GNUC_CONST;
DbVerifyResult db_verify_database (gchar* * app_version, gint* schema_version);
gpointer database_table_ref (gpointer instance);
void database_table_unref (gpointer instance);
GParamSpec* param_spec_database_table (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void value_set_database_table (GValue* value, gpointer v_object);
void value_take_database_table (GValue* value, gpointer v_object);
gpointer value_get_database_table (const GValue* value);
GType database_table_get_type (void) G_GNUC_CONST;
GType version_table_get_type (void) G_GNUC_CONST;
VersionTable* version_table_get_instance (void);
gint version_table_get_version (VersionTable* self, gchar* * app_version);
#define DATABASE_TABLE_SCHEMA_VERSION 20
#define RESOURCES_APP_VERSION _VERSION
void version_table_set_version (VersionTable* self, gint version, const gchar* app_version, const gchar* user_data);
DbVerifyResult db_upgrade_database (gint input_version);
gboolean database_table_has_column (const gchar* table_name, const gchar* column_name);
gboolean database_table_add_column (const gchar* table_name, const gchar* column_name, const gchar* column_constraints);
gboolean database_table_has_table (const gchar* table_name);
gboolean database_table_ensure_column (const gchar* table_name, const gchar* column_name, const gchar* column_constraints, const gchar* upgrade_msg);
void tag_table_upgrade_for_htags (void);
void gsettings_configuration_engine_run_gsettings_migrator (void);
gpointer application_ref (gpointer instance);
void application_unref (gpointer instance);
GParamSpec* param_spec_application (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void value_set_application (GValue* value, gpointer v_object);
void value_take_application (GValue* value, gpointer v_object);
gpointer value_get_application (const GValue* value);
GType application_get_type (void) G_GNUC_CONST;
Application* application_get_instance (void);
void application_set_raw_thumbs_fix_required (Application* self, gboolean should_fixup);
void version_table_update_version (VersionTable* self, gint version, const gchar* app_version);
void db_preconfigure (GFile* db_file) {
gchar* _tmp0_ = NULL;
GFile* _tmp1_;
gchar* _tmp5_;
#line 14 "/home/jens/Source/shotwell/src/db/Db.vala"
g_return_if_fail ((db_file == NULL) || G_IS_FILE (db_file));
#line 15 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp1_ = db_file;
#line 15 "/home/jens/Source/shotwell/src/db/Db.vala"
if (_tmp1_ != NULL) {
#line 118 "Db.c"
GFile* _tmp2_;
gchar* _tmp3_;
#line 15 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp2_ = db_file;
#line 15 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp3_ = g_file_get_path (_tmp2_);
#line 15 "/home/jens/Source/shotwell/src/db/Db.vala"
_g_free0 (_tmp0_);
#line 15 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp0_ = _tmp3_;
#line 129 "Db.c"
} else {
gchar* _tmp4_;
#line 15 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp4_ = g_strdup (DB_IN_MEMORY_NAME);
#line 15 "/home/jens/Source/shotwell/src/db/Db.vala"
_g_free0 (_tmp0_);
#line 15 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp0_ = _tmp4_;
#line 138 "Db.c"
}
#line 15 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp5_ = g_strdup (_tmp0_);
#line 15 "/home/jens/Source/shotwell/src/db/Db.vala"
_g_free0 (db_filename);
#line 15 "/home/jens/Source/shotwell/src/db/Db.vala"
db_filename = _tmp5_;
#line 14 "/home/jens/Source/shotwell/src/db/Db.vala"
_g_free0 (_tmp0_);
#line 148 "Db.c"
}
void db_init (GError** error) {
const gchar* _tmp0_;
const gchar* _tmp1_;
#line 19 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp0_ = db_filename;
#line 19 "/home/jens/Source/shotwell/src/db/Db.vala"
_vala_assert (_tmp0_ != NULL, "filename != null");
#line 21 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp1_ = db_filename;
#line 21 "/home/jens/Source/shotwell/src/db/Db.vala"
database_table_init (_tmp1_);
#line 163 "Db.c"
}
void db_terminate (void) {
#line 25 "/home/jens/Source/shotwell/src/db/Db.vala"
database_table_terminate ();
#line 170 "Db.c"
}
GType db_verify_result_get_type (void) {
static volatile gsize db_verify_result_type_id__volatile = 0;
if (g_once_init_enter (&db_verify_result_type_id__volatile)) {
static const GEnumValue values[] = {{DB_VERIFY_RESULT_OK, "DB_VERIFY_RESULT_OK", "ok"}, {DB_VERIFY_RESULT_FUTURE_VERSION, "DB_VERIFY_RESULT_FUTURE_VERSION", "future-version"}, {DB_VERIFY_RESULT_UPGRADE_ERROR, "DB_VERIFY_RESULT_UPGRADE_ERROR", "upgrade-error"}, {DB_VERIFY_RESULT_NO_UPGRADE_AVAILABLE, "DB_VERIFY_RESULT_NO_UPGRADE_AVAILABLE", "no-upgrade-available"}, {0, NULL, NULL}};
GType db_verify_result_type_id;
db_verify_result_type_id = g_enum_register_static ("DbVerifyResult", values);
g_once_init_leave (&db_verify_result_type_id__volatile, db_verify_result_type_id);
}
return db_verify_result_type_id__volatile;
}
DbVerifyResult db_verify_database (gchar* * app_version, gint* schema_version) {
gchar* _vala_app_version = NULL;
gint _vala_schema_version = 0;
DbVerifyResult result = 0;
VersionTable* version_table = NULL;
VersionTable* _tmp0_;
VersionTable* _tmp1_;
gchar* _tmp2_ = NULL;
gint _tmp3_;
gint _tmp4_;
gint _tmp7_;
#line 36 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp0_ = version_table_get_instance ();
#line 36 "/home/jens/Source/shotwell/src/db/Db.vala"
version_table = _tmp0_;
#line 37 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp1_ = version_table;
#line 37 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp3_ = version_table_get_version (_tmp1_, &_tmp2_);
#line 37 "/home/jens/Source/shotwell/src/db/Db.vala"
_g_free0 (_vala_app_version);
#line 37 "/home/jens/Source/shotwell/src/db/Db.vala"
_vala_app_version = _tmp2_;
#line 37 "/home/jens/Source/shotwell/src/db/Db.vala"
_vala_schema_version = _tmp3_;
#line 39 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp4_ = _vala_schema_version;
#line 39 "/home/jens/Source/shotwell/src/db/Db.vala"
if (_tmp4_ >= 0) {
#line 215 "Db.c"
gint _tmp5_;
const gchar* _tmp6_;
#line 40 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp5_ = _vala_schema_version;
#line 40 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp6_ = _vala_app_version;
#line 40 "/home/jens/Source/shotwell/src/db/Db.vala"
g_debug ("Db.vala:40: Database schema version %d created by app version %s", _tmp5_, _tmp6_);
#line 224 "Db.c"
}
#line 42 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp7_ = _vala_schema_version;
#line 42 "/home/jens/Source/shotwell/src/db/Db.vala"
if (_tmp7_ == -1) {
#line 230 "Db.c"
VersionTable* _tmp8_;
gchar* _tmp9_;
#line 44 "/home/jens/Source/shotwell/src/db/Db.vala"
g_debug ("Db.vala:44: Creating database schema version %d for app version %s", DATABASE_TABLE_SCHEMA_VERSION, RESOURCES_APP_VERSION);
#line 46 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp8_ = version_table;
#line 46 "/home/jens/Source/shotwell/src/db/Db.vala"
version_table_set_version (_tmp8_, DATABASE_TABLE_SCHEMA_VERSION, RESOURCES_APP_VERSION, NULL);
#line 47 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp9_ = g_strdup (RESOURCES_APP_VERSION);
#line 47 "/home/jens/Source/shotwell/src/db/Db.vala"
_g_free0 (_vala_app_version);
#line 47 "/home/jens/Source/shotwell/src/db/Db.vala"
_vala_app_version = _tmp9_;
#line 48 "/home/jens/Source/shotwell/src/db/Db.vala"
_vala_schema_version = DATABASE_TABLE_SCHEMA_VERSION;
#line 247 "Db.c"
} else {
gint _tmp10_;
#line 49 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp10_ = _vala_schema_version;
#line 49 "/home/jens/Source/shotwell/src/db/Db.vala"
if (_tmp10_ > DATABASE_TABLE_SCHEMA_VERSION) {
#line 51 "/home/jens/Source/shotwell/src/db/Db.vala"
result = DB_VERIFY_RESULT_FUTURE_VERSION;
#line 51 "/home/jens/Source/shotwell/src/db/Db.vala"
_database_table_unref0 (version_table);
#line 51 "/home/jens/Source/shotwell/src/db/Db.vala"
if (app_version) {
#line 51 "/home/jens/Source/shotwell/src/db/Db.vala"
*app_version = _vala_app_version;
#line 262 "Db.c"
} else {
#line 51 "/home/jens/Source/shotwell/src/db/Db.vala"
_g_free0 (_vala_app_version);
#line 266 "Db.c"
}
#line 51 "/home/jens/Source/shotwell/src/db/Db.vala"
if (schema_version) {
#line 51 "/home/jens/Source/shotwell/src/db/Db.vala"
*schema_version = _vala_schema_version;
#line 272 "Db.c"
}
#line 51 "/home/jens/Source/shotwell/src/db/Db.vala"
return result;
#line 276 "Db.c"
} else {
gint _tmp11_;
#line 52 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp11_ = _vala_schema_version;
#line 52 "/home/jens/Source/shotwell/src/db/Db.vala"
if (_tmp11_ < DATABASE_TABLE_SCHEMA_VERSION) {
#line 283 "Db.c"
DbVerifyResult _result_ = 0;
gint _tmp12_;
DbVerifyResult _tmp13_;
DbVerifyResult _tmp14_;
#line 54 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp12_ = _vala_schema_version;
#line 54 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp13_ = db_upgrade_database (_tmp12_);
#line 54 "/home/jens/Source/shotwell/src/db/Db.vala"
_result_ = _tmp13_;
#line 55 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp14_ = _result_;
#line 55 "/home/jens/Source/shotwell/src/db/Db.vala"
if (_tmp14_ != DB_VERIFY_RESULT_OK) {
#line 56 "/home/jens/Source/shotwell/src/db/Db.vala"
result = _result_;
#line 56 "/home/jens/Source/shotwell/src/db/Db.vala"
_database_table_unref0 (version_table);
#line 56 "/home/jens/Source/shotwell/src/db/Db.vala"
if (app_version) {
#line 56 "/home/jens/Source/shotwell/src/db/Db.vala"
*app_version = _vala_app_version;
#line 306 "Db.c"
} else {
#line 56 "/home/jens/Source/shotwell/src/db/Db.vala"
_g_free0 (_vala_app_version);
#line 310 "Db.c"
}
#line 56 "/home/jens/Source/shotwell/src/db/Db.vala"
if (schema_version) {
#line 56 "/home/jens/Source/shotwell/src/db/Db.vala"
*schema_version = _vala_schema_version;
#line 316 "Db.c"
}
#line 56 "/home/jens/Source/shotwell/src/db/Db.vala"
return result;
#line 320 "Db.c"
}
}
}
}
#line 59 "/home/jens/Source/shotwell/src/db/Db.vala"
result = DB_VERIFY_RESULT_OK;
#line 59 "/home/jens/Source/shotwell/src/db/Db.vala"
_database_table_unref0 (version_table);
#line 59 "/home/jens/Source/shotwell/src/db/Db.vala"
if (app_version) {
#line 59 "/home/jens/Source/shotwell/src/db/Db.vala"
*app_version = _vala_app_version;
#line 333 "Db.c"
} else {
#line 59 "/home/jens/Source/shotwell/src/db/Db.vala"
_g_free0 (_vala_app_version);
#line 337 "Db.c"
}
#line 59 "/home/jens/Source/shotwell/src/db/Db.vala"
if (schema_version) {
#line 59 "/home/jens/Source/shotwell/src/db/Db.vala"
*schema_version = _vala_schema_version;
#line 343 "Db.c"
}
#line 59 "/home/jens/Source/shotwell/src/db/Db.vala"
return result;
#line 347 "Db.c"
}
DbVerifyResult db_upgrade_database (gint input_version) {
DbVerifyResult result = 0;
gint _tmp0_;
gint version = 0;
gint _tmp1_;
gint _tmp2_;
gint _tmp3_;
gboolean _tmp4_;
gboolean _tmp6_;
gboolean _tmp8_;
gboolean _tmp10_;
gboolean _tmp12_;
gboolean _tmp14_;
gboolean _tmp16_;
gboolean _tmp18_;
gboolean _tmp20_ = FALSE;
gboolean _tmp21_;
gboolean _tmp24_;
gboolean _tmp26_;
gboolean _tmp27_;
gboolean _tmp29_;
gboolean _tmp31_;
gboolean _tmp33_;
gint _tmp35_;
gint _tmp36_;
gboolean _tmp37_;
gboolean _tmp39_;
gboolean _tmp40_;
gboolean _tmp42_;
gint _tmp44_;
gint _tmp47_;
VersionTable* _tmp48_;
VersionTable* _tmp49_;
gint _tmp50_;
gint _tmp51_;
#line 63 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp0_ = input_version;
#line 63 "/home/jens/Source/shotwell/src/db/Db.vala"
_vala_assert (_tmp0_ < DATABASE_TABLE_SCHEMA_VERSION, "input_version < DatabaseTable.SCHEMA_VERSION");
#line 65 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp1_ = input_version;
#line 65 "/home/jens/Source/shotwell/src/db/Db.vala"
version = _tmp1_;
#line 68 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp2_ = version;
#line 68 "/home/jens/Source/shotwell/src/db/Db.vala"
if (_tmp2_ == 1) {
#line 69 "/home/jens/Source/shotwell/src/db/Db.vala"
result = DB_VERIFY_RESULT_NO_UPGRADE_AVAILABLE;
#line 69 "/home/jens/Source/shotwell/src/db/Db.vala"
return result;
#line 402 "Db.c"
}
#line 71 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp3_ = version;
#line 71 "/home/jens/Source/shotwell/src/db/Db.vala"
g_message ("Db.vala:71: Upgrading database from schema version %d to %d", _tmp3_, DATABASE_TABLE_SCHEMA_VERSION);
#line 83 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp4_ = database_table_has_column ("PhotoTable", "flags");
#line 83 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp4_) {
#line 412 "Db.c"
gboolean _tmp5_;
#line 84 "/home/jens/Source/shotwell/src/db/Db.vala"
g_message ("Db.vala:84: upgrade_database: adding flags column to PhotoTable");
#line 85 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp5_ = database_table_add_column ("PhotoTable", "flags", "INTEGER DEFAULT 0");
#line 85 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp5_) {
#line 86 "/home/jens/Source/shotwell/src/db/Db.vala"
result = DB_VERIFY_RESULT_UPGRADE_ERROR;
#line 86 "/home/jens/Source/shotwell/src/db/Db.vala"
return result;
#line 424 "Db.c"
}
}
#line 89 "/home/jens/Source/shotwell/src/db/Db.vala"
version = 3;
#line 100 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp6_ = database_table_has_column ("PhotoTable", "file_format");
#line 100 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp6_) {
#line 433 "Db.c"
gboolean _tmp7_;
#line 101 "/home/jens/Source/shotwell/src/db/Db.vala"
g_message ("Db.vala:101: upgrade_database: adding file_format column to PhotoTable");
#line 102 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp7_ = database_table_add_column ("PhotoTable", "file_format", "INTEGER DEFAULT 0");
#line 102 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp7_) {
#line 103 "/home/jens/Source/shotwell/src/db/Db.vala"
result = DB_VERIFY_RESULT_UPGRADE_ERROR;
#line 103 "/home/jens/Source/shotwell/src/db/Db.vala"
return result;
#line 445 "Db.c"
}
}
#line 106 "/home/jens/Source/shotwell/src/db/Db.vala"
version = 4;
#line 113 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp8_ = database_table_has_column ("PhotoTable", "title");
#line 113 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp8_) {
#line 454 "Db.c"
gboolean _tmp9_;
#line 114 "/home/jens/Source/shotwell/src/db/Db.vala"
g_message ("Db.vala:114: upgrade_database: adding title column to PhotoTable");
#line 115 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp9_ = database_table_add_column ("PhotoTable", "title", "TEXT");
#line 115 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp9_) {
#line 116 "/home/jens/Source/shotwell/src/db/Db.vala"
result = DB_VERIFY_RESULT_UPGRADE_ERROR;
#line 116 "/home/jens/Source/shotwell/src/db/Db.vala"
return result;
#line 466 "Db.c"
}
}
#line 119 "/home/jens/Source/shotwell/src/db/Db.vala"
version = 5;
#line 126 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp10_ = database_table_has_column ("PhotoTable", "backlinks");
#line 126 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp10_) {
#line 475 "Db.c"
gboolean _tmp11_;
#line 127 "/home/jens/Source/shotwell/src/db/Db.vala"
g_message ("Db.vala:127: upgrade_database: adding backlinks column to PhotoTable");
#line 128 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp11_ = database_table_add_column ("PhotoTable", "backlinks", "TEXT");
#line 128 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp11_) {
#line 129 "/home/jens/Source/shotwell/src/db/Db.vala"
result = DB_VERIFY_RESULT_UPGRADE_ERROR;
#line 129 "/home/jens/Source/shotwell/src/db/Db.vala"
return result;
#line 487 "Db.c"
}
}
#line 132 "/home/jens/Source/shotwell/src/db/Db.vala"
version = 6;
#line 146 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp12_ = database_table_has_column ("PhotoTable", "time_reimported");
#line 146 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp12_) {
#line 496 "Db.c"
gboolean _tmp13_;
#line 147 "/home/jens/Source/shotwell/src/db/Db.vala"
g_message ("Db.vala:147: upgrade_database: adding time_reimported column to PhotoT" \
"able");
#line 148 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp13_ = database_table_add_column ("PhotoTable", "time_reimported", "INTEGER");
#line 148 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp13_) {
#line 149 "/home/jens/Source/shotwell/src/db/Db.vala"
result = DB_VERIFY_RESULT_UPGRADE_ERROR;
#line 149 "/home/jens/Source/shotwell/src/db/Db.vala"
return result;
#line 508 "Db.c"
}
}
#line 152 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp14_ = database_table_has_column ("PhotoTable", "editable_id");
#line 152 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp14_) {
#line 515 "Db.c"
gboolean _tmp15_;
#line 153 "/home/jens/Source/shotwell/src/db/Db.vala"
g_message ("Db.vala:153: upgrade_database: adding editable_id column to PhotoTable");
#line 154 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp15_ = database_table_add_column ("PhotoTable", "editable_id", "INTEGER DEFAULT -1");
#line 154 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp15_) {
#line 155 "/home/jens/Source/shotwell/src/db/Db.vala"
result = DB_VERIFY_RESULT_UPGRADE_ERROR;
#line 155 "/home/jens/Source/shotwell/src/db/Db.vala"
return result;
#line 527 "Db.c"
}
}
#line 158 "/home/jens/Source/shotwell/src/db/Db.vala"
version = 7;
#line 170 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp16_ = database_table_has_column ("PhotoTable", "rating");
#line 170 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp16_) {
#line 536 "Db.c"
gboolean _tmp17_;
#line 171 "/home/jens/Source/shotwell/src/db/Db.vala"
g_message ("Db.vala:171: upgrade_database: adding rating column to PhotoTable");
#line 172 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp17_ = database_table_add_column ("PhotoTable", "rating", "INTEGER DEFAULT 0");
#line 172 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp17_) {
#line 173 "/home/jens/Source/shotwell/src/db/Db.vala"
result = DB_VERIFY_RESULT_UPGRADE_ERROR;
#line 173 "/home/jens/Source/shotwell/src/db/Db.vala"
return result;
#line 548 "Db.c"
}
}
#line 182 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp18_ = database_table_has_column ("PhotoTable", "metadata_dirty");
#line 182 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp18_) {
#line 555 "Db.c"
gboolean _tmp19_;
#line 183 "/home/jens/Source/shotwell/src/db/Db.vala"
g_message ("Db.vala:183: upgrade_database: adding metadata_dirty column to PhotoTa" \
"ble");
#line 184 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp19_ = database_table_add_column ("PhotoTable", "metadata_dirty", "INTEGER DEFAULT 1");
#line 184 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp19_) {
#line 185 "/home/jens/Source/shotwell/src/db/Db.vala"
result = DB_VERIFY_RESULT_UPGRADE_ERROR;
#line 185 "/home/jens/Source/shotwell/src/db/Db.vala"
return result;
#line 567 "Db.c"
}
}
#line 188 "/home/jens/Source/shotwell/src/db/Db.vala"
version = 9;
#line 195 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp21_ = database_table_has_table ("VideoTable");
#line 195 "/home/jens/Source/shotwell/src/db/Db.vala"
if (_tmp21_) {
#line 576 "Db.c"
gboolean _tmp22_;
#line 195 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp22_ = database_table_has_column ("VideoTable", "flags");
#line 195 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp20_ = !_tmp22_;
#line 582 "Db.c"
} else {
#line 195 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp20_ = FALSE;
#line 586 "Db.c"
}
#line 195 "/home/jens/Source/shotwell/src/db/Db.vala"
if (_tmp20_) {
#line 590 "Db.c"
gboolean _tmp23_;
#line 196 "/home/jens/Source/shotwell/src/db/Db.vala"
g_message ("Db.vala:196: upgrade_database: adding flags column to VideoTable");
#line 197 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp23_ = database_table_add_column ("VideoTable", "flags", "INTEGER DEFAULT 0");
#line 197 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp23_) {
#line 198 "/home/jens/Source/shotwell/src/db/Db.vala"
result = DB_VERIFY_RESULT_UPGRADE_ERROR;
#line 198 "/home/jens/Source/shotwell/src/db/Db.vala"
return result;
#line 602 "Db.c"
}
}
#line 201 "/home/jens/Source/shotwell/src/db/Db.vala"
version = 10;
#line 208 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp24_ = database_table_has_column ("EventTable", "primary_source_id");
#line 208 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp24_) {
#line 611 "Db.c"
gboolean _tmp25_;
#line 209 "/home/jens/Source/shotwell/src/db/Db.vala"
g_message ("Db.vala:209: upgrade_database: adding primary_source_id column to Even" \
"tTable");
#line 210 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp25_ = database_table_add_column ("EventTable", "primary_source_id", "TEXT");
#line 210 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp25_) {
#line 211 "/home/jens/Source/shotwell/src/db/Db.vala"
result = DB_VERIFY_RESULT_UPGRADE_ERROR;
#line 211 "/home/jens/Source/shotwell/src/db/Db.vala"
return result;
#line 623 "Db.c"
}
}
#line 214 "/home/jens/Source/shotwell/src/db/Db.vala"
version = 11;
#line 221 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp26_ = database_table_ensure_column ("TombstoneTable", "reason", "INTEGER DEFAULT 0", "upgrade_database: adding reason column to TombstoneTable");
#line 221 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp26_) {
#line 223 "/home/jens/Source/shotwell/src/db/Db.vala"
result = DB_VERIFY_RESULT_UPGRADE_ERROR;
#line 223 "/home/jens/Source/shotwell/src/db/Db.vala"
return result;
#line 636 "Db.c"
}
#line 226 "/home/jens/Source/shotwell/src/db/Db.vala"
version = 12;
#line 233 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp27_ = database_table_has_column ("PhotoTable", "developer");
#line 233 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp27_) {
#line 644 "Db.c"
gboolean _tmp28_;
#line 234 "/home/jens/Source/shotwell/src/db/Db.vala"
g_message ("Db.vala:234: upgrade_database: adding developer column to PhotoTable");
#line 235 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp28_ = database_table_add_column ("PhotoTable", "developer", "TEXT");
#line 235 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp28_) {
#line 236 "/home/jens/Source/shotwell/src/db/Db.vala"
result = DB_VERIFY_RESULT_UPGRADE_ERROR;
#line 236 "/home/jens/Source/shotwell/src/db/Db.vala"
return result;
#line 656 "Db.c"
}
}
#line 239 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp29_ = database_table_has_column ("PhotoTable", "develop_shotwell_id");
#line 239 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp29_) {
#line 663 "Db.c"
gboolean _tmp30_;
#line 240 "/home/jens/Source/shotwell/src/db/Db.vala"
g_message ("Db.vala:240: upgrade_database: adding develop_shotwell_id column to Ph" \
"otoTable");
#line 241 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp30_ = database_table_add_column ("PhotoTable", "develop_shotwell_id", "INTEGER DEFAULT -1");
#line 241 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp30_) {
#line 242 "/home/jens/Source/shotwell/src/db/Db.vala"
result = DB_VERIFY_RESULT_UPGRADE_ERROR;
#line 242 "/home/jens/Source/shotwell/src/db/Db.vala"
return result;
#line 675 "Db.c"
}
}
#line 245 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp31_ = database_table_has_column ("PhotoTable", "develop_camera_id");
#line 245 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp31_) {
#line 682 "Db.c"
gboolean _tmp32_;
#line 246 "/home/jens/Source/shotwell/src/db/Db.vala"
g_message ("Db.vala:246: upgrade_database: adding develop_camera_id column to Phot" \
"oTable");
#line 247 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp32_ = database_table_add_column ("PhotoTable", "develop_camera_id", "INTEGER DEFAULT -1");
#line 247 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp32_) {
#line 248 "/home/jens/Source/shotwell/src/db/Db.vala"
result = DB_VERIFY_RESULT_UPGRADE_ERROR;
#line 248 "/home/jens/Source/shotwell/src/db/Db.vala"
return result;
#line 694 "Db.c"
}
}
#line 251 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp33_ = database_table_has_column ("PhotoTable", "develop_embedded_id");
#line 251 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp33_) {
#line 701 "Db.c"
gboolean _tmp34_;
#line 252 "/home/jens/Source/shotwell/src/db/Db.vala"
g_message ("Db.vala:252: upgrade_database: adding develop_embedded_id column to Ph" \
"otoTable");
#line 253 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp34_ = database_table_add_column ("PhotoTable", "develop_embedded_id", "INTEGER DEFAULT -1");
#line 253 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp34_) {
#line 254 "/home/jens/Source/shotwell/src/db/Db.vala"
result = DB_VERIFY_RESULT_UPGRADE_ERROR;
#line 254 "/home/jens/Source/shotwell/src/db/Db.vala"
return result;
#line 713 "Db.c"
}
}
#line 257 "/home/jens/Source/shotwell/src/db/Db.vala"
version = 13;
#line 264 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp35_ = input_version;
#line 264 "/home/jens/Source/shotwell/src/db/Db.vala"
if (_tmp35_ < 14) {
#line 265 "/home/jens/Source/shotwell/src/db/Db.vala"
tag_table_upgrade_for_htags ();
#line 724 "Db.c"
}
#line 267 "/home/jens/Source/shotwell/src/db/Db.vala"
version = 14;
#line 279 "/home/jens/Source/shotwell/src/db/Db.vala"
version = 15;
#line 289 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp36_ = input_version;
#line 289 "/home/jens/Source/shotwell/src/db/Db.vala"
if (_tmp36_ < 16) {
#line 292 "/home/jens/Source/shotwell/src/db/Db.vala"
gsettings_configuration_engine_run_gsettings_migrator ();
#line 736 "Db.c"
}
#line 295 "/home/jens/Source/shotwell/src/db/Db.vala"
version = 16;
#line 302 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp37_ = database_table_has_column ("PhotoTable", "comment");
#line 302 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp37_) {
#line 744 "Db.c"
gboolean _tmp38_;
#line 303 "/home/jens/Source/shotwell/src/db/Db.vala"
g_message ("Db.vala:303: upgrade_database: adding comment column to PhotoTable");
#line 304 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp38_ = database_table_add_column ("PhotoTable", "comment", "TEXT");
#line 304 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp38_) {
#line 305 "/home/jens/Source/shotwell/src/db/Db.vala"
result = DB_VERIFY_RESULT_UPGRADE_ERROR;
#line 305 "/home/jens/Source/shotwell/src/db/Db.vala"
return result;
#line 756 "Db.c"
}
}
#line 307 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp39_ = database_table_has_table ("VideoTable");
#line 307 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp40_ = database_table_has_column ("VideoTable", "comment");
#line 307 "/home/jens/Source/shotwell/src/db/Db.vala"
if (_tmp39_ & (!_tmp40_)) {
#line 765 "Db.c"
gboolean _tmp41_;
#line 308 "/home/jens/Source/shotwell/src/db/Db.vala"
g_message ("Db.vala:308: upgrade_database: adding comment column to VideoTable");
#line 309 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp41_ = database_table_add_column ("VideoTable", "comment", "TEXT");
#line 309 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp41_) {
#line 310 "/home/jens/Source/shotwell/src/db/Db.vala"
result = DB_VERIFY_RESULT_UPGRADE_ERROR;
#line 310 "/home/jens/Source/shotwell/src/db/Db.vala"
return result;
#line 777 "Db.c"
}
}
#line 313 "/home/jens/Source/shotwell/src/db/Db.vala"
version = 17;
#line 320 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp42_ = database_table_has_column ("EventTable", "comment");
#line 320 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp42_) {
#line 786 "Db.c"
gboolean _tmp43_;
#line 321 "/home/jens/Source/shotwell/src/db/Db.vala"
g_message ("Db.vala:321: upgrade_database: adding comment column to EventTable");
#line 322 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp43_ = database_table_add_column ("EventTable", "comment", "TEXT");
#line 322 "/home/jens/Source/shotwell/src/db/Db.vala"
if (!_tmp43_) {
#line 323 "/home/jens/Source/shotwell/src/db/Db.vala"
result = DB_VERIFY_RESULT_UPGRADE_ERROR;
#line 323 "/home/jens/Source/shotwell/src/db/Db.vala"
return result;
#line 798 "Db.c"
}
}
#line 326 "/home/jens/Source/shotwell/src/db/Db.vala"
version = 18;
#line 337 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp44_ = input_version;
#line 337 "/home/jens/Source/shotwell/src/db/Db.vala"
if (_tmp44_ < 19) {
#line 807 "Db.c"
Application* _tmp45_;
Application* _tmp46_;
#line 338 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp45_ = application_get_instance ();
#line 338 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp46_ = _tmp45_;
#line 338 "/home/jens/Source/shotwell/src/db/Db.vala"
application_set_raw_thumbs_fix_required (_tmp46_, TRUE);
#line 338 "/home/jens/Source/shotwell/src/db/Db.vala"
_application_unref0 (_tmp46_);
#line 818 "Db.c"
}
#line 341 "/home/jens/Source/shotwell/src/db/Db.vala"
version = 19;
#line 351 "/home/jens/Source/shotwell/src/db/Db.vala"
version = 20;
#line 357 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp47_ = version;
#line 357 "/home/jens/Source/shotwell/src/db/Db.vala"
_vala_assert (_tmp47_ == DATABASE_TABLE_SCHEMA_VERSION, "version == DatabaseTable.SCHEMA_VERSION");
#line 358 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp48_ = version_table_get_instance ();
#line 358 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp49_ = _tmp48_;
#line 358 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp50_ = version;
#line 358 "/home/jens/Source/shotwell/src/db/Db.vala"
version_table_update_version (_tmp49_, _tmp50_, RESOURCES_APP_VERSION);
#line 358 "/home/jens/Source/shotwell/src/db/Db.vala"
_database_table_unref0 (_tmp49_);
#line 360 "/home/jens/Source/shotwell/src/db/Db.vala"
_tmp51_ = version;
#line 360 "/home/jens/Source/shotwell/src/db/Db.vala"
g_message ("Db.vala:360: Database upgrade to schema version %d successful", _tmp51_);
#line 362 "/home/jens/Source/shotwell/src/db/Db.vala"
result = DB_VERIFY_RESULT_OK;
#line 362 "/home/jens/Source/shotwell/src/db/Db.vala"
return result;
#line 846 "Db.c"
}
|