column_constraint.h
Go to the documentation of this file.
1 #ifndef cetlib_sqlite_detail_column_constraint_h
2 #define cetlib_sqlite_detail_column_constraint_h
3 
4 //===================================================================
5 // Column constraints are specified in SQLite by appending additional
6 // keywords to the column definition. These can be specified by
7 // (e.g.):
8 // translates
9 // column<int, primary_key>{"id"} ==========> id INTEGER PRIMARY KEY
10 // to
11 //
12 // -------------------------------------------------------------------
13 //
14 // Technical considerations:
15 //
16 // For now, the C++ representation does not allow constraints that
17 // take additional arguments, since there is no easy way to have a
18 // homogeneous interface in the context of bare columns<...>
19 // statements vs. Ntuple<...> usage. For example, suppose we
20 // support the 'DEFAULT 1.56' constraint. Whereas one could
21 // create the translation:
22 //
23 // columns<int, default_value>{"id", 1.56} ==> id INTEGER DEFAULT 1.56
24 //
25 // There would be no easy to do it with Ntuple, without changing the
26 // Ntuple c'tor (e.g.).
27 //
28 // Ntuple<column<int,default_value>> n {db, "someTable", {{"id", 1.56}}};
29 //
30 // and this is not supported right now.
31 //=======================================================================
32 
33 #include <string>
34 
35 namespace cet::sqlite {
36  struct primary_key {
37  static std::string
39  {
40  return " PRIMARY KEY";
41  }
42  };
43 }
44 
45 #endif /* cetlib_sqlite_detail_column_constraint_h */
46 
47 // Local Variables:
48 // mode: c++
49 // End:
std::string string
Definition: nybbler.cc:12
static std::string snippet()