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

#ifndef BDEP_PROJECT_ODB_HXX
#define BDEP_PROJECT_ODB_HXX

// Begin prologue.
//
#include <bdep/wrapper-traits.hxx>
#include <bdep/value-traits.hxx>
//
// End prologue.

#include <odb/version.hxx>

#if (ODB_VERSION != 20476UL)
#error ODB runtime version mismatch
#endif

#include <odb/pre.hxx>

#include <bdep/project.hxx>

#include <memory>
#include <cstddef>
#include <utility>

#include <odb/core.hxx>
#include <odb/traits.hxx>
#include <odb/callback.hxx>
#include <odb/wrapper-traits.hxx>
#include <odb/pointer-traits.hxx>
#include <odb/container-traits.hxx>
#include <odb/session.hxx>
#include <odb/cache-traits.hxx>
#include <odb/result.hxx>
#include <odb/simple-object-result.hxx>
#include <odb/view-image.hxx>
#include <odb/view-result.hxx>

#include <odb/details/unused.hxx>
#include <odb/details/shared-ptr.hxx>

namespace odb
{
  // configuration
  //
  template <>
  struct class_traits< ::bdep::configuration >
  {
    static const class_kind kind = class_object;
  };

  template <>
  class access::object_traits< ::bdep::configuration >
  {
    public:
    typedef ::bdep::configuration object_type;
    typedef ::std::shared_ptr< ::bdep::configuration > pointer_type;
    typedef odb::pointer_traits<pointer_type> pointer_traits;

    static const bool polymorphic = false;

    typedef ::bdep::optional_uint64_t id_type;

    static const bool auto_id = true;

    static const bool abstract = false;

    static id_type
    id (const object_type&);

    typedef
    odb::pointer_cache_traits<
      pointer_type,
      odb::session >
    pointer_cache_traits;

    typedef
    odb::reference_cache_traits<
      object_type,
      odb::session >
    reference_cache_traits;

    static void
    callback (database&, object_type&, callback_event);

    static void
    callback (database&, const object_type&, callback_event);
  };

  // configuration_count
  //
  template <>
  struct class_traits< ::bdep::configuration_count >
  {
    static const class_kind kind = class_view;
  };

  template <>
  class access::view_traits< ::bdep::configuration_count >
  {
    public:
    typedef ::bdep::configuration_count view_type;
    typedef ::bdep::configuration_count* pointer_type;

    static void
    callback (database&, view_type&, callback_event);
  };
}

#include <odb/details/buffer.hxx>

#include <odb/sqlite/version.hxx>
#include <odb/sqlite/forward.hxx>
#include <odb/sqlite/binding.hxx>
#include <odb/sqlite/sqlite-types.hxx>
#include <odb/sqlite/query.hxx>

namespace odb
{
  // package_state
  //
  template <>
  class access::composite_value_traits< ::bdep::package_state, id_sqlite >
  {
    public:
    typedef ::bdep::package_state value_type;

    struct image_type
    {
      // name
      //
      details::buffer name_value;
      std::size_t name_size;
      bool name_null;
    };

    static bool
    grow (image_type&,
          bool*);

    static void
    bind (sqlite::bind*,
          image_type&,
          sqlite::statement_kind);

    static bool
    init (image_type&,
          const value_type&,
          sqlite::statement_kind);

    static void
    init (value_type&,
          const image_type&,
          database*);

    static bool
    get_null (const image_type&);

    static void
    set_null (image_type&,
              sqlite::statement_kind);

    static const std::size_t column_count = 1UL;
  };

  // configuration
  //
  template <typename A>
  struct query_columns< ::bdep::configuration, id_sqlite, A >
  {
    // id
    //
    typedef
    sqlite::query_column<
      sqlite::value_traits<
        ::odb::optional_uint64_traits::wrapped_type,
        sqlite::id_integer >::query_type,
      sqlite::id_integer >
    id_type_;

    static const id_type_ id;

    // name
    //
    typedef
    sqlite::query_column<
      sqlite::value_traits<
        ::std::basic_string< char >,
        sqlite::id_text >::query_type,
      sqlite::id_text >
    name_type_;

    static const name_type_ name;

    // type
    //
    typedef
    sqlite::query_column<
      sqlite::value_traits<
        ::std::string,
        sqlite::id_text >::query_type,
      sqlite::id_text >
    type_type_;

    static const type_type_ type;

    // path
    //
    typedef
    sqlite::query_column<
      sqlite::value_traits<
        ::std::string,
        sqlite::id_text >::query_type,
      sqlite::id_text >
    path_type_;

    static const path_type_ path;

    // relative_path
    //
    typedef
    sqlite::query_column<
      sqlite::value_traits<
        ::std::basic_string< char >,
        sqlite::id_text >::query_type,
      sqlite::id_text >
    relative_path_type_;

    static const relative_path_type_ relative_path;

    // default_
    //
    typedef
    sqlite::query_column<
      sqlite::value_traits<
        bool,
        sqlite::id_integer >::query_type,
      sqlite::id_integer >
    default__type_;

    static const default__type_ default_;

    // forward
    //
    typedef
    sqlite::query_column<
      sqlite::value_traits<
        bool,
        sqlite::id_integer >::query_type,
      sqlite::id_integer >
    forward_type_;

    static const forward_type_ forward;

    // auto_sync
    //
    typedef
    sqlite::query_column<
      sqlite::value_traits<
        bool,
        sqlite::id_integer >::query_type,
      sqlite::id_integer >
    auto_sync_type_;

    static const auto_sync_type_ auto_sync;
  };

  template <typename A>
  const typename query_columns< ::bdep::configuration, id_sqlite, A >::id_type_
  query_columns< ::bdep::configuration, id_sqlite, A >::
  id (A::table_name, "\"id\"", 0);

  template <typename A>
  const typename query_columns< ::bdep::configuration, id_sqlite, A >::name_type_
  query_columns< ::bdep::configuration, id_sqlite, A >::
  name (A::table_name, "\"name\"", 0);

  template <typename A>
  const typename query_columns< ::bdep::configuration, id_sqlite, A >::type_type_
  query_columns< ::bdep::configuration, id_sqlite, A >::
  type (A::table_name, "\"type\"", 0);

  template <typename A>
  const typename query_columns< ::bdep::configuration, id_sqlite, A >::path_type_
  query_columns< ::bdep::configuration, id_sqlite, A >::
  path (A::table_name, "\"path\"", 0);

  template <typename A>
  const typename query_columns< ::bdep::configuration, id_sqlite, A >::relative_path_type_
  query_columns< ::bdep::configuration, id_sqlite, A >::
  relative_path (A::table_name, "\"relative_path\"", 0);

  template <typename A>
  const typename query_columns< ::bdep::configuration, id_sqlite, A >::default__type_
  query_columns< ::bdep::configuration, id_sqlite, A >::
  default_ (A::table_name, "\"default\"", 0);

  template <typename A>
  const typename query_columns< ::bdep::configuration, id_sqlite, A >::forward_type_
  query_columns< ::bdep::configuration, id_sqlite, A >::
  forward (A::table_name, "\"forward\"", 0);

  template <typename A>
  const typename query_columns< ::bdep::configuration, id_sqlite, A >::auto_sync_type_
  query_columns< ::bdep::configuration, id_sqlite, A >::
  auto_sync (A::table_name, "\"auto_sync\"", 0);

  template <typename A>
  struct pointer_query_columns< ::bdep::configuration, id_sqlite, A >:
    query_columns< ::bdep::configuration, id_sqlite, A >
  {
  };

  template <>
  class access::object_traits_impl< ::bdep::configuration, id_sqlite >:
    public access::object_traits< ::bdep::configuration >
  {
    public:
    struct id_image_type
    {
      long long id_value;
      bool id_null;

      std::size_t version;
    };

    struct image_type
    {
      // id
      //
      long long id_value;
      bool id_null;

      // name
      //
      details::buffer name_value;
      std::size_t name_size;
      bool name_null;

      // type
      //
      details::buffer type_value;
      std::size_t type_size;
      bool type_null;

      // path
      //
      details::buffer path_value;
      std::size_t path_size;
      bool path_null;

      // relative_path
      //
      details::buffer relative_path_value;
      std::size_t relative_path_size;
      bool relative_path_null;

      // default_
      //
      long long default_value;
      bool default_null;

      // forward
      //
      long long forward_value;
      bool forward_null;

      // auto_sync
      //
      long long auto_sync_value;
      bool auto_sync_null;

      std::size_t version;
    };

    struct extra_statement_cache_type;

    // packages
    //
    struct packages_traits
    {
      static const std::size_t id_column_count = 1UL;
      static const std::size_t data_column_count = 3UL;

      static const bool versioned = false;

      static const char insert_statement[];
      static const char select_statement[];
      static const char delete_statement[];

      typedef ::std::vector< ::bdep::package_state > container_type;
      typedef
      odb::access::container_traits<container_type>
      container_traits_type;
      typedef container_traits_type::index_type index_type;
      typedef container_traits_type::value_type value_type;

      typedef ordered_functions<index_type, value_type> functions_type;
      typedef sqlite::container_statements< packages_traits > statements_type;

      struct data_image_type
      {
        // index
        //
        long long index_value;
        bool index_null;

        // value
        //
        composite_value_traits< value_type, id_sqlite >::image_type value_value;

        std::size_t version;
      };

      static void
      bind (sqlite::bind*,
            const sqlite::bind* id,
            std::size_t id_size,
            data_image_type&);

      static void
      grow (data_image_type&,
            bool*);

      static void
      init (data_image_type&,
            index_type*,
            const value_type&);

      static void
      init (index_type&,
            value_type&,
            const data_image_type&,
            database*);

      static void
      insert (index_type, const value_type&, void*);

      static bool
      select (index_type&, value_type&, void*);

      static void
      delete_ (void*);

      static void
      persist (const container_type&,
               statements_type&);

      static void
      load (container_type&,
            statements_type&);

      static void
      update (const container_type&,
              statements_type&);

      static void
      erase (statements_type&);
    };

    using object_traits<object_type>::id;

    static id_type
    id (const id_image_type&);

    static id_type
    id (const image_type&);

    static bool
    grow (image_type&,
          bool*);

    static void
    bind (sqlite::bind*,
          image_type&,
          sqlite::statement_kind);

    static void
    bind (sqlite::bind*, id_image_type&);

    static bool
    init (image_type&,
          const object_type&,
          sqlite::statement_kind);

    static void
    init (object_type&,
          const image_type&,
          database*);

    static void
    init (id_image_type&, const id_type&);

    typedef sqlite::object_statements<object_type> statements_type;

    typedef sqlite::query_base query_base_type;

    static const std::size_t column_count = 8UL;
    static const std::size_t id_column_count = 1UL;
    static const std::size_t inverse_column_count = 0UL;
    static const std::size_t readonly_column_count = 0UL;
    static const std::size_t managed_optimistic_column_count = 0UL;

    static const std::size_t separate_load_column_count = 0UL;
    static const std::size_t separate_update_column_count = 0UL;

    static const bool versioned = false;

    static const char persist_statement[];
    static const char find_statement[];
    static const char update_statement[];
    static const char erase_statement[];
    static const char query_statement[];
    static const char erase_query_statement[];

    static const char table_name[];

    static void
    persist (database&, object_type&);

    static pointer_type
    find (database&, const id_type&);

    static bool
    find (database&, const id_type&, object_type&);

    static bool
    reload (database&, object_type&);

    static void
    update (database&, const object_type&);

    static void
    erase (database&, const id_type&);

    static void
    erase (database&, const object_type&);

    static result<object_type>
    query (database&, const query_base_type&);

    static unsigned long long
    erase_query (database&, const query_base_type&);

    public:
    static bool
    find_ (statements_type&,
           const id_type*);

    static void
    load_ (statements_type&,
           object_type&,
           bool reload);
  };

  template <>
  class access::object_traits_impl< ::bdep::configuration, id_common >:
    public access::object_traits_impl< ::bdep::configuration, id_sqlite >
  {
  };

  // configuration_count
  //
  template <>
  class access::view_traits_impl< ::bdep::configuration_count, id_sqlite >:
    public access::view_traits< ::bdep::configuration_count >
  {
    public:
    struct image_type
    {
      // result
      //
      long long result_value;
      bool result_null;

      std::size_t version;
    };

    typedef sqlite::view_statements<view_type> statements_type;

    typedef sqlite::query_base query_base_type;
    struct query_columns;

    static const bool versioned = false;

    static bool
    grow (image_type&,
          bool*);

    static void
    bind (sqlite::bind*,
          image_type&);

    static void
    init (view_type&,
          const image_type&,
          database*);

    static const std::size_t column_count = 1UL;

    static query_base_type
    query_statement (const query_base_type&);

    static result<view_type>
    query (database&, const query_base_type&);
  };

  template <>
  class access::view_traits_impl< ::bdep::configuration_count, id_common >:
    public access::view_traits_impl< ::bdep::configuration_count, id_sqlite >
  {
  };

  // configuration
  //
  // configuration_count
  //
  struct access::view_traits_impl< ::bdep::configuration_count, id_sqlite >::query_columns:
    odb::pointer_query_columns<
      ::bdep::configuration,
      id_sqlite,
      odb::access::object_traits_impl< ::bdep::configuration, id_sqlite > >
  {
  };
}

#include <bdep/project-odb.ixx>

#include <odb/post.hxx>

#endif // BDEP_PROJECT_ODB_HXX