aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-10-14 20:43:20 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-10-14 20:58:33 +0300
commit004062737657986294163672ae67d16348e203f6 (patch)
tree58f1f9aa999a83b706c3096a1f879834f4e6596b
parent6163f829355b6ceae21060eb7a33f3107477d899 (diff)
Make changes required for testtest
-rw-r--r--buildfile2
-rw-r--r--clean/clean-options.cxx836
-rw-r--r--clean/clean-options.hxx393
-rw-r--r--clean/clean-options.ixx242
-rw-r--r--libbrep/build-extra.hxx288
-rw-r--r--libbrep/build-odb.cxx4541
-rw-r--r--libbrep/build-odb.hxx2056
-rw-r--r--libbrep/build-odb.ixx207
-rw-r--r--libbrep/build-package-odb.cxx3988
-rw-r--r--libbrep/build-package-odb.hxx1877
-rw-r--r--libbrep/build-package-odb.ixx211
-rw-r--r--libbrep/build.sql158
-rw-r--r--libbrep/common-odb.cxx1744
-rw-r--r--libbrep/common-odb.hxx526
-rw-r--r--libbrep/common-odb.ixx239
-rw-r--r--libbrep/package-extra.hxx541
-rw-r--r--libbrep/package-odb.cxx14202
-rw-r--r--libbrep/package-odb.hxx5717
-rw-r--r--libbrep/package-odb.ixx587
-rw-r--r--libbrep/package.sql791
-rw-r--r--load/load-options.cxx947
-rw-r--r--load/load-options.hxx435
-rw-r--r--load/load-options.ixx302
-rw-r--r--migrate/migrate-options.cxx853
-rw-r--r--migrate/migrate-options.hxx397
-rw-r--r--migrate/migrate-options.ixx248
-rw-r--r--mod/module-options.cxx9662
-rw-r--r--mod/module-options.hxx4374
-rw-r--r--mod/module-options.ixx3174
-rw-r--r--monitor/module-options.cxx453
-rw-r--r--monitor/module-options.hxx91
-rw-r--r--monitor/module-options.ixx24
-rw-r--r--monitor/monitor-options.cxx779
-rw-r--r--monitor/monitor-options.hxx192
-rw-r--r--monitor/monitor-options.ixx156
-rw-r--r--repositories.manifest41
36 files changed, 61235 insertions, 39 deletions
diff --git a/buildfile b/buildfile
index 17ba8ab..c375238 100644
--- a/buildfile
+++ b/buildfile
@@ -1,7 +1,7 @@
# file : buildfile
# license : MIT; see accompanying LICENSE file
-./: {*/ -build/ -web/} \
+./: {*/ -build/ -web/ -doc/} \
doc{NEWS README INSTALL*} legal{LICENSE AUTHORS LEGAL} \
manifest
diff --git a/clean/clean-options.cxx b/clean/clean-options.cxx
new file mode 100644
index 0000000..c33ecd7
--- /dev/null
+++ b/clean/clean-options.cxx
@@ -0,0 +1,836 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+#include <clean/clean-options.hxx>
+
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+#include <ostream>
+#include <sstream>
+
+namespace cli
+{
+ // unknown_option
+ //
+ unknown_option::
+ ~unknown_option () throw ()
+ {
+ }
+
+ void unknown_option::
+ print (::std::ostream& os) const
+ {
+ os << "unknown option '" << option ().c_str () << "'";
+ }
+
+ const char* unknown_option::
+ what () const throw ()
+ {
+ return "unknown option";
+ }
+
+ // unknown_argument
+ //
+ unknown_argument::
+ ~unknown_argument () throw ()
+ {
+ }
+
+ void unknown_argument::
+ print (::std::ostream& os) const
+ {
+ os << "unknown argument '" << argument ().c_str () << "'";
+ }
+
+ const char* unknown_argument::
+ what () const throw ()
+ {
+ return "unknown argument";
+ }
+
+ // missing_value
+ //
+ missing_value::
+ ~missing_value () throw ()
+ {
+ }
+
+ void missing_value::
+ print (::std::ostream& os) const
+ {
+ os << "missing value for option '" << option ().c_str () << "'";
+ }
+
+ const char* missing_value::
+ what () const throw ()
+ {
+ return "missing option value";
+ }
+
+ // invalid_value
+ //
+ invalid_value::
+ ~invalid_value () throw ()
+ {
+ }
+
+ void invalid_value::
+ print (::std::ostream& os) const
+ {
+ os << "invalid value '" << value ().c_str () << "' for option '"
+ << option ().c_str () << "'";
+
+ if (!message ().empty ())
+ os << ": " << message ().c_str ();
+ }
+
+ const char* invalid_value::
+ what () const throw ()
+ {
+ return "invalid option value";
+ }
+
+ // eos_reached
+ //
+ void eos_reached::
+ print (::std::ostream& os) const
+ {
+ os << what ();
+ }
+
+ const char* eos_reached::
+ what () const throw ()
+ {
+ return "end of argument stream reached";
+ }
+
+ // scanner
+ //
+ scanner::
+ ~scanner ()
+ {
+ }
+
+ // argv_scanner
+ //
+ bool argv_scanner::
+ more ()
+ {
+ return i_ < argc_;
+ }
+
+ const char* argv_scanner::
+ peek ()
+ {
+ if (i_ < argc_)
+ return argv_[i_];
+ else
+ throw eos_reached ();
+ }
+
+ const char* argv_scanner::
+ next ()
+ {
+ if (i_ < argc_)
+ {
+ const char* r (argv_[i_]);
+
+ if (erase_)
+ {
+ for (int i (i_ + 1); i < argc_; ++i)
+ argv_[i - 1] = argv_[i];
+
+ --argc_;
+ argv_[argc_] = 0;
+ }
+ else
+ ++i_;
+
+ return r;
+ }
+ else
+ throw eos_reached ();
+ }
+
+ void argv_scanner::
+ skip ()
+ {
+ if (i_ < argc_)
+ ++i_;
+ else
+ throw eos_reached ();
+ }
+
+ template <typename X>
+ struct parser
+ {
+ static void
+ parse (X& x, bool& xs, scanner& s)
+ {
+ using namespace std;
+
+ const char* o (s.next ());
+ if (s.more ())
+ {
+ string v (s.next ());
+ istringstream is (v);
+ if (!(is >> x && is.peek () == istringstream::traits_type::eof ()))
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+ };
+
+ template <>
+ struct parser<bool>
+ {
+ static void
+ parse (bool& x, scanner& s)
+ {
+ s.next ();
+ x = true;
+ }
+ };
+
+ template <>
+ struct parser<std::string>
+ {
+ static void
+ parse (std::string& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ x = s.next ();
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::vector<X> >
+ {
+ static void
+ parse (std::vector<X>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.push_back (x);
+ xs = true;
+ }
+ };
+
+ template <typename X, typename C>
+ struct parser<std::set<X, C> >
+ {
+ static void
+ parse (std::set<X, C>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.insert (x);
+ xs = true;
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::map<K, V, C> >
+ {
+ static void
+ parse (std::map<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m[k] = v;
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+ };
+
+ template <typename X, typename T, T X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, s);
+ }
+
+ template <typename X, typename T, T X::*M, bool X::*S>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, x.*S, s);
+ }
+}
+
+#include <map>
+#include <cstring>
+
+// options
+//
+
+options::
+options ()
+: archive_ (),
+ db_user_ (),
+ db_user_specified_ (false),
+ db_password_ (),
+ db_password_specified_ (false),
+ db_name_ (),
+ db_name_specified_ (false),
+ db_host_ (),
+ db_host_specified_ (false),
+ db_port_ (0),
+ db_port_specified_ (false),
+ pager_ (),
+ pager_specified_ (false),
+ pager_option_ (),
+ pager_option_specified_ (false),
+ help_ (),
+ version_ ()
+{
+}
+
+options::
+options (int& argc,
+ char** argv,
+ bool erase,
+ ::cli::unknown_mode opt,
+ ::cli::unknown_mode arg)
+: archive_ (),
+ db_user_ (),
+ db_user_specified_ (false),
+ db_password_ (),
+ db_password_specified_ (false),
+ db_name_ (),
+ db_name_specified_ (false),
+ db_host_ (),
+ db_host_specified_ (false),
+ db_port_ (0),
+ db_port_specified_ (false),
+ pager_ (),
+ pager_specified_ (false),
+ pager_option_ (),
+ pager_option_specified_ (false),
+ help_ (),
+ version_ ()
+{
+ ::cli::argv_scanner s (argc, argv, erase);
+ _parse (s, opt, arg);
+}
+
+options::
+options (int start,
+ int& argc,
+ char** argv,
+ bool erase,
+ ::cli::unknown_mode opt,
+ ::cli::unknown_mode arg)
+: archive_ (),
+ db_user_ (),
+ db_user_specified_ (false),
+ db_password_ (),
+ db_password_specified_ (false),
+ db_name_ (),
+ db_name_specified_ (false),
+ db_host_ (),
+ db_host_specified_ (false),
+ db_port_ (0),
+ db_port_specified_ (false),
+ pager_ (),
+ pager_specified_ (false),
+ pager_option_ (),
+ pager_option_specified_ (false),
+ help_ (),
+ version_ ()
+{
+ ::cli::argv_scanner s (start, argc, argv, erase);
+ _parse (s, opt, arg);
+}
+
+options::
+options (int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::cli::unknown_mode opt,
+ ::cli::unknown_mode arg)
+: archive_ (),
+ db_user_ (),
+ db_user_specified_ (false),
+ db_password_ (),
+ db_password_specified_ (false),
+ db_name_ (),
+ db_name_specified_ (false),
+ db_host_ (),
+ db_host_specified_ (false),
+ db_port_ (0),
+ db_port_specified_ (false),
+ pager_ (),
+ pager_specified_ (false),
+ pager_option_ (),
+ pager_option_specified_ (false),
+ help_ (),
+ version_ ()
+{
+ ::cli::argv_scanner s (argc, argv, erase);
+ _parse (s, opt, arg);
+ end = s.end ();
+}
+
+options::
+options (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::cli::unknown_mode opt,
+ ::cli::unknown_mode arg)
+: archive_ (),
+ db_user_ (),
+ db_user_specified_ (false),
+ db_password_ (),
+ db_password_specified_ (false),
+ db_name_ (),
+ db_name_specified_ (false),
+ db_host_ (),
+ db_host_specified_ (false),
+ db_port_ (0),
+ db_port_specified_ (false),
+ pager_ (),
+ pager_specified_ (false),
+ pager_option_ (),
+ pager_option_specified_ (false),
+ help_ (),
+ version_ ()
+{
+ ::cli::argv_scanner s (start, argc, argv, erase);
+ _parse (s, opt, arg);
+ end = s.end ();
+}
+
+options::
+options (::cli::scanner& s,
+ ::cli::unknown_mode opt,
+ ::cli::unknown_mode arg)
+: archive_ (),
+ db_user_ (),
+ db_user_specified_ (false),
+ db_password_ (),
+ db_password_specified_ (false),
+ db_name_ (),
+ db_name_specified_ (false),
+ db_host_ (),
+ db_host_specified_ (false),
+ db_port_ (0),
+ db_port_specified_ (false),
+ pager_ (),
+ pager_specified_ (false),
+ pager_option_ (),
+ pager_option_specified_ (false),
+ help_ (),
+ version_ ()
+{
+ _parse (s, opt, arg);
+}
+
+::cli::usage_para options::
+print_usage (::std::ostream& os, ::cli::usage_para p)
+{
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mOPTIONS\033[0m" << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--archive\033[0m Archive old tenants." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--db-user\033[0m \033[4muser\033[0m Database user name. If not specified, then operating system" << ::std::endl
+ << " (login) name is used." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--db-password\033[0m \033[4mpass\033[0m Database password. If not specified, then login without" << ::std::endl
+ << " password is expected to work." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--db-name\033[0m \033[4mname\033[0m Database name. If not specified, then \033[1mbrep_build\033[0m is used for" << ::std::endl
+ << " the first form and \033[1mbrep_package\033[0m for the second." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--db-host\033[0m \033[4mhost\033[0m Database host name, address, or socket. If not specified," << ::std::endl
+ << " then connect to \033[1mlocalhost\033[0m using the operating system-default" << ::std::endl
+ << " mechanism (Unix-domain socket, etc)." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--db-port\033[0m \033[4mport\033[0m Database port number. If not specified, the default port is" << ::std::endl
+ << " used." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--pager\033[0m \033[4mpath\033[0m The pager program to be used to show long text. Commonly" << ::std::endl
+ << " used pager programs are \033[1mless\033[0m and \033[1mmore\033[0m. You can also specify" << ::std::endl
+ << " additional options that should be passed to the pager" << ::std::endl
+ << " program with \033[1m--pager-option\033[0m. If an empty string is specified" << ::std::endl
+ << " as the pager program, then no pager will be used. If the" << ::std::endl
+ << " pager program is not explicitly specified, then \033[1mbrep-clean\033[0m" << ::std::endl
+ << " will try to use \033[1mless\033[0m. If it is not available, then no pager" << ::std::endl
+ << " will be used." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--pager-option\033[0m \033[4mopt\033[0m Additional option to be passed to the pager program. See" << ::std::endl
+ << " \033[1m--pager\033[0m for more information on the pager program. Repeat" << ::std::endl
+ << " this option to specify multiple pager options." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--help\033[0m Print usage information and exit." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--version\033[0m Print version and exit." << ::std::endl;
+
+ p = ::cli::usage_para::option;
+
+ return p;
+}
+
+typedef
+std::map<std::string, void (*) (options&, ::cli::scanner&)>
+_cli_options_map;
+
+static _cli_options_map _cli_options_map_;
+
+struct _cli_options_map_init
+{
+ _cli_options_map_init ()
+ {
+ _cli_options_map_["--archive"] =
+ &::cli::thunk< options, bool, &options::archive_ >;
+ _cli_options_map_["--db-user"] =
+ &::cli::thunk< options, std::string, &options::db_user_,
+ &options::db_user_specified_ >;
+ _cli_options_map_["--db-password"] =
+ &::cli::thunk< options, std::string, &options::db_password_,
+ &options::db_password_specified_ >;
+ _cli_options_map_["--db-name"] =
+ &::cli::thunk< options, std::string, &options::db_name_,
+ &options::db_name_specified_ >;
+ _cli_options_map_["--db-host"] =
+ &::cli::thunk< options, std::string, &options::db_host_,
+ &options::db_host_specified_ >;
+ _cli_options_map_["--db-port"] =
+ &::cli::thunk< options, std::uint16_t, &options::db_port_,
+ &options::db_port_specified_ >;
+ _cli_options_map_["--pager"] =
+ &::cli::thunk< options, std::string, &options::pager_,
+ &options::pager_specified_ >;
+ _cli_options_map_["--pager-option"] =
+ &::cli::thunk< options, std::vector<std::string>, &options::pager_option_,
+ &options::pager_option_specified_ >;
+ _cli_options_map_["--help"] =
+ &::cli::thunk< options, bool, &options::help_ >;
+ _cli_options_map_["--version"] =
+ &::cli::thunk< options, bool, &options::version_ >;
+ }
+};
+
+static _cli_options_map_init _cli_options_map_init_;
+
+bool options::
+_parse (const char* o, ::cli::scanner& s)
+{
+ _cli_options_map::const_iterator i (_cli_options_map_.find (o));
+
+ if (i != _cli_options_map_.end ())
+ {
+ (*(i->second)) (*this, s);
+ return true;
+ }
+
+ return false;
+}
+
+bool options::
+_parse (::cli::scanner& s,
+ ::cli::unknown_mode opt_mode,
+ ::cli::unknown_mode arg_mode)
+{
+ // Can't skip combined flags (--no-combined-flags).
+ //
+ assert (opt_mode != ::cli::unknown_mode::skip);
+
+ bool r = false;
+ bool opt = true;
+
+ while (s.more ())
+ {
+ const char* o = s.peek ();
+
+ if (std::strcmp (o, "--") == 0)
+ {
+ opt = false;
+ s.skip ();
+ r = true;
+ continue;
+ }
+
+ if (opt)
+ {
+ if (_parse (o, s))
+ {
+ r = true;
+ continue;
+ }
+
+ if (std::strncmp (o, "-", 1) == 0 && o[1] != '\0')
+ {
+ // Handle combined option values.
+ //
+ std::string co;
+ if (const char* v = std::strchr (o, '='))
+ {
+ co.assign (o, 0, v - o);
+ ++v;
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (co.c_str ()),
+ const_cast<char*> (v)
+ };
+
+ ::cli::argv_scanner ns (0, ac, av);
+
+ if (_parse (co.c_str (), ns))
+ {
+ // Parsed the option but not its value?
+ //
+ if (ns.end () != 2)
+ throw ::cli::invalid_value (co, v);
+
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = co.c_str ();
+ }
+ }
+
+ // Handle combined flags.
+ //
+ char cf[3];
+ {
+ const char* p = o + 1;
+ for (; *p != '\0'; ++p)
+ {
+ if (!((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9')))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ for (p = o + 1; *p != '\0'; ++p)
+ {
+ std::strcpy (cf, "-");
+ cf[1] = *p;
+ cf[2] = '\0';
+
+ int ac (1);
+ char* av[] =
+ {
+ cf
+ };
+
+ ::cli::argv_scanner ns (0, ac, av);
+
+ if (!_parse (cf, ns))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ // All handled.
+ //
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = cf;
+ }
+ }
+ }
+
+ switch (opt_mode)
+ {
+ case ::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::cli::unknown_mode::fail:
+ {
+ throw ::cli::unknown_option (o);
+ }
+ }
+
+ break;
+ }
+ }
+
+ switch (arg_mode)
+ {
+ case ::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::cli::unknown_mode::fail:
+ {
+ throw ::cli::unknown_argument (o);
+ }
+ }
+
+ break;
+ }
+
+ return r;
+}
+
+::cli::usage_para
+print_usage (::std::ostream& os, ::cli::usage_para p)
+{
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mSYNOPSIS\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mbrep-clean --help\033[0m" << ::std::endl
+ << "\033[1mbrep-clean --version\033[0m" << ::std::endl
+ << "\033[1mbrep-clean\033[0m [\033[4moptions\033[0m] builds \033[4mbuildtab\033[0m [\033[4mtimeout\033[0m...]" << ::std::endl
+ << "\033[1mbrep-clean\033[0m [\033[4moptions\033[0m] tenants \033[4mtimeout\033[0m\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mDESCRIPTION\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mbrep-clean\033[0m deletes expired package builds from the brep \033[1mbuild\033[0m database or" << ::std::endl
+ << "deletes/archives tenants from the brep \033[1mpackage\033[0m database." << ::std::endl
+ << ::std::endl
+ << "The first form considers a build as expired if the corresponding package" << ::std::endl
+ << "version is not in the \033[1mpackage\033[0m database, or the configuration is not listed in" << ::std::endl
+ << "the \033[4mbuildtab\033[0m file, or its age is older than the specified timeout for this" << ::std::endl
+ << "build toolchain." << ::std::endl
+ << ::std::endl
+ << "Build \033[4mtimeout\033[0m, if specified, should have the [\033[4mname\033[0m=]\033[4mhours\033[0m\033[0m form. Specify zero" << ::std::endl
+ << "for \033[4mhours\033[0m to make builds for a toolchain to never expire. Omit \033[4mname\033[0m (including" << ::std::endl
+ << "\033[1m=\033[0m) to specify the default timeout. It will apply to all the toolchains that" << ::std::endl
+ << "don't have a toolchain-specific timeout." << ::std::endl
+ << ::std::endl
+ << "The second form considers a tenant as expired if its age is older than the" << ::std::endl
+ << "specified \033[4mtimeout\033[0m." << ::std::endl
+ << ::std::endl
+ << "If the \033[1m--archive\033[0m option is specified, then the tenant is archived rather than" << ::std::endl
+ << "deleted. In this state the tenant packages (and their builds) are still visible" << ::std::endl
+ << "in \033[1mbrep\033[0m but are not (re-)built by build bots." << ::std::endl
+ << ::std::endl
+ << "Note that \033[1mbrep-clean\033[0m expects the \033[1mbuild\033[0m and \033[1mpackage\033[0m database schemas to have" << ::std::endl
+ << "already been created using \033[1mbrep-migrate(1)\033[0m." << ::std::endl;
+
+ p = ::options::print_usage (os, ::cli::usage_para::text);
+
+ if (p != ::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mEXIT STATUS\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1m0\033[0m" << ::std::endl
+ << " Success." << ::std::endl
+ << "\033[1m1\033[0m" << ::std::endl
+ << " Fatal error." << ::std::endl
+ << "\033[1m2\033[0m" << ::std::endl
+ << " An instance of \033[1mbrep-clean\033[0m or some other \033[1mbrep\033[0m utility is already running." << ::std::endl
+ << " Try again." << ::std::endl
+ << "\033[1m3\033[0m" << ::std::endl
+ << " Recoverable database error. Try again." << ::std::endl;
+
+ p = ::cli::usage_para::text;
+
+ return p;
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
diff --git a/clean/clean-options.hxx b/clean/clean-options.hxx
new file mode 100644
index 0000000..94b92fb
--- /dev/null
+++ b/clean/clean-options.hxx
@@ -0,0 +1,393 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+#ifndef CLEAN_CLEAN_OPTIONS_HXX
+#define CLEAN_CLEAN_OPTIONS_HXX
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+#include <iosfwd>
+#include <string>
+#include <cstddef>
+#include <exception>
+
+#ifndef CLI_POTENTIALLY_UNUSED
+# if defined(_MSC_VER) || defined(__xlC__)
+# define CLI_POTENTIALLY_UNUSED(x) (void*)&x
+# else
+# define CLI_POTENTIALLY_UNUSED(x) (void)x
+# endif
+#endif
+
+namespace cli
+{
+ class usage_para
+ {
+ public:
+ enum value
+ {
+ none,
+ text,
+ option
+ };
+
+ usage_para (value);
+
+ operator value () const
+ {
+ return v_;
+ }
+
+ private:
+ value v_;
+ };
+
+ class unknown_mode
+ {
+ public:
+ enum value
+ {
+ skip,
+ stop,
+ fail
+ };
+
+ unknown_mode (value);
+
+ operator value () const
+ {
+ return v_;
+ }
+
+ private:
+ value v_;
+ };
+
+ // Exceptions.
+ //
+
+ class exception: public std::exception
+ {
+ public:
+ virtual void
+ print (::std::ostream&) const = 0;
+ };
+
+ ::std::ostream&
+ operator<< (::std::ostream&, const exception&);
+
+ class unknown_option: public exception
+ {
+ public:
+ virtual
+ ~unknown_option () throw ();
+
+ unknown_option (const std::string& option);
+
+ const std::string&
+ option () const;
+
+ virtual void
+ print (::std::ostream&) const;
+
+ virtual const char*
+ what () const throw ();
+
+ private:
+ std::string option_;
+ };
+
+ class unknown_argument: public exception
+ {
+ public:
+ virtual
+ ~unknown_argument () throw ();
+
+ unknown_argument (const std::string& argument);
+
+ const std::string&
+ argument () const;
+
+ virtual void
+ print (::std::ostream&) const;
+
+ virtual const char*
+ what () const throw ();
+
+ private:
+ std::string argument_;
+ };
+
+ class missing_value: public exception
+ {
+ public:
+ virtual
+ ~missing_value () throw ();
+
+ missing_value (const std::string& option);
+
+ const std::string&
+ option () const;
+
+ virtual void
+ print (::std::ostream&) const;
+
+ virtual const char*
+ what () const throw ();
+
+ private:
+ std::string option_;
+ };
+
+ class invalid_value: public exception
+ {
+ public:
+ virtual
+ ~invalid_value () throw ();
+
+ invalid_value (const std::string& option,
+ const std::string& value,
+ const std::string& message = std::string ());
+
+ const std::string&
+ option () const;
+
+ const std::string&
+ value () const;
+
+ const std::string&
+ message () const;
+
+ virtual void
+ print (::std::ostream&) const;
+
+ virtual const char*
+ what () const throw ();
+
+ private:
+ std::string option_;
+ std::string value_;
+ std::string message_;
+ };
+
+ class eos_reached: public exception
+ {
+ public:
+ virtual void
+ print (::std::ostream&) const;
+
+ virtual const char*
+ what () const throw ();
+ };
+
+ // Command line argument scanner interface.
+ //
+ // The values returned by next() are guaranteed to be valid
+ // for the two previous arguments up until a call to a third
+ // peek() or next().
+ //
+ class scanner
+ {
+ public:
+ virtual
+ ~scanner ();
+
+ virtual bool
+ more () = 0;
+
+ virtual const char*
+ peek () = 0;
+
+ virtual const char*
+ next () = 0;
+
+ virtual void
+ skip () = 0;
+ };
+
+ class argv_scanner: public scanner
+ {
+ public:
+ argv_scanner (int& argc, char** argv, bool erase = false);
+ argv_scanner (int start, int& argc, char** argv, bool erase = false);
+
+ int
+ end () const;
+
+ virtual bool
+ more ();
+
+ virtual const char*
+ peek ();
+
+ virtual const char*
+ next ();
+
+ virtual void
+ skip ();
+
+ private:
+ int i_;
+ int& argc_;
+ char** argv_;
+ bool erase_;
+ };
+
+ template <typename X>
+ struct parser;
+}
+
+#include <vector>
+
+#include <string>
+
+#include <cstdint>
+
+class options
+{
+ public:
+ options ();
+
+ options (int& argc,
+ char** argv,
+ bool erase = false,
+ ::cli::unknown_mode option = ::cli::unknown_mode::fail,
+ ::cli::unknown_mode argument = ::cli::unknown_mode::stop);
+
+ options (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ ::cli::unknown_mode option = ::cli::unknown_mode::fail,
+ ::cli::unknown_mode argument = ::cli::unknown_mode::stop);
+
+ options (int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::cli::unknown_mode option = ::cli::unknown_mode::fail,
+ ::cli::unknown_mode argument = ::cli::unknown_mode::stop);
+
+ options (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::cli::unknown_mode option = ::cli::unknown_mode::fail,
+ ::cli::unknown_mode argument = ::cli::unknown_mode::stop);
+
+ options (::cli::scanner&,
+ ::cli::unknown_mode option = ::cli::unknown_mode::fail,
+ ::cli::unknown_mode argument = ::cli::unknown_mode::stop);
+
+ // Option accessors.
+ //
+ const bool&
+ archive () const;
+
+ const std::string&
+ db_user () const;
+
+ bool
+ db_user_specified () const;
+
+ const std::string&
+ db_password () const;
+
+ bool
+ db_password_specified () const;
+
+ const std::string&
+ db_name () const;
+
+ bool
+ db_name_specified () const;
+
+ const std::string&
+ db_host () const;
+
+ bool
+ db_host_specified () const;
+
+ const std::uint16_t&
+ db_port () const;
+
+ bool
+ db_port_specified () const;
+
+ const std::string&
+ pager () const;
+
+ bool
+ pager_specified () const;
+
+ const std::vector<std::string>&
+ pager_option () const;
+
+ bool
+ pager_option_specified () const;
+
+ const bool&
+ help () const;
+
+ const bool&
+ version () const;
+
+ // Print usage information.
+ //
+ static ::cli::usage_para
+ print_usage (::std::ostream&,
+ ::cli::usage_para = ::cli::usage_para::none);
+
+ // Implementation details.
+ //
+ protected:
+ bool
+ _parse (const char*, ::cli::scanner&);
+
+ private:
+ bool
+ _parse (::cli::scanner&,
+ ::cli::unknown_mode option,
+ ::cli::unknown_mode argument);
+
+ public:
+ bool archive_;
+ std::string db_user_;
+ bool db_user_specified_;
+ std::string db_password_;
+ bool db_password_specified_;
+ std::string db_name_;
+ bool db_name_specified_;
+ std::string db_host_;
+ bool db_host_specified_;
+ std::uint16_t db_port_;
+ bool db_port_specified_;
+ std::string pager_;
+ bool pager_specified_;
+ std::vector<std::string> pager_option_;
+ bool pager_option_specified_;
+ bool help_;
+ bool version_;
+};
+
+// Print page usage information.
+//
+::cli::usage_para
+print_usage (::std::ostream&,
+ ::cli::usage_para = ::cli::usage_para::none);
+
+#include <clean/clean-options.ixx>
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
+#endif // CLEAN_CLEAN_OPTIONS_HXX
diff --git a/clean/clean-options.ixx b/clean/clean-options.ixx
new file mode 100644
index 0000000..973125d
--- /dev/null
+++ b/clean/clean-options.ixx
@@ -0,0 +1,242 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+#include <cassert>
+
+namespace cli
+{
+ // usage_para
+ //
+ inline usage_para::
+ usage_para (value v)
+ : v_ (v)
+ {
+ }
+
+ // unknown_mode
+ //
+ inline unknown_mode::
+ unknown_mode (value v)
+ : v_ (v)
+ {
+ }
+
+ // exception
+ //
+ inline ::std::ostream&
+ operator<< (::std::ostream& os, const exception& e)
+ {
+ e.print (os);
+ return os;
+ }
+
+ // unknown_option
+ //
+ inline unknown_option::
+ unknown_option (const std::string& option)
+ : option_ (option)
+ {
+ }
+
+ inline const std::string& unknown_option::
+ option () const
+ {
+ return option_;
+ }
+
+ // unknown_argument
+ //
+ inline unknown_argument::
+ unknown_argument (const std::string& argument)
+ : argument_ (argument)
+ {
+ }
+
+ inline const std::string& unknown_argument::
+ argument () const
+ {
+ return argument_;
+ }
+
+ // missing_value
+ //
+ inline missing_value::
+ missing_value (const std::string& option)
+ : option_ (option)
+ {
+ }
+
+ inline const std::string& missing_value::
+ option () const
+ {
+ return option_;
+ }
+
+ // invalid_value
+ //
+ inline invalid_value::
+ invalid_value (const std::string& option,
+ const std::string& value,
+ const std::string& message)
+ : option_ (option),
+ value_ (value),
+ message_ (message)
+ {
+ }
+
+ inline const std::string& invalid_value::
+ option () const
+ {
+ return option_;
+ }
+
+ inline const std::string& invalid_value::
+ value () const
+ {
+ return value_;
+ }
+
+ inline const std::string& invalid_value::
+ message () const
+ {
+ return message_;
+ }
+
+ // argv_scanner
+ //
+ inline argv_scanner::
+ argv_scanner (int& argc, char** argv, bool erase)
+ : i_ (1), argc_ (argc), argv_ (argv), erase_ (erase)
+ {
+ }
+
+ inline argv_scanner::
+ argv_scanner (int start, int& argc, char** argv, bool erase)
+ : i_ (start), argc_ (argc), argv_ (argv), erase_ (erase)
+ {
+ }
+
+ inline int argv_scanner::
+ end () const
+ {
+ return i_;
+ }
+}
+
+// options
+//
+
+inline const bool& options::
+archive () const
+{
+ return this->archive_;
+}
+
+inline const std::string& options::
+db_user () const
+{
+ return this->db_user_;
+}
+
+inline bool options::
+db_user_specified () const
+{
+ return this->db_user_specified_;
+}
+
+inline const std::string& options::
+db_password () const
+{
+ return this->db_password_;
+}
+
+inline bool options::
+db_password_specified () const
+{
+ return this->db_password_specified_;
+}
+
+inline const std::string& options::
+db_name () const
+{
+ return this->db_name_;
+}
+
+inline bool options::
+db_name_specified () const
+{
+ return this->db_name_specified_;
+}
+
+inline const std::string& options::
+db_host () const
+{
+ return this->db_host_;
+}
+
+inline bool options::
+db_host_specified () const
+{
+ return this->db_host_specified_;
+}
+
+inline const std::uint16_t& options::
+db_port () const
+{
+ return this->db_port_;
+}
+
+inline bool options::
+db_port_specified () const
+{
+ return this->db_port_specified_;
+}
+
+inline const std::string& options::
+pager () const
+{
+ return this->pager_;
+}
+
+inline bool options::
+pager_specified () const
+{
+ return this->pager_specified_;
+}
+
+inline const std::vector<std::string>& options::
+pager_option () const
+{
+ return this->pager_option_;
+}
+
+inline bool options::
+pager_option_specified () const
+{
+ return this->pager_option_specified_;
+}
+
+inline const bool& options::
+help () const
+{
+ return this->help_;
+}
+
+inline const bool& options::
+version () const
+{
+ return this->version_;
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
diff --git a/libbrep/build-extra.hxx b/libbrep/build-extra.hxx
new file mode 100644
index 0000000..fd59069
--- /dev/null
+++ b/libbrep/build-extra.hxx
@@ -0,0 +1,288 @@
+ 0x2d, 0x2d, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x6c, 0x65,
+ 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x62, 0x65, 0x20, 0x70,
+ 0x61, 0x72, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x62, 0x79, 0x20, 0x74,
+ 0x68, 0x65, 0x20, 0x62, 0x72, 0x65, 0x70, 0x2d, 0x6d, 0x69, 0x67, 0x72,
+ 0x61, 0x74, 0x65, 0x20, 0x75, 0x74, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e,
+ 0x20, 0x54, 0x6f, 0x20, 0x64, 0x65, 0x63, 0x72, 0x65, 0x61, 0x73, 0x65,
+ 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2d, 0x2d, 0x20, 0x70, 0x61, 0x72, 0x73,
+ 0x65, 0x72, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x69, 0x74,
+ 0x79, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x72, 0x65, 0x20, 0x69, 0x73, 0x20,
+ 0x61, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x6f, 0x66, 0x20,
+ 0x72, 0x65, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73,
+ 0x2c, 0x20, 0x73, 0x65, 0x65, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67,
+ 0x65, 0x2d, 0x65, 0x78, 0x74, 0x72, 0x61, 0x2e, 0x73, 0x71, 0x6c, 0x0a,
+ 0x2d, 0x2d, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x20,
+ 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x2e, 0x0a, 0x2d, 0x2d, 0x0a,
+ 0x2d, 0x2d, 0x20, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74,
+ 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73,
+ 0x65, 0x20, 0x27, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x27, 0x20, 0x73, 0x63,
+ 0x68, 0x65, 0x6d, 0x61, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
+ 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65,
+ 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2c, 0x20,
+ 0x73, 0x65, 0x65, 0x0a, 0x2d, 0x2d, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61,
+ 0x67, 0x65, 0x2d, 0x65, 0x78, 0x74, 0x72, 0x61, 0x2e, 0x73, 0x71, 0x6c,
+ 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x64, 0x65,
+ 0x74, 0x61, 0x69, 0x6c, 0x73, 0x2e, 0x0a, 0x2d, 0x2d, 0x0a, 0x0a, 0x44,
+ 0x52, 0x4f, 0x50, 0x20, 0x46, 0x4f, 0x52, 0x45, 0x49, 0x47, 0x4e, 0x20,
+ 0x54, 0x41, 0x42, 0x4c, 0x45, 0x20, 0x49, 0x46, 0x20, 0x45, 0x58, 0x49,
+ 0x53, 0x54, 0x53, 0x20, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x70, 0x61,
+ 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72,
+ 0x61, 0x69, 0x6e, 0x74, 0x73, 0x3b, 0x0a, 0x0a, 0x44, 0x52, 0x4f, 0x50,
+ 0x20, 0x46, 0x4f, 0x52, 0x45, 0x49, 0x47, 0x4e, 0x20, 0x54, 0x41, 0x42,
+ 0x4c, 0x45, 0x20, 0x49, 0x46, 0x20, 0x45, 0x58, 0x49, 0x53, 0x54, 0x53,
+ 0x20, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61,
+ 0x67, 0x65, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x73, 0x3b, 0x0a, 0x0a,
+ 0x44, 0x52, 0x4f, 0x50, 0x20, 0x46, 0x4f, 0x52, 0x45, 0x49, 0x47, 0x4e,
+ 0x20, 0x54, 0x41, 0x42, 0x4c, 0x45, 0x20, 0x49, 0x46, 0x20, 0x45, 0x58,
+ 0x49, 0x53, 0x54, 0x53, 0x20, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x70,
+ 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x65, 0x73, 0x74, 0x73,
+ 0x3b, 0x0a, 0x0a, 0x44, 0x52, 0x4f, 0x50, 0x20, 0x46, 0x4f, 0x52, 0x45,
+ 0x49, 0x47, 0x4e, 0x20, 0x54, 0x41, 0x42, 0x4c, 0x45, 0x20, 0x49, 0x46,
+ 0x20, 0x45, 0x58, 0x49, 0x53, 0x54, 0x53, 0x20, 0x62, 0x75, 0x69, 0x6c,
+ 0x64, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x3b, 0x0a, 0x0a,
+ 0x44, 0x52, 0x4f, 0x50, 0x20, 0x46, 0x4f, 0x52, 0x45, 0x49, 0x47, 0x4e,
+ 0x20, 0x54, 0x41, 0x42, 0x4c, 0x45, 0x20, 0x49, 0x46, 0x20, 0x45, 0x58,
+ 0x49, 0x53, 0x54, 0x53, 0x20, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x72,
+ 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x3b, 0x0a, 0x0a,
+ 0x44, 0x52, 0x4f, 0x50, 0x20, 0x46, 0x4f, 0x52, 0x45, 0x49, 0x47, 0x4e,
+ 0x20, 0x54, 0x41, 0x42, 0x4c, 0x45, 0x20, 0x49, 0x46, 0x20, 0x45, 0x58,
+ 0x49, 0x53, 0x54, 0x53, 0x20, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x74,
+ 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x3b, 0x0a, 0x0a, 0x2d, 0x2d, 0x20, 0x54,
+ 0x68, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x65, 0x69, 0x67, 0x6e, 0x20, 0x74,
+ 0x61, 0x62, 0x6c, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x62, 0x75, 0x69,
+ 0x6c, 0x64, 0x5f, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x20, 0x6f, 0x62,
+ 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x0a, 0x2d, 0x2d, 0x0a, 0x43, 0x52, 0x45,
+ 0x41, 0x54, 0x45, 0x20, 0x46, 0x4f, 0x52, 0x45, 0x49, 0x47, 0x4e, 0x20,
+ 0x54, 0x41, 0x42, 0x4c, 0x45, 0x20, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f,
+ 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x20, 0x28, 0x0a, 0x20, 0x20, 0x69,
+ 0x64, 0x20, 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4e,
+ 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x61, 0x72, 0x63, 0x68, 0x69,
+ 0x76, 0x65, 0x64, 0x20, 0x42, 0x4f, 0x4f, 0x4c, 0x45, 0x41, 0x4e, 0x20,
+ 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x29, 0x0a, 0x53, 0x45,
+ 0x52, 0x56, 0x45, 0x52, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65,
+ 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x4f, 0x50, 0x54, 0x49,
+ 0x4f, 0x4e, 0x53, 0x20, 0x28, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6e,
+ 0x61, 0x6d, 0x65, 0x20, 0x27, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x27,
+ 0x29, 0x3b, 0x0a, 0x0a, 0x2d, 0x2d, 0x20, 0x54, 0x68, 0x65, 0x20, 0x66,
+ 0x6f, 0x72, 0x65, 0x69, 0x67, 0x6e, 0x20, 0x74, 0x61, 0x62, 0x6c, 0x65,
+ 0x20, 0x66, 0x6f, 0x72, 0x20, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x72,
+ 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x20, 0x6f, 0x62,
+ 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x0a, 0x2d, 0x2d, 0x0a, 0x43, 0x52, 0x45,
+ 0x41, 0x54, 0x45, 0x20, 0x46, 0x4f, 0x52, 0x45, 0x49, 0x47, 0x4e, 0x20,
+ 0x54, 0x41, 0x42, 0x4c, 0x45, 0x20, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f,
+ 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x20, 0x28,
+ 0x0a, 0x20, 0x20, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x20, 0x54, 0x45,
+ 0x58, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c,
+ 0x0a, 0x20, 0x20, 0x63, 0x61, 0x6e, 0x6f, 0x6e, 0x69, 0x63, 0x61, 0x6c,
+ 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e,
+ 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x6c,
+ 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x20,
+ 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c,
+ 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f,
+ 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x20, 0x54, 0x45, 0x58, 0x54, 0x20,
+ 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20,
+ 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x5f,
+ 0x66, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x20,
+ 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x29, 0x0a, 0x53,
+ 0x45, 0x52, 0x56, 0x45, 0x52, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67,
+ 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x4f, 0x50, 0x54,
+ 0x49, 0x4f, 0x4e, 0x53, 0x20, 0x28, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f,
+ 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x27, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69,
+ 0x74, 0x6f, 0x72, 0x79, 0x27, 0x29, 0x3b, 0x0a, 0x0a, 0x2d, 0x2d, 0x20,
+ 0x54, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x65, 0x69, 0x67, 0x6e, 0x20,
+ 0x74, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x62, 0x75,
+ 0x69, 0x6c, 0x64, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20,
+ 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x0a, 0x2d, 0x2d, 0x0a, 0x43,
+ 0x52, 0x45, 0x41, 0x54, 0x45, 0x20, 0x46, 0x4f, 0x52, 0x45, 0x49, 0x47,
+ 0x4e, 0x20, 0x54, 0x41, 0x42, 0x4c, 0x45, 0x20, 0x62, 0x75, 0x69, 0x6c,
+ 0x64, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x28, 0x0a,
+ 0x20, 0x20, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x20, 0x54, 0x45, 0x58,
+ 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a,
+ 0x20, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x43, 0x49, 0x54, 0x45, 0x58,
+ 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a,
+ 0x20, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x70,
+ 0x6f, 0x63, 0x68, 0x20, 0x49, 0x4e, 0x54, 0x45, 0x47, 0x45, 0x52, 0x20,
+ 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20,
+ 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x61, 0x6e, 0x6f,
+ 0x6e, 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x75, 0x70, 0x73, 0x74, 0x72, 0x65,
+ 0x61, 0x6d, 0x20, 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x20,
+ 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x72, 0x73,
+ 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x61, 0x6e, 0x6f, 0x6e, 0x69, 0x63, 0x61,
+ 0x6c, 0x5f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x54, 0x45,
+ 0x58, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x20,
+ 0x43, 0x4f, 0x4c, 0x4c, 0x41, 0x54, 0x45, 0x20, 0x22, 0x43, 0x22, 0x2c,
+ 0x0a, 0x20, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x72,
+ 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x49, 0x4e, 0x54, 0x45,
+ 0x47, 0x45, 0x52, 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c,
+ 0x2c, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f,
+ 0x75, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x20, 0x54, 0x45, 0x58,
+ 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a,
+ 0x20, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65,
+ 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e,
+ 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72,
+ 0x6e, 0x61, 0x6c, 0x5f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f,
+ 0x72, 0x79, 0x5f, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x20, 0x54, 0x45,
+ 0x58, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x69,
+ 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x72, 0x65, 0x70, 0x6f,
+ 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x63, 0x61, 0x6e, 0x6f, 0x6e,
+ 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x54, 0x45,
+ 0x58, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x62,
+ 0x75, 0x69, 0x6c, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x42, 0x4f, 0x4f,
+ 0x4c, 0x45, 0x41, 0x4e, 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c,
+ 0x4c, 0x29, 0x0a, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x20, 0x70, 0x61,
+ 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
+ 0x20, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x20, 0x28, 0x74, 0x61,
+ 0x62, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x27, 0x70, 0x61,
+ 0x63, 0x6b, 0x61, 0x67, 0x65, 0x27, 0x29, 0x3b, 0x0a, 0x0a, 0x2d, 0x2d,
+ 0x20, 0x54, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x65, 0x69, 0x67, 0x6e,
+ 0x20, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74,
+ 0x68, 0x65, 0x20, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x70, 0x61, 0x63,
+ 0x6b, 0x61, 0x67, 0x65, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20,
+ 0x74, 0x65, 0x73, 0x74, 0x73, 0x20, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72,
+ 0x20, 0x28, 0x74, 0x68, 0x61, 0x74, 0x20, 0x69, 0x73, 0x20, 0x6f, 0x66,
+ 0x20, 0x61, 0x0a, 0x2d, 0x2d, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69,
+ 0x6e, 0x65, 0x72, 0x20, 0x74, 0x79, 0x70, 0x65, 0x29, 0x2e, 0x0a, 0x2d,
+ 0x2d, 0x0a, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x20, 0x46, 0x4f, 0x52,
+ 0x45, 0x49, 0x47, 0x4e, 0x20, 0x54, 0x41, 0x42, 0x4c, 0x45, 0x20, 0x62,
+ 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65,
+ 0x5f, 0x74, 0x65, 0x73, 0x74, 0x73, 0x20, 0x28, 0x0a, 0x20, 0x20, 0x74,
+ 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x20, 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e,
+ 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x6e,
+ 0x61, 0x6d, 0x65, 0x20, 0x43, 0x49, 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e,
+ 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x76,
+ 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68,
+ 0x20, 0x49, 0x4e, 0x54, 0x45, 0x47, 0x45, 0x52, 0x20, 0x4e, 0x4f, 0x54,
+ 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x72,
+ 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x61, 0x6e, 0x6f, 0x6e, 0x69, 0x63,
+ 0x61, 0x6c, 0x5f, 0x75, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x20,
+ 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c,
+ 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
+ 0x5f, 0x63, 0x61, 0x6e, 0x6f, 0x6e, 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x72,
+ 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x54, 0x45, 0x58, 0x54, 0x20,
+ 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x20, 0x43, 0x4f, 0x4c,
+ 0x4c, 0x41, 0x54, 0x45, 0x20, 0x22, 0x43, 0x22, 0x2c, 0x0a, 0x20, 0x20,
+ 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x76, 0x69,
+ 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x49, 0x4e, 0x54, 0x45, 0x47, 0x45, 0x52,
+ 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20,
+ 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20, 0x42, 0x49, 0x47, 0x49, 0x4e,
+ 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a,
+ 0x20, 0x20, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x20,
+ 0x43, 0x49, 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4e,
+ 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x74, 0x65, 0x73, 0x74, 0x5f,
+ 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x65, 0x6e, 0x61,
+ 0x6e, 0x74, 0x20, 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c,
+ 0x2c, 0x0a, 0x20, 0x20, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x61, 0x63,
+ 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x43, 0x49,
+ 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20,
+ 0x20, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67,
+ 0x65, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x70,
+ 0x6f, 0x63, 0x68, 0x20, 0x49, 0x4e, 0x54, 0x45, 0x47, 0x45, 0x52, 0x20,
+ 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x74, 0x65, 0x73, 0x74,
+ 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x76, 0x65, 0x72,
+ 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x61, 0x6e, 0x6f, 0x6e, 0x69, 0x63,
+ 0x61, 0x6c, 0x5f, 0x75, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x20,
+ 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20,
+ 0x20, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67,
+ 0x65, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x61,
+ 0x6e, 0x6f, 0x6e, 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x72, 0x65, 0x6c, 0x65,
+ 0x61, 0x73, 0x65, 0x20, 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e, 0x55, 0x4c,
+ 0x4c, 0x20, 0x43, 0x4f, 0x4c, 0x4c, 0x41, 0x54, 0x45, 0x20, 0x22, 0x43,
+ 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x61,
+ 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f,
+ 0x6e, 0x5f, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x49,
+ 0x4e, 0x54, 0x45, 0x47, 0x45, 0x52, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x29,
+ 0x0a, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x20, 0x70, 0x61, 0x63, 0x6b,
+ 0x61, 0x67, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x4f,
+ 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x20, 0x28, 0x74, 0x61, 0x62, 0x6c,
+ 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x27, 0x70, 0x61, 0x63, 0x6b,
+ 0x61, 0x67, 0x65, 0x5f, 0x74, 0x65, 0x73, 0x74, 0x73, 0x27, 0x29, 0x3b,
+ 0x0a, 0x0a, 0x2d, 0x2d, 0x20, 0x54, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x72,
+ 0x65, 0x69, 0x67, 0x6e, 0x20, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x66,
+ 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x62, 0x75, 0x69, 0x6c, 0x64,
+ 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x6f, 0x62, 0x6a,
+ 0x65, 0x63, 0x74, 0x20, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x73, 0x20, 0x6d,
+ 0x65, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x28, 0x74, 0x68, 0x61, 0x74, 0x20,
+ 0x69, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x0a, 0x2d, 0x2d, 0x20, 0x63,
+ 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x20, 0x74, 0x79, 0x70,
+ 0x65, 0x29, 0x2e, 0x0a, 0x2d, 0x2d, 0x0a, 0x43, 0x52, 0x45, 0x41, 0x54,
+ 0x45, 0x20, 0x46, 0x4f, 0x52, 0x45, 0x49, 0x47, 0x4e, 0x20, 0x54, 0x41,
+ 0x42, 0x4c, 0x45, 0x20, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x70, 0x61,
+ 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x73,
+ 0x20, 0x28, 0x0a, 0x20, 0x20, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x20,
+ 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c,
+ 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x43, 0x49,
+ 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c,
+ 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
+ 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x20, 0x49, 0x4e, 0x54, 0x45, 0x47,
+ 0x45, 0x52, 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c,
+ 0x0a, 0x20, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x63,
+ 0x61, 0x6e, 0x6f, 0x6e, 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x75, 0x70, 0x73,
+ 0x74, 0x72, 0x65, 0x61, 0x6d, 0x20, 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e,
+ 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x76,
+ 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x61, 0x6e, 0x6f, 0x6e,
+ 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65,
+ 0x20, 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55,
+ 0x4c, 0x4c, 0x20, 0x43, 0x4f, 0x4c, 0x4c, 0x41, 0x54, 0x45, 0x20, 0x22,
+ 0x43, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f,
+ 0x6e, 0x5f, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x49,
+ 0x4e, 0x54, 0x45, 0x47, 0x45, 0x52, 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4e,
+ 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78,
+ 0x20, 0x42, 0x49, 0x47, 0x49, 0x4e, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x20,
+ 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x65, 0x78, 0x70, 0x72,
+ 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x54, 0x45, 0x58, 0x54, 0x20,
+ 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20,
+ 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x54, 0x45, 0x58, 0x54,
+ 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x29, 0x0a, 0x53,
+ 0x45, 0x52, 0x56, 0x45, 0x52, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67,
+ 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x4f, 0x50, 0x54,
+ 0x49, 0x4f, 0x4e, 0x53, 0x20, 0x28, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f,
+ 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x27, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67,
+ 0x65, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x73, 0x27, 0x29, 0x3b, 0x0a,
+ 0x0a, 0x2d, 0x2d, 0x20, 0x54, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x65,
+ 0x69, 0x67, 0x6e, 0x20, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x66, 0x6f,
+ 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f,
+ 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x6f, 0x62, 0x6a, 0x65,
+ 0x63, 0x74, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e,
+ 0x74, 0x73, 0x20, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x28, 0x74,
+ 0x68, 0x61, 0x74, 0x20, 0x69, 0x73, 0x0a, 0x2d, 0x2d, 0x20, 0x6f, 0x66,
+ 0x20, 0x61, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72,
+ 0x20, 0x74, 0x79, 0x70, 0x65, 0x29, 0x2e, 0x0a, 0x2d, 0x2d, 0x0a, 0x43,
+ 0x52, 0x45, 0x41, 0x54, 0x45, 0x20, 0x46, 0x4f, 0x52, 0x45, 0x49, 0x47,
+ 0x4e, 0x20, 0x54, 0x41, 0x42, 0x4c, 0x45, 0x20, 0x62, 0x75, 0x69, 0x6c,
+ 0x64, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f,
+ 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x20, 0x28, 0x0a,
+ 0x20, 0x20, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x20, 0x54, 0x45, 0x58,
+ 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a,
+ 0x20, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x43, 0x49, 0x54, 0x45, 0x58,
+ 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a,
+ 0x20, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x70,
+ 0x6f, 0x63, 0x68, 0x20, 0x49, 0x4e, 0x54, 0x45, 0x47, 0x45, 0x52, 0x20,
+ 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20,
+ 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x61, 0x6e, 0x6f,
+ 0x6e, 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x75, 0x70, 0x73, 0x74, 0x72, 0x65,
+ 0x61, 0x6d, 0x20, 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x20,
+ 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x72, 0x73,
+ 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x61, 0x6e, 0x6f, 0x6e, 0x69, 0x63, 0x61,
+ 0x6c, 0x5f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x54, 0x45,
+ 0x58, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x20,
+ 0x43, 0x4f, 0x4c, 0x4c, 0x41, 0x54, 0x45, 0x20, 0x22, 0x43, 0x22, 0x2c,
+ 0x0a, 0x20, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x72,
+ 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x49, 0x4e, 0x54, 0x45,
+ 0x47, 0x45, 0x52, 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c,
+ 0x2c, 0x0a, 0x20, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20, 0x42, 0x49,
+ 0x47, 0x49, 0x4e, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c,
+ 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69,
+ 0x6f, 0x6e, 0x20, 0x42, 0x4f, 0x4f, 0x4c, 0x45, 0x41, 0x4e, 0x20, 0x4e,
+ 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x63,
+ 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x20, 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e,
+ 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x74,
+ 0x61, 0x72, 0x67, 0x65, 0x74, 0x20, 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e,
+ 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x65,
+ 0x6e, 0x74, 0x20, 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x20,
+ 0x4e, 0x55, 0x4c, 0x4c, 0x29, 0x0a, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52,
+ 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x65, 0x72,
+ 0x76, 0x65, 0x72, 0x20, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x20,
+ 0x28, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x20,
+ 0x27, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x62, 0x75, 0x69,
+ 0x6c, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e,
+ 0x74, 0x73, 0x27, 0x29, 0x3b, 0x0a
diff --git a/libbrep/build-odb.cxx b/libbrep/build-odb.cxx
new file mode 100644
index 0000000..1a75f07
--- /dev/null
+++ b/libbrep/build-odb.cxx
@@ -0,0 +1,4541 @@
+// -*- C++ -*-
+//
+// This file was generated by ODB, object-relational mapping (ORM)
+// compiler for C++.
+//
+
+#include <odb/pre.hxx>
+
+#include <libbrep/build-odb.hxx>
+
+#include <cassert>
+#include <cstring> // std::memcpy
+
+#include <odb/schema-catalog-impl.hxx>
+
+#include <odb/pgsql/traits.hxx>
+#include <odb/pgsql/database.hxx>
+#include <odb/pgsql/transaction.hxx>
+#include <odb/pgsql/connection.hxx>
+#include <odb/pgsql/statement.hxx>
+#include <odb/pgsql/statement-cache.hxx>
+#include <odb/pgsql/simple-object-statements.hxx>
+#include <odb/pgsql/view-statements.hxx>
+#include <odb/pgsql/section-statements.hxx>
+#include <odb/pgsql/container-statements.hxx>
+#include <odb/pgsql/exceptions.hxx>
+#include <odb/pgsql/prepared-query.hxx>
+#include <odb/pgsql/simple-object-result.hxx>
+#include <odb/pgsql/view-result.hxx>
+
+namespace odb
+{
+ // operation_result
+ //
+
+ bool access::composite_value_traits< ::bbot::operation_result, id_pgsql >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // operation
+ //
+ if (t[0UL])
+ {
+ i.operation_value.capacity (i.operation_size);
+ grew = true;
+ }
+
+ // status
+ //
+ if (t[1UL])
+ {
+ i.status_value.capacity (i.status_size);
+ grew = true;
+ }
+
+ // log
+ //
+ if (t[2UL])
+ {
+ i.log_value.capacity (i.log_size);
+ grew = true;
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::bbot::operation_result, id_pgsql >::
+ bind (pgsql::bind* b,
+ image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (b);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ std::size_t n (0);
+ ODB_POTENTIALLY_UNUSED (n);
+
+ // operation
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.operation_value.data ();
+ b[n].capacity = i.operation_value.capacity ();
+ b[n].size = &i.operation_size;
+ b[n].is_null = &i.operation_null;
+ n++;
+
+ // status
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.status_value.data ();
+ b[n].capacity = i.status_value.capacity ();
+ b[n].size = &i.status_size;
+ b[n].is_null = &i.status_null;
+ n++;
+
+ // log
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.log_value.data ();
+ b[n].capacity = i.log_value.capacity ();
+ b[n].size = &i.log_size;
+ b[n].is_null = &i.log_null;
+ n++;
+ }
+
+ bool access::composite_value_traits< ::bbot::operation_result, id_pgsql >::
+ init (image_type& i,
+ const value_type& o,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ bool grew (false);
+
+ // operation
+ //
+ {
+ ::std::string const& v =
+ o.operation;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.operation_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.operation_value,
+ size,
+ is_null,
+ v);
+ i.operation_null = is_null;
+ i.operation_size = size;
+ grew = grew || (cap != i.operation_value.capacity ());
+ }
+
+ // status
+ //
+ {
+ ::bbot::result_status const& v =
+ o.status;
+
+ // From build.hxx:35:12
+ ::std::string const& vt =
+ to_string (v);
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.status_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.status_value,
+ size,
+ is_null,
+ vt);
+ i.status_null = is_null;
+ i.status_size = size;
+ grew = grew || (cap != i.status_value.capacity ());
+ }
+
+ // log
+ //
+ {
+ ::std::string const& v =
+ o.log;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.log_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.log_value,
+ size,
+ is_null,
+ v);
+ i.log_null = is_null;
+ i.log_size = size;
+ grew = grew || (cap != i.log_value.capacity ());
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::bbot::operation_result, id_pgsql >::
+ init (value_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // operation
+ //
+ {
+ ::std::string& v =
+ o.operation;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.operation_value,
+ i.operation_size,
+ i.operation_null);
+ }
+
+ // status
+ //
+ {
+ ::bbot::result_status& v =
+ o.status;
+
+ ::std::string vt;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ vt,
+ i.status_value,
+ i.status_size,
+ i.status_null);
+
+ // From build.hxx:35:12
+ v = bbot::to_result_status (vt);
+ }
+
+ // log
+ //
+ {
+ ::std::string& v =
+ o.log;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.log_value,
+ i.log_size,
+ i.log_null);
+ }
+ }
+
+ // build_id
+ //
+
+ bool access::composite_value_traits< ::brep::build_id, id_pgsql >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // package
+ //
+ if (composite_value_traits< ::brep::package_id, id_pgsql >::grow (
+ i.package_value, t + 0UL))
+ grew = true;
+
+ // configuration
+ //
+ if (t[6UL])
+ {
+ i.configuration_value.capacity (i.configuration_size);
+ grew = true;
+ }
+
+ // toolchain_name
+ //
+ if (t[7UL])
+ {
+ i.toolchain_name_value.capacity (i.toolchain_name_size);
+ grew = true;
+ }
+
+ // toolchain_version
+ //
+ if (composite_value_traits< ::brep::canonical_version, id_pgsql >::grow (
+ i.toolchain_version_value, t + 8UL))
+ grew = true;
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::brep::build_id, id_pgsql >::
+ bind (pgsql::bind* b,
+ image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (b);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ std::size_t n (0);
+ ODB_POTENTIALLY_UNUSED (n);
+
+ // package
+ //
+ composite_value_traits< ::brep::package_id, id_pgsql >::bind (
+ b + n, i.package_value, sk);
+ n += 6UL;
+
+ // configuration
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.configuration_value.data ();
+ b[n].capacity = i.configuration_value.capacity ();
+ b[n].size = &i.configuration_size;
+ b[n].is_null = &i.configuration_null;
+ n++;
+
+ // toolchain_name
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.toolchain_name_value.data ();
+ b[n].capacity = i.toolchain_name_value.capacity ();
+ b[n].size = &i.toolchain_name_size;
+ b[n].is_null = &i.toolchain_name_null;
+ n++;
+
+ // toolchain_version
+ //
+ composite_value_traits< ::brep::canonical_version, id_pgsql >::bind (
+ b + n, i.toolchain_version_value, sk);
+ n += 4UL;
+ }
+
+ bool access::composite_value_traits< ::brep::build_id, id_pgsql >::
+ init (image_type& i,
+ const value_type& o,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ bool grew (false);
+
+ // package
+ //
+ {
+ ::brep::package_id const& v =
+ o.package;
+
+ if (composite_value_traits< ::brep::package_id, id_pgsql >::init (
+ i.package_value,
+ v,
+ sk))
+ grew = true;
+ }
+
+ // configuration
+ //
+ {
+ ::std::string const& v =
+ o.configuration;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.configuration_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.configuration_value,
+ size,
+ is_null,
+ v);
+ i.configuration_null = is_null;
+ i.configuration_size = size;
+ grew = grew || (cap != i.configuration_value.capacity ());
+ }
+
+ // toolchain_name
+ //
+ {
+ ::std::string const& v =
+ o.toolchain_name;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.toolchain_name_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.toolchain_name_value,
+ size,
+ is_null,
+ v);
+ i.toolchain_name_null = is_null;
+ i.toolchain_name_size = size;
+ grew = grew || (cap != i.toolchain_name_value.capacity ());
+ }
+
+ // toolchain_version
+ //
+ {
+ ::brep::canonical_version const& v =
+ o.toolchain_version;
+
+ if (composite_value_traits< ::brep::canonical_version, id_pgsql >::init (
+ i.toolchain_version_value,
+ v,
+ sk))
+ grew = true;
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::brep::build_id, id_pgsql >::
+ init (value_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // package
+ //
+ {
+ ::brep::package_id& v =
+ o.package;
+
+ composite_value_traits< ::brep::package_id, id_pgsql >::init (
+ v,
+ i.package_value,
+ db);
+ }
+
+ // configuration
+ //
+ {
+ ::std::string& v =
+ o.configuration;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.configuration_value,
+ i.configuration_size,
+ i.configuration_null);
+ }
+
+ // toolchain_name
+ //
+ {
+ ::std::string& v =
+ o.toolchain_name;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.toolchain_name_value,
+ i.toolchain_name_size,
+ i.toolchain_name_null);
+ }
+
+ // toolchain_version
+ //
+ {
+ ::brep::canonical_version& v =
+ o.toolchain_version;
+
+ composite_value_traits< ::brep::canonical_version, id_pgsql >::init (
+ v,
+ i.toolchain_version_value,
+ db);
+ }
+ }
+
+ // build
+ //
+
+ const char access::object_traits_impl< ::brep::build, id_pgsql >::
+ persist_statement_name[] = "persist_brep_build";
+
+ const char access::object_traits_impl< ::brep::build, id_pgsql >::
+ find_statement_name[] = "find_brep_build";
+
+ const char access::object_traits_impl< ::brep::build, id_pgsql >::
+ update_statement_name[] = "update_brep_build";
+
+ const char access::object_traits_impl< ::brep::build, id_pgsql >::
+ erase_statement_name[] = "erase_brep_build";
+
+ const char access::object_traits_impl< ::brep::build, id_pgsql >::
+ query_statement_name[] = "query_brep_build";
+
+ const char access::object_traits_impl< ::brep::build, id_pgsql >::
+ erase_query_statement_name[] = "erase_query_brep_build";
+
+ const unsigned int access::object_traits_impl< ::brep::build, id_pgsql >::
+ persist_statement_types[] =
+ {
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int8_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int8_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::text_oid
+ };
+
+ const unsigned int access::object_traits_impl< ::brep::build, id_pgsql >::
+ find_statement_types[] =
+ {
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid
+ };
+
+ const unsigned int access::object_traits_impl< ::brep::build, id_pgsql >::
+ update_statement_types[] =
+ {
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int8_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int8_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid
+ };
+
+ struct access::object_traits_impl< ::brep::build, id_pgsql >::extra_statement_cache_type
+ {
+ pgsql::container_statements_impl< results_traits > results;
+
+ pgsql::section_statements< ::brep::build, results_section_traits > results_section;
+
+ extra_statement_cache_type (
+ pgsql::connection& c,
+ image_type& im,
+ id_image_type& idim,
+ pgsql::binding& id,
+ pgsql::binding& idv,
+ pgsql::native_binding& idn,
+ const unsigned int* idt)
+ : results (c, id, idn, idt),
+ results_section (c, im, idim, id, idv, idn, idt)
+ {
+ }
+ };
+
+ // results
+ //
+
+ const char access::object_traits_impl< ::brep::build, id_pgsql >::results_traits::
+ select_name[] = "select_brep_build_results";
+
+ const char access::object_traits_impl< ::brep::build, id_pgsql >::results_traits::
+ insert_name[] = "insert_brep_build_results";
+
+ const char access::object_traits_impl< ::brep::build, id_pgsql >::results_traits::
+ delete_name[] = "delete_brep_build_results";
+
+ const unsigned int access::object_traits_impl< ::brep::build, id_pgsql >::results_traits::
+ insert_types[] =
+ {
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::int8_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::text_oid
+ };
+
+ const char access::object_traits_impl< ::brep::build, id_pgsql >::results_traits::
+ select_statement[] =
+ "SELECT "
+ "\"build_results\".\"index\", "
+ "\"build_results\".\"operation\", "
+ "\"build_results\".\"status\", "
+ "\"build_results\".\"log\" "
+ "FROM \"build_results\" "
+ "WHERE \"build_results\".\"package_tenant\"=$1 AND \"build_results\".\"package_name\"=$2::CITEXT AND \"build_results\".\"package_version_epoch\"=$3 AND \"build_results\".\"package_version_canonical_upstream\"=$4 AND \"build_results\".\"package_version_canonical_release\"=$5 AND \"build_results\".\"package_version_revision\"=$6 AND \"build_results\".\"configuration\"=$7 AND \"build_results\".\"toolchain_name\"=$8 AND \"build_results\".\"toolchain_version_epoch\"=$9 AND \"build_results\".\"toolchain_version_canonical_upstream\"=$10 AND \"build_results\".\"toolchain_version_canonical_release\"=$11 AND \"build_results\".\"toolchain_version_revision\"=$12 ORDER BY \"build_results\".\"index\"";
+
+ const char access::object_traits_impl< ::brep::build, id_pgsql >::results_traits::
+ insert_statement[] =
+ "INSERT INTO \"build_results\" "
+ "(\"package_tenant\", "
+ "\"package_name\", "
+ "\"package_version_epoch\", "
+ "\"package_version_canonical_upstream\", "
+ "\"package_version_canonical_release\", "
+ "\"package_version_revision\", "
+ "\"configuration\", "
+ "\"toolchain_name\", "
+ "\"toolchain_version_epoch\", "
+ "\"toolchain_version_canonical_upstream\", "
+ "\"toolchain_version_canonical_release\", "
+ "\"toolchain_version_revision\", "
+ "\"index\", "
+ "\"operation\", "
+ "\"status\", "
+ "\"log\") "
+ "VALUES "
+ "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16)";
+
+ const char access::object_traits_impl< ::brep::build, id_pgsql >::results_traits::
+ delete_statement[] =
+ "DELETE FROM \"build_results\" "
+ "WHERE \"package_tenant\"=$1 AND \"package_name\"=$2::CITEXT AND \"package_version_epoch\"=$3 AND \"package_version_canonical_upstream\"=$4 AND \"package_version_canonical_release\"=$5 AND \"package_version_revision\"=$6 AND \"configuration\"=$7 AND \"toolchain_name\"=$8 AND \"toolchain_version_epoch\"=$9 AND \"toolchain_version_canonical_upstream\"=$10 AND \"toolchain_version_canonical_release\"=$11 AND \"toolchain_version_revision\"=$12";
+
+ void access::object_traits_impl< ::brep::build, id_pgsql >::results_traits::
+ bind (pgsql::bind* b,
+ const pgsql::bind* id,
+ std::size_t id_size,
+ data_image_type& d)
+ {
+ using namespace pgsql;
+
+ statement_kind sk (statement_select);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ size_t n (0);
+
+ // object_id
+ //
+ if (id != 0)
+ std::memcpy (&b[n], id, id_size * sizeof (id[0]));
+ n += id_size;
+
+ // index
+ //
+ b[n].type = pgsql::bind::bigint;
+ b[n].buffer = &d.index_value;
+ b[n].is_null = &d.index_null;
+ n++;
+
+ // value
+ //
+ composite_value_traits< value_type, id_pgsql >::bind (
+ b + n, d.value_value, sk);
+ }
+
+ void access::object_traits_impl< ::brep::build, id_pgsql >::results_traits::
+ grow (data_image_type& i,
+ bool* t)
+ {
+ bool grew (false);
+
+ // index
+ //
+ t[0UL] = 0;
+
+ // value
+ //
+ if (composite_value_traits< value_type, id_pgsql >::grow (
+ i.value_value, t + 1UL))
+ grew = true;
+
+ if (grew)
+ i.version++;
+ }
+
+ void access::object_traits_impl< ::brep::build, id_pgsql >::results_traits::
+ init (data_image_type& i,
+ index_type* j,
+ const value_type& v)
+ {
+ using namespace pgsql;
+
+ statement_kind sk (statement_insert);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ bool grew (false);
+
+ // index
+ //
+ if (j != 0)
+ {
+ bool is_null (false);
+ pgsql::value_traits<
+ index_type,
+ pgsql::id_bigint >::set_image (
+ i.index_value, is_null, *j);
+ i.index_null = is_null;
+ }
+
+ // value
+ //
+ {
+ if (composite_value_traits< value_type, id_pgsql >::init (
+ i.value_value,
+ v,
+ sk))
+ grew = true;
+ }
+
+ if (grew)
+ i.version++;
+ }
+
+ void access::object_traits_impl< ::brep::build, id_pgsql >::results_traits::
+ init (index_type& j,
+ value_type& v,
+ const data_image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // index
+ //
+ {
+ pgsql::value_traits<
+ index_type,
+ pgsql::id_bigint >::set_value (
+ j,
+ i.index_value,
+ i.index_null);
+ }
+
+ // value
+ //
+ {
+ composite_value_traits< value_type, id_pgsql >::init (
+ v,
+ i.value_value,
+ db);
+ }
+ }
+
+ void access::object_traits_impl< ::brep::build, id_pgsql >::results_traits::
+ insert (index_type i, const value_type& v, void* d)
+ {
+ using namespace pgsql;
+
+ statements_type& sts (*static_cast< statements_type* > (d));
+ data_image_type& di (sts.data_image ());
+
+ init (di, &i, v);
+
+ if (sts.data_binding_test_version ())
+ {
+ const binding& id (sts.id_binding ());
+ bind (sts.data_bind (), id.bind, id.count, di);
+ sts.data_binding_update_version ();
+ }
+
+ if (!sts.insert_statement ().execute ())
+ throw object_already_persistent ();
+ }
+
+ bool access::object_traits_impl< ::brep::build, id_pgsql >::results_traits::
+ select (index_type& i, value_type& v, void* d)
+ {
+ using namespace pgsql;
+ using pgsql::select_statement;
+
+ statements_type& sts (*static_cast< statements_type* > (d));
+ data_image_type& di (sts.data_image ());
+
+ init (i, v, di, &sts.connection ().database ());
+
+ select_statement& st (sts.select_statement ());
+ select_statement::result r (st.fetch ());
+
+ if (r == select_statement::truncated)
+ {
+ grow (di, sts.select_image_truncated ());
+
+ if (sts.data_binding_test_version ())
+ {
+ bind (sts.data_bind (), 0, sts.id_binding ().count, di);
+ sts.data_binding_update_version ();
+ st.refetch ();
+ }
+ }
+
+ return r != select_statement::no_data;
+ }
+
+ void access::object_traits_impl< ::brep::build, id_pgsql >::results_traits::
+ delete_ (void* d)
+ {
+ using namespace pgsql;
+
+ statements_type& sts (*static_cast< statements_type* > (d));
+ sts.delete_statement ().execute ();
+ }
+
+ void access::object_traits_impl< ::brep::build, id_pgsql >::results_traits::
+ persist (const container_type& c,
+ statements_type& sts)
+ {
+ using namespace pgsql;
+
+ functions_type& fs (sts.functions ());
+ fs.ordered_ = true;
+ container_traits_type::persist (c, fs);
+ }
+
+ void access::object_traits_impl< ::brep::build, id_pgsql >::results_traits::
+ load (container_type& c,
+ statements_type& sts)
+ {
+ using namespace pgsql;
+ using pgsql::select_statement;
+
+ const binding& id (sts.id_binding ());
+
+ if (sts.data_binding_test_version ())
+ {
+ bind (sts.data_bind (), id.bind, id.count, sts.data_image ());
+ sts.data_binding_update_version ();
+ }
+
+ select_statement& st (sts.select_statement ());
+ st.execute ();
+ auto_result ar (st);
+ select_statement::result r (st.fetch ());
+
+ if (r == select_statement::truncated)
+ {
+ data_image_type& di (sts.data_image ());
+ grow (di, sts.select_image_truncated ());
+
+ if (sts.data_binding_test_version ())
+ {
+ bind (sts.data_bind (), 0, id.count, di);
+ sts.data_binding_update_version ();
+ st.refetch ();
+ }
+ }
+
+ bool more (r != select_statement::no_data);
+
+ functions_type& fs (sts.functions ());
+ fs.ordered_ = true;
+ container_traits_type::load (c, more, fs);
+ }
+
+ void access::object_traits_impl< ::brep::build, id_pgsql >::results_traits::
+ update (const container_type& c,
+ statements_type& sts)
+ {
+ using namespace pgsql;
+
+ functions_type& fs (sts.functions ());
+ fs.ordered_ = true;
+ container_traits_type::update (c, fs);
+ }
+
+ void access::object_traits_impl< ::brep::build, id_pgsql >::results_traits::
+ erase (statements_type& sts)
+ {
+ using namespace pgsql;
+
+ functions_type& fs (sts.functions ());
+ fs.ordered_ = true;
+ container_traits_type::erase (fs);
+ }
+
+ // results_section
+ //
+
+ void access::object_traits_impl< ::brep::build, id_pgsql >::results_section_traits::
+ load (extra_statement_cache_type& esc, object_type& obj)
+ {
+ // results
+ //
+ {
+ ::bbot::operation_results& v =
+ obj.results;
+
+ results_traits::load (
+ v,
+ esc.results);
+ }
+ }
+
+ void access::object_traits_impl< ::brep::build, id_pgsql >::results_section_traits::
+ update (extra_statement_cache_type& esc, const object_type& obj)
+ {
+ // results
+ //
+ {
+ ::bbot::operation_results const& v =
+ obj.results;
+
+ results_traits::update (
+ v,
+ esc.results);
+ }
+ }
+
+ access::object_traits_impl< ::brep::build, id_pgsql >::id_type
+ access::object_traits_impl< ::brep::build, id_pgsql >::
+ id (const image_type& i)
+ {
+ pgsql::database* db (0);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ id_type id;
+ {
+ composite_value_traits< ::brep::build_id, id_pgsql >::init (
+ id,
+ i.id_value,
+ db);
+ }
+
+ return id;
+ }
+
+ bool access::object_traits_impl< ::brep::build, id_pgsql >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // id
+ //
+ if (composite_value_traits< ::brep::build_id, id_pgsql >::grow (
+ i.id_value, t + 0UL))
+ grew = true;
+
+ // package_version
+ //
+ if (composite_value_traits< ::brep::upstream_version, id_pgsql >::grow (
+ i.package_version_value, t + 12UL))
+ grew = true;
+
+ // toolchain_version
+ //
+ if (composite_value_traits< ::brep::upstream_version, id_pgsql >::grow (
+ i.toolchain_version_value, t + 14UL))
+ grew = true;
+
+ // state
+ //
+ if (t[16UL])
+ {
+ i.state_value.capacity (i.state_size);
+ grew = true;
+ }
+
+ // timestamp
+ //
+ t[17UL] = 0;
+
+ // force
+ //
+ if (t[18UL])
+ {
+ i.force_value.capacity (i.force_size);
+ grew = true;
+ }
+
+ // status
+ //
+ if (t[19UL])
+ {
+ i.status_value.capacity (i.status_size);
+ grew = true;
+ }
+
+ // completion_timestamp
+ //
+ t[20UL] = 0;
+
+ // agent_fingerprint
+ //
+ if (t[21UL])
+ {
+ i.agent_fingerprint_value.capacity (i.agent_fingerprint_size);
+ grew = true;
+ }
+
+ // agent_challenge
+ //
+ if (t[22UL])
+ {
+ i.agent_challenge_value.capacity (i.agent_challenge_size);
+ grew = true;
+ }
+
+ // machine
+ //
+ if (t[23UL])
+ {
+ i.machine_value.capacity (i.machine_size);
+ grew = true;
+ }
+
+ // machine_summary
+ //
+ if (t[24UL])
+ {
+ i.machine_summary_value.capacity (i.machine_summary_size);
+ grew = true;
+ }
+
+ // target
+ //
+ if (t[25UL])
+ {
+ i.target_value.capacity (i.target_size);
+ grew = true;
+ }
+
+ return grew;
+ }
+
+ void access::object_traits_impl< ::brep::build, id_pgsql >::
+ bind (pgsql::bind* b,
+ image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ std::size_t n (0);
+
+ // id
+ //
+ if (sk != statement_update)
+ {
+ composite_value_traits< ::brep::build_id, id_pgsql >::bind (
+ b + n, i.id_value, sk);
+ n += 12UL;
+ }
+
+ // package_version
+ //
+ composite_value_traits< ::brep::upstream_version, id_pgsql >::bind (
+ b + n, i.package_version_value, sk);
+ n += 2UL;
+
+ // toolchain_version
+ //
+ composite_value_traits< ::brep::upstream_version, id_pgsql >::bind (
+ b + n, i.toolchain_version_value, sk);
+ n += 2UL;
+
+ // state
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.state_value.data ();
+ b[n].capacity = i.state_value.capacity ();
+ b[n].size = &i.state_size;
+ b[n].is_null = &i.state_null;
+ n++;
+
+ // timestamp
+ //
+ b[n].type = pgsql::bind::bigint;
+ b[n].buffer = &i.timestamp_value;
+ b[n].is_null = &i.timestamp_null;
+ n++;
+
+ // force
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.force_value.data ();
+ b[n].capacity = i.force_value.capacity ();
+ b[n].size = &i.force_size;
+ b[n].is_null = &i.force_null;
+ n++;
+
+ // status
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.status_value.data ();
+ b[n].capacity = i.status_value.capacity ();
+ b[n].size = &i.status_size;
+ b[n].is_null = &i.status_null;
+ n++;
+
+ // completion_timestamp
+ //
+ b[n].type = pgsql::bind::bigint;
+ b[n].buffer = &i.completion_timestamp_value;
+ b[n].is_null = &i.completion_timestamp_null;
+ n++;
+
+ // agent_fingerprint
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.agent_fingerprint_value.data ();
+ b[n].capacity = i.agent_fingerprint_value.capacity ();
+ b[n].size = &i.agent_fingerprint_size;
+ b[n].is_null = &i.agent_fingerprint_null;
+ n++;
+
+ // agent_challenge
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.agent_challenge_value.data ();
+ b[n].capacity = i.agent_challenge_value.capacity ();
+ b[n].size = &i.agent_challenge_size;
+ b[n].is_null = &i.agent_challenge_null;
+ n++;
+
+ // machine
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.machine_value.data ();
+ b[n].capacity = i.machine_value.capacity ();
+ b[n].size = &i.machine_size;
+ b[n].is_null = &i.machine_null;
+ n++;
+
+ // machine_summary
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.machine_summary_value.data ();
+ b[n].capacity = i.machine_summary_value.capacity ();
+ b[n].size = &i.machine_summary_size;
+ b[n].is_null = &i.machine_summary_null;
+ n++;
+
+ // target
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.target_value.data ();
+ b[n].capacity = i.target_value.capacity ();
+ b[n].size = &i.target_size;
+ b[n].is_null = &i.target_null;
+ n++;
+ }
+
+ void access::object_traits_impl< ::brep::build, id_pgsql >::
+ bind (pgsql::bind* b, id_image_type& i)
+ {
+ std::size_t n (0);
+ pgsql::statement_kind sk (pgsql::statement_select);
+ composite_value_traits< ::brep::build_id, id_pgsql >::bind (
+ b + n, i.id_value, sk);
+ }
+
+ bool access::object_traits_impl< ::brep::build, id_pgsql >::
+ init (image_type& i,
+ const object_type& o,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ bool grew (false);
+
+ // id
+ //
+ if (sk == statement_insert)
+ {
+ ::brep::build_id const& v =
+ o.id;
+
+ if (composite_value_traits< ::brep::build_id, id_pgsql >::init (
+ i.id_value,
+ v,
+ sk))
+ grew = true;
+ }
+
+ // package_version
+ //
+ {
+ ::brep::upstream_version const& v =
+ o.package_version;
+
+ if (composite_value_traits< ::brep::upstream_version, id_pgsql >::init (
+ i.package_version_value,
+ v,
+ sk))
+ grew = true;
+ }
+
+ // toolchain_version
+ //
+ {
+ ::brep::upstream_version const& v =
+ o.toolchain_version;
+
+ if (composite_value_traits< ::brep::upstream_version, id_pgsql >::init (
+ i.toolchain_version_value,
+ v,
+ sk))
+ grew = true;
+ }
+
+ // state
+ //
+ {
+ ::brep::build_state const& v =
+ o.state;
+
+ // From build.hxx:122:14
+ ::std::string const& vt =
+ to_string (v);
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.state_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.state_value,
+ size,
+ is_null,
+ vt);
+ i.state_null = is_null;
+ i.state_size = size;
+ grew = grew || (cap != i.state_value.capacity ());
+ }
+
+ // timestamp
+ //
+ {
+ ::brep::build::timestamp_type const& v =
+ o.timestamp;
+
+ // From common.hxx:119:14
+ ::uint64_t const& vt =
+ std::chrono::duration_cast < std::chrono::nanoseconds > ((v).time_since_epoch ()).count ();
+
+ bool is_null (false);
+ pgsql::value_traits<
+ ::uint64_t,
+ pgsql::id_bigint >::set_image (
+ i.timestamp_value, is_null, vt);
+ i.timestamp_null = is_null;
+ }
+
+ // force
+ //
+ {
+ ::brep::force_state const& v =
+ o.force;
+
+ // From build.hxx:144:14
+ ::std::string const& vt =
+ to_string (v);
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.force_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.force_value,
+ size,
+ is_null,
+ vt);
+ i.force_null = is_null;
+ i.force_size = size;
+ grew = grew || (cap != i.force_value.capacity ());
+ }
+
+ // status
+ //
+ {
+ ::butl::optional< ::bbot::result_status > const& v =
+ o.status;
+
+ // From build.hxx:154:14
+ ::brep::optional_string const& vt =
+ (v) ? bbot::to_string ( * (v)) : brep::optional_string ();
+
+ bool is_null (true);
+ std::size_t size (0);
+ std::size_t cap (i.status_value.capacity ());
+ pgsql::value_traits<
+ ::brep::optional_string,
+ pgsql::id_string >::set_image (
+ i.status_value,
+ size,
+ is_null,
+ vt);
+ i.status_null = is_null;
+ i.status_size = size;
+ grew = grew || (cap != i.status_value.capacity ());
+ }
+
+ // completion_timestamp
+ //
+ {
+ ::brep::build::timestamp_type const& v =
+ o.completion_timestamp;
+
+ // From common.hxx:119:14
+ ::uint64_t const& vt =
+ std::chrono::duration_cast < std::chrono::nanoseconds > ((v).time_since_epoch ()).count ();
+
+ bool is_null (false);
+ pgsql::value_traits<
+ ::uint64_t,
+ pgsql::id_bigint >::set_image (
+ i.completion_timestamp_value, is_null, vt);
+ i.completion_timestamp_null = is_null;
+ }
+
+ // agent_fingerprint
+ //
+ {
+ ::butl::optional< ::std::basic_string< char > > const& v =
+ o.agent_fingerprint;
+
+ bool is_null (true);
+ std::size_t size (0);
+ std::size_t cap (i.agent_fingerprint_value.capacity ());
+ pgsql::value_traits<
+ ::butl::optional< ::std::basic_string< char > >,
+ pgsql::id_string >::set_image (
+ i.agent_fingerprint_value,
+ size,
+ is_null,
+ v);
+ i.agent_fingerprint_null = is_null;
+ i.agent_fingerprint_size = size;
+ grew = grew || (cap != i.agent_fingerprint_value.capacity ());
+ }
+
+ // agent_challenge
+ //
+ {
+ ::butl::optional< ::std::basic_string< char > > const& v =
+ o.agent_challenge;
+
+ bool is_null (true);
+ std::size_t size (0);
+ std::size_t cap (i.agent_challenge_value.capacity ());
+ pgsql::value_traits<
+ ::butl::optional< ::std::basic_string< char > >,
+ pgsql::id_string >::set_image (
+ i.agent_challenge_value,
+ size,
+ is_null,
+ v);
+ i.agent_challenge_null = is_null;
+ i.agent_challenge_size = size;
+ grew = grew || (cap != i.agent_challenge_value.capacity ());
+ }
+
+ // machine
+ //
+ {
+ ::std::string const& v =
+ o.machine;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.machine_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.machine_value,
+ size,
+ is_null,
+ v);
+ i.machine_null = is_null;
+ i.machine_size = size;
+ grew = grew || (cap != i.machine_value.capacity ());
+ }
+
+ // machine_summary
+ //
+ {
+ ::std::string const& v =
+ o.machine_summary;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.machine_summary_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.machine_summary_value,
+ size,
+ is_null,
+ v);
+ i.machine_summary_null = is_null;
+ i.machine_summary_size = size;
+ grew = grew || (cap != i.machine_summary_value.capacity ());
+ }
+
+ // target
+ //
+ {
+ ::butl::target_triplet const& v =
+ o.target;
+
+ // From build.hxx:162:14
+ ::std::string const& vt =
+ (v).string ();
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.target_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.target_value,
+ size,
+ is_null,
+ vt);
+ i.target_null = is_null;
+ i.target_size = size;
+ grew = grew || (cap != i.target_value.capacity ());
+ }
+
+ return grew;
+ }
+
+ void access::object_traits_impl< ::brep::build, id_pgsql >::
+ init (object_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // id
+ //
+ {
+ ::brep::build_id& v =
+ o.id;
+
+ composite_value_traits< ::brep::build_id, id_pgsql >::init (
+ v,
+ i.id_value,
+ db);
+ }
+
+ // package_version
+ //
+ {
+ // From build.hxx:247:7
+ ::brep::upstream_version v;
+
+ composite_value_traits< ::brep::upstream_version, id_pgsql >::init (
+ v,
+ i.package_version_value,
+ db);
+
+ // From build.hxx:247:7
+ o.package_version.init (o.id.package.version, (v));
+ }
+
+ // toolchain_version
+ //
+ {
+ // From build.hxx:251:7
+ ::brep::upstream_version v;
+
+ composite_value_traits< ::brep::upstream_version, id_pgsql >::init (
+ v,
+ i.toolchain_version_value,
+ db);
+
+ // From build.hxx:251:7
+ o.toolchain_version.init (o.id.toolchain_version, (v));
+ }
+
+ // state
+ //
+ {
+ ::brep::build_state& v =
+ o.state;
+
+ ::std::string vt;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ vt,
+ i.state_value,
+ i.state_size,
+ i.state_null);
+
+ // From build.hxx:122:14
+ v = brep::to_build_state (vt);
+ }
+
+ // timestamp
+ //
+ {
+ ::brep::build::timestamp_type& v =
+ o.timestamp;
+
+ ::uint64_t vt;
+
+ pgsql::value_traits<
+ ::uint64_t,
+ pgsql::id_bigint >::set_value (
+ vt,
+ i.timestamp_value,
+ i.timestamp_null);
+
+ // From common.hxx:119:14
+ v = brep::timestamp (std::chrono::duration_cast < brep::timestamp::duration > (std::chrono::nanoseconds (vt)));
+ }
+
+ // force
+ //
+ {
+ ::brep::force_state& v =
+ o.force;
+
+ ::std::string vt;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ vt,
+ i.force_value,
+ i.force_size,
+ i.force_null);
+
+ // From build.hxx:144:14
+ v = brep::to_force_state (vt);
+ }
+
+ // status
+ //
+ {
+ ::butl::optional< ::bbot::result_status >& v =
+ o.status;
+
+ ::brep::optional_string vt;
+
+ pgsql::value_traits<
+ ::brep::optional_string,
+ pgsql::id_string >::set_value (
+ vt,
+ i.status_value,
+ i.status_size,
+ i.status_null);
+
+ // From build.hxx:154:14
+ v = (vt) ? bbot::to_result_status ( * (vt)) : brep::optional_result_status ();
+ }
+
+ // completion_timestamp
+ //
+ {
+ ::brep::build::timestamp_type& v =
+ o.completion_timestamp;
+
+ ::uint64_t vt;
+
+ pgsql::value_traits<
+ ::uint64_t,
+ pgsql::id_bigint >::set_value (
+ vt,
+ i.completion_timestamp_value,
+ i.completion_timestamp_null);
+
+ // From common.hxx:119:14
+ v = brep::timestamp (std::chrono::duration_cast < brep::timestamp::duration > (std::chrono::nanoseconds (vt)));
+ }
+
+ // agent_fingerprint
+ //
+ {
+ ::butl::optional< ::std::basic_string< char > >& v =
+ o.agent_fingerprint;
+
+ pgsql::value_traits<
+ ::butl::optional< ::std::basic_string< char > >,
+ pgsql::id_string >::set_value (
+ v,
+ i.agent_fingerprint_value,
+ i.agent_fingerprint_size,
+ i.agent_fingerprint_null);
+ }
+
+ // agent_challenge
+ //
+ {
+ ::butl::optional< ::std::basic_string< char > >& v =
+ o.agent_challenge;
+
+ pgsql::value_traits<
+ ::butl::optional< ::std::basic_string< char > >,
+ pgsql::id_string >::set_value (
+ v,
+ i.agent_challenge_value,
+ i.agent_challenge_size,
+ i.agent_challenge_null);
+ }
+
+ // machine
+ //
+ {
+ ::std::string& v =
+ o.machine;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.machine_value,
+ i.machine_size,
+ i.machine_null);
+ }
+
+ // machine_summary
+ //
+ {
+ ::std::string& v =
+ o.machine_summary;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.machine_summary_value,
+ i.machine_summary_size,
+ i.machine_summary_null);
+ }
+
+ // target
+ //
+ {
+ ::butl::target_triplet& v =
+ o.target;
+
+ ::std::string vt;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ vt,
+ i.target_value,
+ i.target_size,
+ i.target_null);
+
+ // From build.hxx:162:14
+ v = butl::target_triplet (vt);
+ }
+ }
+
+ void access::object_traits_impl< ::brep::build, id_pgsql >::
+ init (id_image_type& i, const id_type& id)
+ {
+ bool grew (false);
+ pgsql::statement_kind sk (pgsql::statement_select);
+ {
+ if (composite_value_traits< ::brep::build_id, id_pgsql >::init (
+ i.id_value,
+ id,
+ sk))
+ grew = true;
+ }
+
+ if (grew)
+ i.version++;
+ }
+
+ const char access::object_traits_impl< ::brep::build, id_pgsql >::persist_statement[] =
+ "INSERT INTO \"build\" "
+ "(\"package_tenant\", "
+ "\"package_name\", "
+ "\"package_version_epoch\", "
+ "\"package_version_canonical_upstream\", "
+ "\"package_version_canonical_release\", "
+ "\"package_version_revision\", "
+ "\"configuration\", "
+ "\"toolchain_name\", "
+ "\"toolchain_version_epoch\", "
+ "\"toolchain_version_canonical_upstream\", "
+ "\"toolchain_version_canonical_release\", "
+ "\"toolchain_version_revision\", "
+ "\"package_version_upstream\", "
+ "\"package_version_release\", "
+ "\"toolchain_version_upstream\", "
+ "\"toolchain_version_release\", "
+ "\"state\", "
+ "\"timestamp\", "
+ "\"force\", "
+ "\"status\", "
+ "\"completion_timestamp\", "
+ "\"agent_fingerprint\", "
+ "\"agent_challenge\", "
+ "\"machine\", "
+ "\"machine_summary\", "
+ "\"target\") "
+ "VALUES "
+ "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26)";
+
+ const char access::object_traits_impl< ::brep::build, id_pgsql >::find_statement[] =
+ "SELECT "
+ "\"build\".\"package_tenant\", "
+ "\"build\".\"package_name\"::TEXT, "
+ "\"build\".\"package_version_epoch\", "
+ "\"build\".\"package_version_canonical_upstream\", "
+ "\"build\".\"package_version_canonical_release\", "
+ "\"build\".\"package_version_revision\", "
+ "\"build\".\"configuration\", "
+ "\"build\".\"toolchain_name\", "
+ "\"build\".\"toolchain_version_epoch\", "
+ "\"build\".\"toolchain_version_canonical_upstream\", "
+ "\"build\".\"toolchain_version_canonical_release\", "
+ "\"build\".\"toolchain_version_revision\", "
+ "\"build\".\"package_version_upstream\", "
+ "\"build\".\"package_version_release\", "
+ "\"build\".\"toolchain_version_upstream\", "
+ "\"build\".\"toolchain_version_release\", "
+ "\"build\".\"state\", "
+ "\"build\".\"timestamp\", "
+ "\"build\".\"force\", "
+ "\"build\".\"status\", "
+ "\"build\".\"completion_timestamp\", "
+ "\"build\".\"agent_fingerprint\", "
+ "\"build\".\"agent_challenge\", "
+ "\"build\".\"machine\", "
+ "\"build\".\"machine_summary\", "
+ "\"build\".\"target\" "
+ "FROM \"build\" "
+ "WHERE \"build\".\"package_tenant\"=$1 AND \"build\".\"package_name\"=$2::CITEXT AND \"build\".\"package_version_epoch\"=$3 AND \"build\".\"package_version_canonical_upstream\"=$4 AND \"build\".\"package_version_canonical_release\"=$5 AND \"build\".\"package_version_revision\"=$6 AND \"build\".\"configuration\"=$7 AND \"build\".\"toolchain_name\"=$8 AND \"build\".\"toolchain_version_epoch\"=$9 AND \"build\".\"toolchain_version_canonical_upstream\"=$10 AND \"build\".\"toolchain_version_canonical_release\"=$11 AND \"build\".\"toolchain_version_revision\"=$12";
+
+ const char access::object_traits_impl< ::brep::build, id_pgsql >::update_statement[] =
+ "UPDATE \"build\" "
+ "SET "
+ "\"package_version_upstream\"=$1, "
+ "\"package_version_release\"=$2, "
+ "\"toolchain_version_upstream\"=$3, "
+ "\"toolchain_version_release\"=$4, "
+ "\"state\"=$5, "
+ "\"timestamp\"=$6, "
+ "\"force\"=$7, "
+ "\"status\"=$8, "
+ "\"completion_timestamp\"=$9, "
+ "\"agent_fingerprint\"=$10, "
+ "\"agent_challenge\"=$11, "
+ "\"machine\"=$12, "
+ "\"machine_summary\"=$13, "
+ "\"target\"=$14 "
+ "WHERE \"package_tenant\"=$15 AND \"package_name\"=$16::CITEXT AND \"package_version_epoch\"=$17 AND \"package_version_canonical_upstream\"=$18 AND \"package_version_canonical_release\"=$19 AND \"package_version_revision\"=$20 AND \"configuration\"=$21 AND \"toolchain_name\"=$22 AND \"toolchain_version_epoch\"=$23 AND \"toolchain_version_canonical_upstream\"=$24 AND \"toolchain_version_canonical_release\"=$25 AND \"toolchain_version_revision\"=$26";
+
+ const char access::object_traits_impl< ::brep::build, id_pgsql >::erase_statement[] =
+ "DELETE FROM \"build\" "
+ "WHERE \"package_tenant\"=$1 AND \"package_name\"=$2::CITEXT AND \"package_version_epoch\"=$3 AND \"package_version_canonical_upstream\"=$4 AND \"package_version_canonical_release\"=$5 AND \"package_version_revision\"=$6 AND \"configuration\"=$7 AND \"toolchain_name\"=$8 AND \"toolchain_version_epoch\"=$9 AND \"toolchain_version_canonical_upstream\"=$10 AND \"toolchain_version_canonical_release\"=$11 AND \"toolchain_version_revision\"=$12";
+
+ const char access::object_traits_impl< ::brep::build, id_pgsql >::query_statement[] =
+ "SELECT "
+ "\"build\".\"package_tenant\", "
+ "\"build\".\"package_name\"::TEXT, "
+ "\"build\".\"package_version_epoch\", "
+ "\"build\".\"package_version_canonical_upstream\", "
+ "\"build\".\"package_version_canonical_release\", "
+ "\"build\".\"package_version_revision\", "
+ "\"build\".\"configuration\", "
+ "\"build\".\"toolchain_name\", "
+ "\"build\".\"toolchain_version_epoch\", "
+ "\"build\".\"toolchain_version_canonical_upstream\", "
+ "\"build\".\"toolchain_version_canonical_release\", "
+ "\"build\".\"toolchain_version_revision\", "
+ "\"build\".\"package_version_upstream\", "
+ "\"build\".\"package_version_release\", "
+ "\"build\".\"toolchain_version_upstream\", "
+ "\"build\".\"toolchain_version_release\", "
+ "\"build\".\"state\", "
+ "\"build\".\"timestamp\", "
+ "\"build\".\"force\", "
+ "\"build\".\"status\", "
+ "\"build\".\"completion_timestamp\", "
+ "\"build\".\"agent_fingerprint\", "
+ "\"build\".\"agent_challenge\", "
+ "\"build\".\"machine\", "
+ "\"build\".\"machine_summary\", "
+ "\"build\".\"target\" "
+ "FROM \"build\"";
+
+ const char access::object_traits_impl< ::brep::build, id_pgsql >::erase_query_statement[] =
+ "DELETE FROM \"build\"";
+
+ const char access::object_traits_impl< ::brep::build, id_pgsql >::table_name[] =
+ "\"build\"";
+
+ void access::object_traits_impl< ::brep::build, id_pgsql >::
+ persist (database& db, const object_type& obj)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+
+ using namespace pgsql;
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ callback (db,
+ obj,
+ callback_event::pre_persist);
+
+ image_type& im (sts.image ());
+ binding& imb (sts.insert_image_binding ());
+
+ if (init (im, obj, statement_insert))
+ im.version++;
+
+ if (im.version != sts.insert_image_version () ||
+ imb.version == 0)
+ {
+ bind (imb.bind, im, statement_insert);
+ sts.insert_image_version (im.version);
+ imb.version++;
+ }
+
+ insert_statement& st (sts.persist_statement ());
+ if (!st.execute ())
+ throw object_already_persistent ();
+
+ id_image_type& i (sts.id_image ());
+ init (i, id (obj));
+
+ binding& idb (sts.id_image_binding ());
+ if (i.version != sts.id_image_version () || idb.version == 0)
+ {
+ bind (idb.bind, i);
+ sts.id_image_version (i.version);
+ idb.version++;
+ }
+
+ extra_statement_cache_type& esc (sts.extra_statement_cache ());
+
+ // results
+ //
+ {
+ ::bbot::operation_results const& v =
+ obj.results;
+
+ results_traits::persist (
+ v,
+ esc.results);
+ }
+
+ obj.results_section.reset (true, false);
+
+ callback (db,
+ obj,
+ callback_event::post_persist);
+ }
+
+ void access::object_traits_impl< ::brep::build, id_pgsql >::
+ update (database& db, const object_type& obj)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+
+ using namespace pgsql;
+ using pgsql::update_statement;
+
+ callback (db, obj, callback_event::pre_update);
+
+ pgsql::transaction& tr (pgsql::transaction::current ());
+ pgsql::connection& conn (tr.connection ());
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ id_image_type& idi (sts.id_image ());
+ init (idi, id (obj));
+
+ image_type& im (sts.image ());
+ if (init (im, obj, statement_update))
+ im.version++;
+
+ bool u (false);
+ binding& imb (sts.update_image_binding ());
+ if (im.version != sts.update_image_version () ||
+ imb.version == 0)
+ {
+ bind (imb.bind, im, statement_update);
+ sts.update_image_version (im.version);
+ imb.version++;
+ u = true;
+ }
+
+ binding& idb (sts.id_image_binding ());
+ if (idi.version != sts.update_id_image_version () ||
+ idb.version == 0)
+ {
+ if (idi.version != sts.id_image_version () ||
+ idb.version == 0)
+ {
+ bind (idb.bind, idi);
+ sts.id_image_version (idi.version);
+ idb.version++;
+ }
+
+ sts.update_id_image_version (idi.version);
+
+ if (!u)
+ imb.version++;
+ }
+
+ update_statement& st (sts.update_statement ());
+ if (st.execute () == 0)
+ throw object_not_persistent ();
+
+ extra_statement_cache_type& esc (sts.extra_statement_cache ());
+
+ if (obj.results_section.loaded ())
+ {
+ results_section_traits::update (esc, obj);
+ }
+
+ callback (db, obj, callback_event::post_update);
+ pointer_cache_traits::update (db, obj);
+ }
+
+ void access::object_traits_impl< ::brep::build, id_pgsql >::
+ erase (database& db, const id_type& id)
+ {
+ using namespace pgsql;
+
+ ODB_POTENTIALLY_UNUSED (db);
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ id_image_type& i (sts.id_image ());
+ init (i, id);
+
+ binding& idb (sts.id_image_binding ());
+ if (i.version != sts.id_image_version () || idb.version == 0)
+ {
+ bind (idb.bind, i);
+ sts.id_image_version (i.version);
+ idb.version++;
+ }
+
+ extra_statement_cache_type& esc (sts.extra_statement_cache ());
+
+ // results
+ //
+ {
+ results_traits::erase (
+ esc.results);
+ }
+
+ if (sts.erase_statement ().execute () != 1)
+ throw object_not_persistent ();
+
+ pointer_cache_traits::erase (db, id);
+ }
+
+ access::object_traits_impl< ::brep::build, id_pgsql >::pointer_type
+ access::object_traits_impl< ::brep::build, id_pgsql >::
+ find (database& db, const id_type& id)
+ {
+ using namespace pgsql;
+
+ {
+ pointer_type p (pointer_cache_traits::find (db, id));
+
+ if (!pointer_traits::null_ptr (p))
+ return p;
+ }
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ statements_type::auto_lock l (sts);
+
+ if (l.locked ())
+ {
+ if (!find_ (sts, &id))
+ return pointer_type ();
+ }
+
+ pointer_type p (
+ access::object_factory<object_type, pointer_type>::create ());
+ pointer_traits::guard pg (p);
+
+ pointer_cache_traits::insert_guard ig (
+ pointer_cache_traits::insert (db, id, p));
+
+ object_type& obj (pointer_traits::get_ref (p));
+
+ if (l.locked ())
+ {
+ select_statement& st (sts.find_statement ());
+ ODB_POTENTIALLY_UNUSED (st);
+
+ callback (db, obj, callback_event::pre_load);
+ init (obj, sts.image (), &db);
+ load_ (sts, obj, false);
+ sts.load_delayed (0);
+ l.unlock ();
+ callback (db, obj, callback_event::post_load);
+ pointer_cache_traits::load (ig.position ());
+ }
+ else
+ sts.delay_load (id, obj, ig.position ());
+
+ ig.release ();
+ pg.release ();
+ return p;
+ }
+
+ bool access::object_traits_impl< ::brep::build, id_pgsql >::
+ find (database& db, const id_type& id, object_type& obj)
+ {
+ using namespace pgsql;
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ statements_type::auto_lock l (sts);
+ assert (l.locked ()) /* Must be a top-level call. */;
+
+ if (!find_ (sts, &id))
+ return false;
+
+ select_statement& st (sts.find_statement ());
+ ODB_POTENTIALLY_UNUSED (st);
+
+ reference_cache_traits::position_type pos (
+ reference_cache_traits::insert (db, id, obj));
+ reference_cache_traits::insert_guard ig (pos);
+
+ callback (db, obj, callback_event::pre_load);
+ init (obj, sts.image (), &db);
+ load_ (sts, obj, false);
+ sts.load_delayed (0);
+ l.unlock ();
+ callback (db, obj, callback_event::post_load);
+ reference_cache_traits::load (pos);
+ ig.release ();
+ return true;
+ }
+
+ bool access::object_traits_impl< ::brep::build, id_pgsql >::
+ reload (database& db, object_type& obj)
+ {
+ using namespace pgsql;
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ statements_type::auto_lock l (sts);
+ assert (l.locked ()) /* Must be a top-level call. */;
+
+ const id_type& id (object_traits_impl::id (obj));
+ if (!find_ (sts, &id))
+ return false;
+
+ select_statement& st (sts.find_statement ());
+ ODB_POTENTIALLY_UNUSED (st);
+
+ callback (db, obj, callback_event::pre_load);
+ init (obj, sts.image (), &db);
+ load_ (sts, obj, true);
+ sts.load_delayed (0);
+ l.unlock ();
+ callback (db, obj, callback_event::post_load);
+ return true;
+ }
+
+ bool access::object_traits_impl< ::brep::build, id_pgsql >::
+ load (connection& conn, object_type& obj, section& s)
+ {
+ using namespace pgsql;
+
+ pgsql::connection& c (static_cast<pgsql::connection&> (conn));
+ statements_type& sts (c.statement_cache ().find_object<object_type> ());
+
+ statements_type::auto_lock l (sts);
+ assert (l.locked ()) /* Must be a top-level call. */;
+
+ bool r (false);
+
+ id_image_type& i (sts.id_image ());
+ init (i, id (obj));
+
+ binding& idb (sts.id_image_binding ());
+ if (i.version != sts.id_image_version () || idb.version == 0)
+ {
+ bind (idb.bind, i);
+ sts.id_image_version (i.version);
+ idb.version++;
+ }
+
+ extra_statement_cache_type& esc (sts.extra_statement_cache ());
+
+ if (!r && &s == &obj.results_section)
+ {
+ results_section_traits::load (esc, obj);
+ r = true;
+ }
+
+ sts.load_delayed (0);
+ l.unlock ();
+ return r;
+ }
+
+ bool access::object_traits_impl< ::brep::build, id_pgsql >::
+ update (connection& conn, const object_type& obj, const section& s)
+ {
+ using namespace pgsql;
+
+ pgsql::connection& c (static_cast<pgsql::connection&> (conn));
+ statements_type& sts (c.statement_cache ().find_object<object_type> ());
+ extra_statement_cache_type& esc (sts.extra_statement_cache ());
+
+ id_image_type& i (sts.id_image ());
+ init (i, id (obj));
+
+ binding& idb (sts.id_image_binding ());
+ if (i.version != sts.id_image_version () || idb.version == 0)
+ {
+ bind (idb.bind, i);
+ sts.id_image_version (i.version);
+ idb.version++;
+ }
+
+ if (&s == &obj.results_section)results_section_traits::update (esc, obj);
+ else
+ return false;
+
+ return true;
+ }
+
+ bool access::object_traits_impl< ::brep::build, id_pgsql >::
+ find_ (statements_type& sts,
+ const id_type* id)
+ {
+ using namespace pgsql;
+
+ id_image_type& i (sts.id_image ());
+ init (i, *id);
+
+ binding& idb (sts.id_image_binding ());
+ if (i.version != sts.id_image_version () || idb.version == 0)
+ {
+ bind (idb.bind, i);
+ sts.id_image_version (i.version);
+ idb.version++;
+ }
+
+ image_type& im (sts.image ());
+ binding& imb (sts.select_image_binding ());
+
+ if (im.version != sts.select_image_version () ||
+ imb.version == 0)
+ {
+ bind (imb.bind, im, statement_select);
+ sts.select_image_version (im.version);
+ imb.version++;
+ }
+
+ select_statement& st (sts.find_statement ());
+
+ st.execute ();
+ auto_result ar (st);
+ select_statement::result r (st.fetch ());
+
+ if (r == select_statement::truncated)
+ {
+ if (grow (im, sts.select_image_truncated ()))
+ im.version++;
+
+ if (im.version != sts.select_image_version ())
+ {
+ bind (imb.bind, im, statement_select);
+ sts.select_image_version (im.version);
+ imb.version++;
+ st.refetch ();
+ }
+ }
+
+ return r != select_statement::no_data;
+ }
+
+ void access::object_traits_impl< ::brep::build, id_pgsql >::
+ load_ (statements_type& sts,
+ object_type& obj,
+ bool reload)
+ {
+ ODB_POTENTIALLY_UNUSED (reload);
+
+ extra_statement_cache_type& esc (sts.extra_statement_cache ());
+
+ if (reload)
+ {
+ if (obj.results_section.loaded ())
+ {
+ results_section_traits::load (esc, obj);
+ obj.results_section.reset (true, false);
+ }
+ }
+ else
+ obj.results_section.reset ();
+ }
+
+ result< access::object_traits_impl< ::brep::build, id_pgsql >::object_type >
+ access::object_traits_impl< ::brep::build, id_pgsql >::
+ query (database&, const query_base_type& q)
+ {
+ using namespace pgsql;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.select_image_binding ());
+
+ if (im.version != sts.select_image_version () ||
+ imb.version == 0)
+ {
+ bind (imb.bind, im, statement_select);
+ sts.select_image_version (im.version);
+ imb.version++;
+ }
+
+ std::string text (query_statement);
+ if (!q.empty ())
+ {
+ text += " ";
+ text += q.clause ();
+ }
+
+ q.init_parameters ();
+ shared_ptr<select_statement> st (
+ new (shared) select_statement (
+ sts.connection (),
+ query_statement_name,
+ text,
+ false,
+ true,
+ q.parameter_types (),
+ q.parameter_count (),
+ q.parameters_binding (),
+ imb));
+
+ st->execute ();
+ st->deallocate ();
+
+ shared_ptr< odb::object_result_impl<object_type> > r (
+ new (shared) pgsql::object_result_impl<object_type> (
+ q, st, sts, 0));
+
+ return result<object_type> (r);
+ }
+
+ unsigned long long access::object_traits_impl< ::brep::build, id_pgsql >::
+ erase_query (database&, const query_base_type& q)
+ {
+ using namespace pgsql;
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+
+ std::string text (erase_query_statement);
+ if (!q.empty ())
+ {
+ text += ' ';
+ text += q.clause ();
+ }
+
+ q.init_parameters ();
+ delete_statement st (
+ conn,
+ erase_query_statement_name,
+ text,
+ q.parameter_types (),
+ q.parameter_count (),
+ q.parameters_binding ());
+
+ return st.execute ();
+ }
+
+ odb::details::shared_ptr<prepared_query_impl>
+ access::object_traits_impl< ::brep::build, id_pgsql >::
+ prepare_query (connection& c, const char* n, const query_base_type& q)
+ {
+ using namespace pgsql;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ pgsql::connection& conn (
+ static_cast<pgsql::connection&> (c));
+
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.select_image_binding ());
+
+ if (im.version != sts.select_image_version () ||
+ imb.version == 0)
+ {
+ bind (imb.bind, im, statement_select);
+ sts.select_image_version (im.version);
+ imb.version++;
+ }
+
+ std::string text (query_statement);
+ if (!q.empty ())
+ {
+ text += " ";
+ text += q.clause ();
+ }
+
+ shared_ptr<pgsql::prepared_query_impl> r (
+ new (shared) pgsql::prepared_query_impl (conn));
+ r->name = n;
+ r->execute = &execute_query;
+ r->query = q;
+ r->stmt.reset (
+ new (shared) select_statement (
+ sts.connection (),
+ n,
+ text,
+ false,
+ true,
+ r->query.parameter_types (),
+ r->query.parameter_count (),
+ r->query.parameters_binding (),
+ imb));
+
+ return r;
+ }
+
+ odb::details::shared_ptr<result_impl>
+ access::object_traits_impl< ::brep::build, id_pgsql >::
+ execute_query (prepared_query_impl& q)
+ {
+ using namespace pgsql;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ pgsql::prepared_query_impl& pq (
+ static_cast<pgsql::prepared_query_impl&> (q));
+ shared_ptr<select_statement> st (
+ odb::details::inc_ref (
+ static_cast<select_statement*> (pq.stmt.get ())));
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+
+ // The connection used by the current transaction and the
+ // one used to prepare this statement must be the same.
+ //
+ assert (&conn == &st->connection ());
+
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.select_image_binding ());
+
+ if (im.version != sts.select_image_version () ||
+ imb.version == 0)
+ {
+ bind (imb.bind, im, statement_select);
+ sts.select_image_version (im.version);
+ imb.version++;
+ }
+
+ pq.query.init_parameters ();
+ st->execute ();
+
+ return shared_ptr<result_impl> (
+ new (shared) pgsql::object_result_impl<object_type> (
+ pq.query, st, sts, 0));
+ }
+
+ // toolchain
+ //
+
+ const char access::view_traits_impl< ::brep::toolchain, id_pgsql >::
+ query_statement_name[] = "query_brep_toolchain";
+
+ bool access::view_traits_impl< ::brep::toolchain, id_pgsql >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // name
+ //
+ if (t[0UL])
+ {
+ i.name_value.capacity (i.name_size);
+ grew = true;
+ }
+
+ // epoch
+ //
+ t[1UL] = 0;
+
+ // canonical_upstream
+ //
+ if (t[2UL])
+ {
+ i.canonical_upstream_value.capacity (i.canonical_upstream_size);
+ grew = true;
+ }
+
+ // canonical_release
+ //
+ if (t[3UL])
+ {
+ i.canonical_release_value.capacity (i.canonical_release_size);
+ grew = true;
+ }
+
+ // revision
+ //
+ t[4UL] = 0;
+
+ // version
+ //
+ if (composite_value_traits< ::brep::upstream_version, id_pgsql >::grow (
+ i.version_value, t + 5UL))
+ grew = true;
+
+ return grew;
+ }
+
+ void access::view_traits_impl< ::brep::toolchain, id_pgsql >::
+ bind (pgsql::bind* b,
+ image_type& i)
+ {
+ using namespace pgsql;
+
+ pgsql::statement_kind sk (statement_select);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ std::size_t n (0);
+
+ // name
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.name_value.data ();
+ b[n].capacity = i.name_value.capacity ();
+ b[n].size = &i.name_size;
+ b[n].is_null = &i.name_null;
+ n++;
+
+ // epoch
+ //
+ b[n].type = pgsql::bind::integer;
+ b[n].buffer = &i.epoch_value;
+ b[n].is_null = &i.epoch_null;
+ n++;
+
+ // canonical_upstream
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.canonical_upstream_value.data ();
+ b[n].capacity = i.canonical_upstream_value.capacity ();
+ b[n].size = &i.canonical_upstream_size;
+ b[n].is_null = &i.canonical_upstream_null;
+ n++;
+
+ // canonical_release
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.canonical_release_value.data ();
+ b[n].capacity = i.canonical_release_value.capacity ();
+ b[n].size = &i.canonical_release_size;
+ b[n].is_null = &i.canonical_release_null;
+ n++;
+
+ // revision
+ //
+ b[n].type = pgsql::bind::integer;
+ b[n].buffer = &i.revision_value;
+ b[n].is_null = &i.revision_null;
+ n++;
+
+ // version
+ //
+ composite_value_traits< ::brep::upstream_version, id_pgsql >::bind (
+ b + n, i.version_value, sk);
+ n += 2UL;
+ }
+
+ void access::view_traits_impl< ::brep::toolchain, id_pgsql >::
+ init (view_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // name
+ //
+ {
+ ::std::string& v =
+ o.name;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.name_value,
+ i.name_size,
+ i.name_null);
+ }
+
+ // epoch
+ //
+ {
+ // From build.hxx:309:23
+ ::uint16_t& v =
+ o.version_.epoch;
+
+ pgsql::value_traits<
+ ::uint16_t,
+ pgsql::id_integer >::set_value (
+ v,
+ i.epoch_value,
+ i.epoch_null);
+ }
+
+ // canonical_upstream
+ //
+ {
+ // From build.hxx:313:23
+ ::std::string& v =
+ o.version_.canonical_upstream;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.canonical_upstream_value,
+ i.canonical_upstream_size,
+ i.canonical_upstream_null);
+ }
+
+ // canonical_release
+ //
+ {
+ // From build.hxx:317:23
+ ::std::string& v =
+ o.version_.canonical_release;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.canonical_release_value,
+ i.canonical_release_size,
+ i.canonical_release_null);
+ }
+
+ // revision
+ //
+ {
+ // From build.hxx:321:23
+ ::uint16_t& v =
+ o.version_.revision;
+
+ pgsql::value_traits<
+ ::uint16_t,
+ pgsql::id_integer >::set_value (
+ v,
+ i.revision_value,
+ i.revision_null);
+ }
+
+ // version
+ //
+ {
+ // From build.hxx:306:7
+ ::brep::upstream_version v;
+
+ composite_value_traits< ::brep::upstream_version, id_pgsql >::init (
+ v,
+ i.version_value,
+ db);
+
+ // From build.hxx:306:7
+ o.version.init (o.version_, (v));
+ }
+ }
+
+ access::view_traits_impl< ::brep::toolchain, id_pgsql >::query_base_type
+ access::view_traits_impl< ::brep::toolchain, id_pgsql >::
+ query_statement (const query_base_type& q)
+ {
+ query_base_type r (
+ "SELECT DISTINCT "
+ "\"build\".\"toolchain_name\", "
+ "\"build\".\"toolchain_version_epoch\", "
+ "\"build\".\"toolchain_version_canonical_upstream\", "
+ "\"build\".\"toolchain_version_canonical_release\", "
+ "\"build\".\"toolchain_version_revision\", "
+ "\"build\".\"toolchain_version_upstream\", "
+ "\"build\".\"toolchain_version_release\" ");
+
+ r += "FROM \"build\"";
+
+ r += " INNER JOIN \"build_package\" ON";
+ // From build.hxx:291:5
+ r += brep::operator == (query_columns::build::id.package, query_columns::build_package::id) && query_columns::build_package::buildable;
+
+ if (!q.empty ())
+ {
+ r += " ";
+ r += q.clause_prefix ();
+ r += q;
+ }
+
+ return r;
+ }
+
+ result< access::view_traits_impl< ::brep::toolchain, id_pgsql >::view_type >
+ access::view_traits_impl< ::brep::toolchain, id_pgsql >::
+ query (database&, const query_base_type& q)
+ {
+ using namespace pgsql;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+ statements_type& sts (
+ conn.statement_cache ().find_view<view_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.image_binding ());
+
+ if (im.version != sts.image_version () || imb.version == 0)
+ {
+ bind (imb.bind, im);
+ sts.image_version (im.version);
+ imb.version++;
+ }
+
+ const query_base_type& qs (query_statement (q));
+ qs.init_parameters ();
+ shared_ptr<select_statement> st (
+ new (shared) select_statement (
+ sts.connection (),
+ query_statement_name,
+ qs.clause (),
+ false,
+ true,
+ qs.parameter_types (),
+ qs.parameter_count (),
+ qs.parameters_binding (),
+ imb));
+
+ st->execute ();
+ st->deallocate ();
+
+ shared_ptr< odb::view_result_impl<view_type> > r (
+ new (shared) pgsql::view_result_impl<view_type> (
+ qs, st, sts, 0));
+
+ return result<view_type> (r);
+ }
+
+ odb::details::shared_ptr<prepared_query_impl>
+ access::view_traits_impl< ::brep::toolchain, id_pgsql >::
+ prepare_query (connection& c, const char* n, const query_base_type& q)
+ {
+ using namespace pgsql;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ pgsql::connection& conn (
+ static_cast<pgsql::connection&> (c));
+ statements_type& sts (
+ conn.statement_cache ().find_view<view_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.image_binding ());
+
+ if (im.version != sts.image_version () || imb.version == 0)
+ {
+ bind (imb.bind, im);
+ sts.image_version (im.version);
+ imb.version++;
+ }
+
+ shared_ptr<pgsql::prepared_query_impl> r (
+ new (shared) pgsql::prepared_query_impl (conn));
+ r->name = n;
+ r->execute = &execute_query;
+ r->query = query_statement (q);
+ r->stmt.reset (
+ new (shared) select_statement (
+ sts.connection (),
+ n,
+ r->query.clause (),
+ false,
+ true,
+ r->query.parameter_types (),
+ r->query.parameter_count (),
+ r->query.parameters_binding (),
+ imb));
+
+ return r;
+ }
+
+ odb::details::shared_ptr<result_impl>
+ access::view_traits_impl< ::brep::toolchain, id_pgsql >::
+ execute_query (prepared_query_impl& q)
+ {
+ using namespace pgsql;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ pgsql::prepared_query_impl& pq (
+ static_cast<pgsql::prepared_query_impl&> (q));
+ shared_ptr<select_statement> st (
+ odb::details::inc_ref (
+ static_cast<select_statement*> (pq.stmt.get ())));
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+
+ // The connection used by the current transaction and the
+ // one used to prepare this statement must be the same.
+ //
+ assert (&conn == &st->connection ());
+
+ statements_type& sts (
+ conn.statement_cache ().find_view<view_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.image_binding ());
+
+ if (im.version != sts.image_version () || imb.version == 0)
+ {
+ bind (imb.bind, im);
+ sts.image_version (im.version);
+ imb.version++;
+ }
+
+ pq.query.init_parameters ();
+ st->execute ();
+
+ return shared_ptr<result_impl> (
+ new (shared) pgsql::view_result_impl<view_type> (
+ pq.query, st, sts, 0));
+ }
+
+ // package_build
+ //
+
+ const char access::view_traits_impl< ::brep::package_build, id_pgsql >::
+ query_statement_name[] = "query_brep_package_build";
+
+ bool access::view_traits_impl< ::brep::package_build, id_pgsql >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // build
+ //
+ if (object_traits_impl< ::brep::build, id_pgsql >::grow (
+ i.build_value, t + 0UL))
+ grew = true;
+
+ return grew;
+ }
+
+ void access::view_traits_impl< ::brep::package_build, id_pgsql >::
+ bind (pgsql::bind* b,
+ image_type& i)
+ {
+ using namespace pgsql;
+
+ pgsql::statement_kind sk (statement_select);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ std::size_t n (0);
+
+ // build
+ //
+ object_traits_impl< ::brep::build, id_pgsql >::bind (
+ b + n, i.build_value, sk);
+ n += 26UL;
+ }
+
+ void access::view_traits_impl< ::brep::package_build, id_pgsql >::
+ init (view_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+
+ // build pre
+ //
+ typedef ::brep::build build_object_type;
+ typedef object_traits_impl<build_object_type, id_pgsql> build_object_traits;
+ typedef build_object_traits::pointer_type build_pointer_type;
+ typedef build_object_traits::pointer_traits build_pointer_traits;
+ typedef build_object_traits::pointer_cache_traits build_cache_traits;
+
+ build_object_traits::id_type build_id;
+ build_pointer_type build_p;
+ build_pointer_traits::guard build_pg;
+ build_cache_traits::insert_guard build_ig;
+ build_object_type* build_o (0);
+
+ {
+ if (!composite_value_traits< build_object_traits::id_type, id_pgsql >::get_null (
+ i.build_value.id_value))
+ {
+ build_id = build_object_traits::id (i.build_value);
+ build_p = build_cache_traits::find (*db, build_id);
+
+ if (build_pointer_traits::null_ptr (build_p))
+ {
+ build_p = object_factory<build_object_type, build_pointer_type>::create ();
+ build_pg.reset (build_p);
+ build_ig.reset (build_cache_traits::insert (*db, build_id, build_p));
+ build_o = build_pointer_traits::get_ptr (build_p);
+ }
+ }
+ }
+
+ // build
+ //
+ {
+ if (build_o != 0)
+ {
+ build_object_traits::callback (*db, *build_o, callback_event::pre_load);
+ build_object_traits::init (*build_o, i.build_value, db);
+ build_object_traits::statements_type& sts (
+ conn.statement_cache ().find_object<build_object_type> ());
+ build_object_traits::load_ (sts, *build_o, false);
+ }
+ }
+
+ // build post
+ //
+ {
+ if (build_o != 0)
+ {
+ build_object_traits::callback (*db, *build_o, callback_event::post_load);
+ build_cache_traits::load (build_ig.position ());
+ build_ig.release ();
+ build_pg.release ();
+ }
+
+ // If a compiler error points to the line below, then
+ // it most likely means that a pointer used in view
+ // member cannot be initialized from an object pointer.
+ //
+ o.build = ::std::shared_ptr< ::brep::build > (
+ std::move (build_p));
+ }
+ }
+
+ access::view_traits_impl< ::brep::package_build, id_pgsql >::query_base_type
+ access::view_traits_impl< ::brep::package_build, id_pgsql >::
+ query_statement (const query_base_type& q)
+ {
+ query_base_type r (
+ "SELECT "
+ "\"build\".\"package_tenant\", "
+ "\"build\".\"package_name\"::TEXT, "
+ "\"build\".\"package_version_epoch\", "
+ "\"build\".\"package_version_canonical_upstream\", "
+ "\"build\".\"package_version_canonical_release\", "
+ "\"build\".\"package_version_revision\", "
+ "\"build\".\"configuration\", "
+ "\"build\".\"toolchain_name\", "
+ "\"build\".\"toolchain_version_epoch\", "
+ "\"build\".\"toolchain_version_canonical_upstream\", "
+ "\"build\".\"toolchain_version_canonical_release\", "
+ "\"build\".\"toolchain_version_revision\", "
+ "\"build\".\"package_version_upstream\", "
+ "\"build\".\"package_version_release\", "
+ "\"build\".\"toolchain_version_upstream\", "
+ "\"build\".\"toolchain_version_release\", "
+ "\"build\".\"state\", "
+ "\"build\".\"timestamp\", "
+ "\"build\".\"force\", "
+ "\"build\".\"status\", "
+ "\"build\".\"completion_timestamp\", "
+ "\"build\".\"agent_fingerprint\", "
+ "\"build\".\"agent_challenge\", "
+ "\"build\".\"machine\", "
+ "\"build\".\"machine_summary\", "
+ "\"build\".\"target\" ");
+
+ r += "FROM \"build\"";
+
+ r += " INNER JOIN \"build_package\" ON";
+ // From build.hxx:335:5
+ r += brep::operator == (query_columns::build::id.package, query_columns::build_package::id) && query_columns::build_package::buildable;
+
+ r += " LEFT JOIN \"build_tenant\" ON";
+ // From build.hxx:338:5
+ r += query_columns::build_package::id.tenant == query_columns::build_tenant::id;
+
+ if (!q.empty ())
+ {
+ r += " ";
+ r += q.clause_prefix ();
+ r += q;
+ }
+
+ return r;
+ }
+
+ result< access::view_traits_impl< ::brep::package_build, id_pgsql >::view_type >
+ access::view_traits_impl< ::brep::package_build, id_pgsql >::
+ query (database&, const query_base_type& q)
+ {
+ using namespace pgsql;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+ statements_type& sts (
+ conn.statement_cache ().find_view<view_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.image_binding ());
+
+ if (im.version != sts.image_version () || imb.version == 0)
+ {
+ bind (imb.bind, im);
+ sts.image_version (im.version);
+ imb.version++;
+ }
+
+ const query_base_type& qs (query_statement (q));
+ qs.init_parameters ();
+ shared_ptr<select_statement> st (
+ new (shared) select_statement (
+ sts.connection (),
+ query_statement_name,
+ qs.clause (),
+ false,
+ true,
+ qs.parameter_types (),
+ qs.parameter_count (),
+ qs.parameters_binding (),
+ imb));
+
+ st->execute ();
+ st->deallocate ();
+
+ shared_ptr< odb::view_result_impl<view_type> > r (
+ new (shared) pgsql::view_result_impl<view_type> (
+ qs, st, sts, 0));
+
+ return result<view_type> (r);
+ }
+
+ odb::details::shared_ptr<prepared_query_impl>
+ access::view_traits_impl< ::brep::package_build, id_pgsql >::
+ prepare_query (connection& c, const char* n, const query_base_type& q)
+ {
+ using namespace pgsql;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ pgsql::connection& conn (
+ static_cast<pgsql::connection&> (c));
+ statements_type& sts (
+ conn.statement_cache ().find_view<view_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.image_binding ());
+
+ if (im.version != sts.image_version () || imb.version == 0)
+ {
+ bind (imb.bind, im);
+ sts.image_version (im.version);
+ imb.version++;
+ }
+
+ shared_ptr<pgsql::prepared_query_impl> r (
+ new (shared) pgsql::prepared_query_impl (conn));
+ r->name = n;
+ r->execute = &execute_query;
+ r->query = query_statement (q);
+ r->stmt.reset (
+ new (shared) select_statement (
+ sts.connection (),
+ n,
+ r->query.clause (),
+ false,
+ true,
+ r->query.parameter_types (),
+ r->query.parameter_count (),
+ r->query.parameters_binding (),
+ imb));
+
+ return r;
+ }
+
+ odb::details::shared_ptr<result_impl>
+ access::view_traits_impl< ::brep::package_build, id_pgsql >::
+ execute_query (prepared_query_impl& q)
+ {
+ using namespace pgsql;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ pgsql::prepared_query_impl& pq (
+ static_cast<pgsql::prepared_query_impl&> (q));
+ shared_ptr<select_statement> st (
+ odb::details::inc_ref (
+ static_cast<select_statement*> (pq.stmt.get ())));
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+
+ // The connection used by the current transaction and the
+ // one used to prepare this statement must be the same.
+ //
+ assert (&conn == &st->connection ());
+
+ statements_type& sts (
+ conn.statement_cache ().find_view<view_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.image_binding ());
+
+ if (im.version != sts.image_version () || imb.version == 0)
+ {
+ bind (imb.bind, im);
+ sts.image_version (im.version);
+ imb.version++;
+ }
+
+ pq.query.init_parameters ();
+ st->execute ();
+
+ return shared_ptr<result_impl> (
+ new (shared) pgsql::view_result_impl<view_type> (
+ pq.query, st, sts, 0));
+ }
+
+ // package_build_count
+ //
+
+ const char access::view_traits_impl< ::brep::package_build_count, id_pgsql >::
+ query_statement_name[] = "query_brep_package_build_count";
+
+ bool access::view_traits_impl< ::brep::package_build_count, id_pgsql >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // result
+ //
+ t[0UL] = 0;
+
+ return grew;
+ }
+
+ void access::view_traits_impl< ::brep::package_build_count, id_pgsql >::
+ bind (pgsql::bind* b,
+ image_type& i)
+ {
+ using namespace pgsql;
+
+ pgsql::statement_kind sk (statement_select);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ std::size_t n (0);
+
+ // result
+ //
+ b[n].type = pgsql::bind::bigint;
+ b[n].buffer = &i.result_value;
+ b[n].is_null = &i.result_null;
+ n++;
+ }
+
+ void access::view_traits_impl< ::brep::package_build_count, id_pgsql >::
+ init (view_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // result
+ //
+ {
+ ::std::size_t& v =
+ o.result;
+
+ pgsql::value_traits<
+ ::std::size_t,
+ pgsql::id_bigint >::set_value (
+ v,
+ i.result_value,
+ i.result_null);
+ }
+ }
+
+ access::view_traits_impl< ::brep::package_build_count, id_pgsql >::query_base_type
+ access::view_traits_impl< ::brep::package_build_count, id_pgsql >::
+ query_statement (const query_base_type& q)
+ {
+ query_base_type r (
+ "SELECT "
+ "count(\"build\".\"package_name\") ");
+
+ r += "FROM \"build\"";
+
+ r += " INNER JOIN \"build_package\" ON";
+ // From build.hxx:346:5
+ r += brep::operator == (query_columns::build::id.package, query_columns::build_package::id) && query_columns::build_package::buildable;
+
+ r += " LEFT JOIN \"build_tenant\" ON";
+ // From build.hxx:349:5
+ r += query_columns::build_package::id.tenant == query_columns::build_tenant::id;
+
+ if (!q.empty ())
+ {
+ r += " ";
+ r += q.clause_prefix ();
+ r += q;
+ }
+
+ return r;
+ }
+
+ result< access::view_traits_impl< ::brep::package_build_count, id_pgsql >::view_type >
+ access::view_traits_impl< ::brep::package_build_count, id_pgsql >::
+ query (database&, const query_base_type& q)
+ {
+ using namespace pgsql;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+ statements_type& sts (
+ conn.statement_cache ().find_view<view_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.image_binding ());
+
+ if (im.version != sts.image_version () || imb.version == 0)
+ {
+ bind (imb.bind, im);
+ sts.image_version (im.version);
+ imb.version++;
+ }
+
+ const query_base_type& qs (query_statement (q));
+ qs.init_parameters ();
+ shared_ptr<select_statement> st (
+ new (shared) select_statement (
+ sts.connection (),
+ query_statement_name,
+ qs.clause (),
+ false,
+ true,
+ qs.parameter_types (),
+ qs.parameter_count (),
+ qs.parameters_binding (),
+ imb));
+
+ st->execute ();
+ st->deallocate ();
+
+ shared_ptr< odb::view_result_impl<view_type> > r (
+ new (shared) pgsql::view_result_impl<view_type> (
+ qs, st, sts, 0));
+
+ return result<view_type> (r);
+ }
+
+ odb::details::shared_ptr<prepared_query_impl>
+ access::view_traits_impl< ::brep::package_build_count, id_pgsql >::
+ prepare_query (connection& c, const char* n, const query_base_type& q)
+ {
+ using namespace pgsql;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ pgsql::connection& conn (
+ static_cast<pgsql::connection&> (c));
+ statements_type& sts (
+ conn.statement_cache ().find_view<view_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.image_binding ());
+
+ if (im.version != sts.image_version () || imb.version == 0)
+ {
+ bind (imb.bind, im);
+ sts.image_version (im.version);
+ imb.version++;
+ }
+
+ shared_ptr<pgsql::prepared_query_impl> r (
+ new (shared) pgsql::prepared_query_impl (conn));
+ r->name = n;
+ r->execute = &execute_query;
+ r->query = query_statement (q);
+ r->stmt.reset (
+ new (shared) select_statement (
+ sts.connection (),
+ n,
+ r->query.clause (),
+ false,
+ true,
+ r->query.parameter_types (),
+ r->query.parameter_count (),
+ r->query.parameters_binding (),
+ imb));
+
+ return r;
+ }
+
+ odb::details::shared_ptr<result_impl>
+ access::view_traits_impl< ::brep::package_build_count, id_pgsql >::
+ execute_query (prepared_query_impl& q)
+ {
+ using namespace pgsql;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ pgsql::prepared_query_impl& pq (
+ static_cast<pgsql::prepared_query_impl&> (q));
+ shared_ptr<select_statement> st (
+ odb::details::inc_ref (
+ static_cast<select_statement*> (pq.stmt.get ())));
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+
+ // The connection used by the current transaction and the
+ // one used to prepare this statement must be the same.
+ //
+ assert (&conn == &st->connection ());
+
+ statements_type& sts (
+ conn.statement_cache ().find_view<view_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.image_binding ());
+
+ if (im.version != sts.image_version () || imb.version == 0)
+ {
+ bind (imb.bind, im);
+ sts.image_version (im.version);
+ imb.version++;
+ }
+
+ pq.query.init_parameters ();
+ st->execute ();
+
+ return shared_ptr<result_impl> (
+ new (shared) pgsql::view_result_impl<view_type> (
+ pq.query, st, sts, 0));
+ }
+
+ // build_delay
+ //
+
+ const char access::object_traits_impl< ::brep::build_delay, id_pgsql >::
+ persist_statement_name[] = "persist_brep_build_delay";
+
+ const char access::object_traits_impl< ::brep::build_delay, id_pgsql >::
+ find_statement_name[] = "find_brep_build_delay";
+
+ const char access::object_traits_impl< ::brep::build_delay, id_pgsql >::
+ update_statement_name[] = "update_brep_build_delay";
+
+ const char access::object_traits_impl< ::brep::build_delay, id_pgsql >::
+ erase_statement_name[] = "erase_brep_build_delay";
+
+ const char access::object_traits_impl< ::brep::build_delay, id_pgsql >::
+ query_statement_name[] = "query_brep_build_delay";
+
+ const char access::object_traits_impl< ::brep::build_delay, id_pgsql >::
+ erase_query_statement_name[] = "erase_query_brep_build_delay";
+
+ const unsigned int access::object_traits_impl< ::brep::build_delay, id_pgsql >::
+ persist_statement_types[] =
+ {
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int8_oid,
+ pgsql::int8_oid
+ };
+
+ const unsigned int access::object_traits_impl< ::brep::build_delay, id_pgsql >::
+ find_statement_types[] =
+ {
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid
+ };
+
+ const unsigned int access::object_traits_impl< ::brep::build_delay, id_pgsql >::
+ update_statement_types[] =
+ {
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int8_oid,
+ pgsql::int8_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid
+ };
+
+ struct access::object_traits_impl< ::brep::build_delay, id_pgsql >::extra_statement_cache_type
+ {
+ extra_statement_cache_type (
+ pgsql::connection&,
+ image_type&,
+ id_image_type&,
+ pgsql::binding&,
+ pgsql::binding&,
+ pgsql::native_binding&,
+ const unsigned int*)
+ {
+ }
+ };
+
+ access::object_traits_impl< ::brep::build_delay, id_pgsql >::id_type
+ access::object_traits_impl< ::brep::build_delay, id_pgsql >::
+ id (const image_type& i)
+ {
+ pgsql::database* db (0);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ id_type id;
+ {
+ composite_value_traits< ::brep::build_id, id_pgsql >::init (
+ id,
+ i.id_value,
+ db);
+ }
+
+ return id;
+ }
+
+ bool access::object_traits_impl< ::brep::build_delay, id_pgsql >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // id
+ //
+ if (composite_value_traits< ::brep::build_id, id_pgsql >::grow (
+ i.id_value, t + 0UL))
+ grew = true;
+
+ // package_version
+ //
+ if (composite_value_traits< ::brep::upstream_version, id_pgsql >::grow (
+ i.package_version_value, t + 12UL))
+ grew = true;
+
+ // toolchain_version
+ //
+ if (composite_value_traits< ::brep::upstream_version, id_pgsql >::grow (
+ i.toolchain_version_value, t + 14UL))
+ grew = true;
+
+ // report_timestamp
+ //
+ t[16UL] = 0;
+
+ // package_timestamp
+ //
+ t[17UL] = 0;
+
+ return grew;
+ }
+
+ void access::object_traits_impl< ::brep::build_delay, id_pgsql >::
+ bind (pgsql::bind* b,
+ image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ std::size_t n (0);
+
+ // id
+ //
+ if (sk != statement_update)
+ {
+ composite_value_traits< ::brep::build_id, id_pgsql >::bind (
+ b + n, i.id_value, sk);
+ n += 12UL;
+ }
+
+ // package_version
+ //
+ composite_value_traits< ::brep::upstream_version, id_pgsql >::bind (
+ b + n, i.package_version_value, sk);
+ n += 2UL;
+
+ // toolchain_version
+ //
+ composite_value_traits< ::brep::upstream_version, id_pgsql >::bind (
+ b + n, i.toolchain_version_value, sk);
+ n += 2UL;
+
+ // report_timestamp
+ //
+ b[n].type = pgsql::bind::bigint;
+ b[n].buffer = &i.report_timestamp_value;
+ b[n].is_null = &i.report_timestamp_null;
+ n++;
+
+ // package_timestamp
+ //
+ b[n].type = pgsql::bind::bigint;
+ b[n].buffer = &i.package_timestamp_value;
+ b[n].is_null = &i.package_timestamp_null;
+ n++;
+ }
+
+ void access::object_traits_impl< ::brep::build_delay, id_pgsql >::
+ bind (pgsql::bind* b, id_image_type& i)
+ {
+ std::size_t n (0);
+ pgsql::statement_kind sk (pgsql::statement_select);
+ composite_value_traits< ::brep::build_id, id_pgsql >::bind (
+ b + n, i.id_value, sk);
+ }
+
+ bool access::object_traits_impl< ::brep::build_delay, id_pgsql >::
+ init (image_type& i,
+ const object_type& o,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ bool grew (false);
+
+ // id
+ //
+ if (sk == statement_insert)
+ {
+ ::brep::build_id const& v =
+ o.id;
+
+ if (composite_value_traits< ::brep::build_id, id_pgsql >::init (
+ i.id_value,
+ v,
+ sk))
+ grew = true;
+ }
+
+ // package_version
+ //
+ {
+ ::brep::upstream_version const& v =
+ o.package_version;
+
+ if (composite_value_traits< ::brep::upstream_version, id_pgsql >::init (
+ i.package_version_value,
+ v,
+ sk))
+ grew = true;
+ }
+
+ // toolchain_version
+ //
+ {
+ ::brep::upstream_version const& v =
+ o.toolchain_version;
+
+ if (composite_value_traits< ::brep::upstream_version, id_pgsql >::init (
+ i.toolchain_version_value,
+ v,
+ sk))
+ grew = true;
+ }
+
+ // report_timestamp
+ //
+ {
+ ::butl::timestamp const& v =
+ o.report_timestamp;
+
+ // From common.hxx:119:14
+ ::uint64_t const& vt =
+ std::chrono::duration_cast < std::chrono::nanoseconds > ((v).time_since_epoch ()).count ();
+
+ bool is_null (false);
+ pgsql::value_traits<
+ ::uint64_t,
+ pgsql::id_bigint >::set_image (
+ i.report_timestamp_value, is_null, vt);
+ i.report_timestamp_null = is_null;
+ }
+
+ // package_timestamp
+ //
+ {
+ ::butl::timestamp const& v =
+ o.package_timestamp;
+
+ // From common.hxx:119:14
+ ::uint64_t const& vt =
+ std::chrono::duration_cast < std::chrono::nanoseconds > ((v).time_since_epoch ()).count ();
+
+ bool is_null (false);
+ pgsql::value_traits<
+ ::uint64_t,
+ pgsql::id_bigint >::set_image (
+ i.package_timestamp_value, is_null, vt);
+ i.package_timestamp_null = is_null;
+ }
+
+ return grew;
+ }
+
+ void access::object_traits_impl< ::brep::build_delay, id_pgsql >::
+ init (object_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // id
+ //
+ {
+ ::brep::build_id& v =
+ o.id;
+
+ composite_value_traits< ::brep::build_id, id_pgsql >::init (
+ v,
+ i.id_value,
+ db);
+ }
+
+ // package_version
+ //
+ {
+ // From build.hxx:407:7
+ ::brep::upstream_version v;
+
+ composite_value_traits< ::brep::upstream_version, id_pgsql >::init (
+ v,
+ i.package_version_value,
+ db);
+
+ // From build.hxx:407:7
+ o.package_version.init (o.id.package.version, (v));
+ }
+
+ // toolchain_version
+ //
+ {
+ // From build.hxx:411:7
+ ::brep::upstream_version v;
+
+ composite_value_traits< ::brep::upstream_version, id_pgsql >::init (
+ v,
+ i.toolchain_version_value,
+ db);
+
+ // From build.hxx:411:7
+ o.toolchain_version.init (o.id.toolchain_version, (v));
+ }
+
+ // report_timestamp
+ //
+ {
+ ::butl::timestamp& v =
+ o.report_timestamp;
+
+ ::uint64_t vt;
+
+ pgsql::value_traits<
+ ::uint64_t,
+ pgsql::id_bigint >::set_value (
+ vt,
+ i.report_timestamp_value,
+ i.report_timestamp_null);
+
+ // From common.hxx:119:14
+ v = brep::timestamp (std::chrono::duration_cast < brep::timestamp::duration > (std::chrono::nanoseconds (vt)));
+ }
+
+ // package_timestamp
+ //
+ {
+ ::butl::timestamp& v =
+ o.package_timestamp;
+
+ ::uint64_t vt;
+
+ pgsql::value_traits<
+ ::uint64_t,
+ pgsql::id_bigint >::set_value (
+ vt,
+ i.package_timestamp_value,
+ i.package_timestamp_null);
+
+ // From common.hxx:119:14
+ v = brep::timestamp (std::chrono::duration_cast < brep::timestamp::duration > (std::chrono::nanoseconds (vt)));
+ }
+ }
+
+ void access::object_traits_impl< ::brep::build_delay, id_pgsql >::
+ init (id_image_type& i, const id_type& id)
+ {
+ bool grew (false);
+ pgsql::statement_kind sk (pgsql::statement_select);
+ {
+ if (composite_value_traits< ::brep::build_id, id_pgsql >::init (
+ i.id_value,
+ id,
+ sk))
+ grew = true;
+ }
+
+ if (grew)
+ i.version++;
+ }
+
+ const char access::object_traits_impl< ::brep::build_delay, id_pgsql >::persist_statement[] =
+ "INSERT INTO \"build_delay\" "
+ "(\"package_tenant\", "
+ "\"package_name\", "
+ "\"package_version_epoch\", "
+ "\"package_version_canonical_upstream\", "
+ "\"package_version_canonical_release\", "
+ "\"package_version_revision\", "
+ "\"configuration\", "
+ "\"toolchain_name\", "
+ "\"toolchain_version_epoch\", "
+ "\"toolchain_version_canonical_upstream\", "
+ "\"toolchain_version_canonical_release\", "
+ "\"toolchain_version_revision\", "
+ "\"package_version_upstream\", "
+ "\"package_version_release\", "
+ "\"toolchain_version_upstream\", "
+ "\"toolchain_version_release\", "
+ "\"report_timestamp\", "
+ "\"package_timestamp\") "
+ "VALUES "
+ "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18)";
+
+ const char access::object_traits_impl< ::brep::build_delay, id_pgsql >::find_statement[] =
+ "SELECT "
+ "\"build_delay\".\"package_tenant\", "
+ "\"build_delay\".\"package_name\"::TEXT, "
+ "\"build_delay\".\"package_version_epoch\", "
+ "\"build_delay\".\"package_version_canonical_upstream\", "
+ "\"build_delay\".\"package_version_canonical_release\", "
+ "\"build_delay\".\"package_version_revision\", "
+ "\"build_delay\".\"configuration\", "
+ "\"build_delay\".\"toolchain_name\", "
+ "\"build_delay\".\"toolchain_version_epoch\", "
+ "\"build_delay\".\"toolchain_version_canonical_upstream\", "
+ "\"build_delay\".\"toolchain_version_canonical_release\", "
+ "\"build_delay\".\"toolchain_version_revision\", "
+ "\"build_delay\".\"package_version_upstream\", "
+ "\"build_delay\".\"package_version_release\", "
+ "\"build_delay\".\"toolchain_version_upstream\", "
+ "\"build_delay\".\"toolchain_version_release\", "
+ "\"build_delay\".\"report_timestamp\", "
+ "\"build_delay\".\"package_timestamp\" "
+ "FROM \"build_delay\" "
+ "WHERE \"build_delay\".\"package_tenant\"=$1 AND \"build_delay\".\"package_name\"=$2::CITEXT AND \"build_delay\".\"package_version_epoch\"=$3 AND \"build_delay\".\"package_version_canonical_upstream\"=$4 AND \"build_delay\".\"package_version_canonical_release\"=$5 AND \"build_delay\".\"package_version_revision\"=$6 AND \"build_delay\".\"configuration\"=$7 AND \"build_delay\".\"toolchain_name\"=$8 AND \"build_delay\".\"toolchain_version_epoch\"=$9 AND \"build_delay\".\"toolchain_version_canonical_upstream\"=$10 AND \"build_delay\".\"toolchain_version_canonical_release\"=$11 AND \"build_delay\".\"toolchain_version_revision\"=$12";
+
+ const char access::object_traits_impl< ::brep::build_delay, id_pgsql >::update_statement[] =
+ "UPDATE \"build_delay\" "
+ "SET "
+ "\"package_version_upstream\"=$1, "
+ "\"package_version_release\"=$2, "
+ "\"toolchain_version_upstream\"=$3, "
+ "\"toolchain_version_release\"=$4, "
+ "\"report_timestamp\"=$5, "
+ "\"package_timestamp\"=$6 "
+ "WHERE \"package_tenant\"=$7 AND \"package_name\"=$8::CITEXT AND \"package_version_epoch\"=$9 AND \"package_version_canonical_upstream\"=$10 AND \"package_version_canonical_release\"=$11 AND \"package_version_revision\"=$12 AND \"configuration\"=$13 AND \"toolchain_name\"=$14 AND \"toolchain_version_epoch\"=$15 AND \"toolchain_version_canonical_upstream\"=$16 AND \"toolchain_version_canonical_release\"=$17 AND \"toolchain_version_revision\"=$18";
+
+ const char access::object_traits_impl< ::brep::build_delay, id_pgsql >::erase_statement[] =
+ "DELETE FROM \"build_delay\" "
+ "WHERE \"package_tenant\"=$1 AND \"package_name\"=$2::CITEXT AND \"package_version_epoch\"=$3 AND \"package_version_canonical_upstream\"=$4 AND \"package_version_canonical_release\"=$5 AND \"package_version_revision\"=$6 AND \"configuration\"=$7 AND \"toolchain_name\"=$8 AND \"toolchain_version_epoch\"=$9 AND \"toolchain_version_canonical_upstream\"=$10 AND \"toolchain_version_canonical_release\"=$11 AND \"toolchain_version_revision\"=$12";
+
+ const char access::object_traits_impl< ::brep::build_delay, id_pgsql >::query_statement[] =
+ "SELECT "
+ "\"build_delay\".\"package_tenant\", "
+ "\"build_delay\".\"package_name\"::TEXT, "
+ "\"build_delay\".\"package_version_epoch\", "
+ "\"build_delay\".\"package_version_canonical_upstream\", "
+ "\"build_delay\".\"package_version_canonical_release\", "
+ "\"build_delay\".\"package_version_revision\", "
+ "\"build_delay\".\"configuration\", "
+ "\"build_delay\".\"toolchain_name\", "
+ "\"build_delay\".\"toolchain_version_epoch\", "
+ "\"build_delay\".\"toolchain_version_canonical_upstream\", "
+ "\"build_delay\".\"toolchain_version_canonical_release\", "
+ "\"build_delay\".\"toolchain_version_revision\", "
+ "\"build_delay\".\"package_version_upstream\", "
+ "\"build_delay\".\"package_version_release\", "
+ "\"build_delay\".\"toolchain_version_upstream\", "
+ "\"build_delay\".\"toolchain_version_release\", "
+ "\"build_delay\".\"report_timestamp\", "
+ "\"build_delay\".\"package_timestamp\" "
+ "FROM \"build_delay\"";
+
+ const char access::object_traits_impl< ::brep::build_delay, id_pgsql >::erase_query_statement[] =
+ "DELETE FROM \"build_delay\"";
+
+ const char access::object_traits_impl< ::brep::build_delay, id_pgsql >::table_name[] =
+ "\"build_delay\"";
+
+ void access::object_traits_impl< ::brep::build_delay, id_pgsql >::
+ persist (database& db, const object_type& obj)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+
+ using namespace pgsql;
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ callback (db,
+ obj,
+ callback_event::pre_persist);
+
+ image_type& im (sts.image ());
+ binding& imb (sts.insert_image_binding ());
+
+ if (init (im, obj, statement_insert))
+ im.version++;
+
+ if (im.version != sts.insert_image_version () ||
+ imb.version == 0)
+ {
+ bind (imb.bind, im, statement_insert);
+ sts.insert_image_version (im.version);
+ imb.version++;
+ }
+
+ insert_statement& st (sts.persist_statement ());
+ if (!st.execute ())
+ throw object_already_persistent ();
+
+ callback (db,
+ obj,
+ callback_event::post_persist);
+ }
+
+ void access::object_traits_impl< ::brep::build_delay, id_pgsql >::
+ update (database& db, const object_type& obj)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+
+ using namespace pgsql;
+ using pgsql::update_statement;
+
+ callback (db, obj, callback_event::pre_update);
+
+ pgsql::transaction& tr (pgsql::transaction::current ());
+ pgsql::connection& conn (tr.connection ());
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ id_image_type& idi (sts.id_image ());
+ init (idi, id (obj));
+
+ image_type& im (sts.image ());
+ if (init (im, obj, statement_update))
+ im.version++;
+
+ bool u (false);
+ binding& imb (sts.update_image_binding ());
+ if (im.version != sts.update_image_version () ||
+ imb.version == 0)
+ {
+ bind (imb.bind, im, statement_update);
+ sts.update_image_version (im.version);
+ imb.version++;
+ u = true;
+ }
+
+ binding& idb (sts.id_image_binding ());
+ if (idi.version != sts.update_id_image_version () ||
+ idb.version == 0)
+ {
+ if (idi.version != sts.id_image_version () ||
+ idb.version == 0)
+ {
+ bind (idb.bind, idi);
+ sts.id_image_version (idi.version);
+ idb.version++;
+ }
+
+ sts.update_id_image_version (idi.version);
+
+ if (!u)
+ imb.version++;
+ }
+
+ update_statement& st (sts.update_statement ());
+ if (st.execute () == 0)
+ throw object_not_persistent ();
+
+ callback (db, obj, callback_event::post_update);
+ pointer_cache_traits::update (db, obj);
+ }
+
+ void access::object_traits_impl< ::brep::build_delay, id_pgsql >::
+ erase (database& db, const id_type& id)
+ {
+ using namespace pgsql;
+
+ ODB_POTENTIALLY_UNUSED (db);
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ id_image_type& i (sts.id_image ());
+ init (i, id);
+
+ binding& idb (sts.id_image_binding ());
+ if (i.version != sts.id_image_version () || idb.version == 0)
+ {
+ bind (idb.bind, i);
+ sts.id_image_version (i.version);
+ idb.version++;
+ }
+
+ if (sts.erase_statement ().execute () != 1)
+ throw object_not_persistent ();
+
+ pointer_cache_traits::erase (db, id);
+ }
+
+ access::object_traits_impl< ::brep::build_delay, id_pgsql >::pointer_type
+ access::object_traits_impl< ::brep::build_delay, id_pgsql >::
+ find (database& db, const id_type& id)
+ {
+ using namespace pgsql;
+
+ {
+ pointer_type p (pointer_cache_traits::find (db, id));
+
+ if (!pointer_traits::null_ptr (p))
+ return p;
+ }
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ statements_type::auto_lock l (sts);
+
+ if (l.locked ())
+ {
+ if (!find_ (sts, &id))
+ return pointer_type ();
+ }
+
+ pointer_type p (
+ access::object_factory<object_type, pointer_type>::create ());
+ pointer_traits::guard pg (p);
+
+ pointer_cache_traits::insert_guard ig (
+ pointer_cache_traits::insert (db, id, p));
+
+ object_type& obj (pointer_traits::get_ref (p));
+
+ if (l.locked ())
+ {
+ select_statement& st (sts.find_statement ());
+ ODB_POTENTIALLY_UNUSED (st);
+
+ callback (db, obj, callback_event::pre_load);
+ init (obj, sts.image (), &db);
+ load_ (sts, obj, false);
+ sts.load_delayed (0);
+ l.unlock ();
+ callback (db, obj, callback_event::post_load);
+ pointer_cache_traits::load (ig.position ());
+ }
+ else
+ sts.delay_load (id, obj, ig.position ());
+
+ ig.release ();
+ pg.release ();
+ return p;
+ }
+
+ bool access::object_traits_impl< ::brep::build_delay, id_pgsql >::
+ find (database& db, const id_type& id, object_type& obj)
+ {
+ using namespace pgsql;
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ statements_type::auto_lock l (sts);
+ assert (l.locked ()) /* Must be a top-level call. */;
+
+ if (!find_ (sts, &id))
+ return false;
+
+ select_statement& st (sts.find_statement ());
+ ODB_POTENTIALLY_UNUSED (st);
+
+ reference_cache_traits::position_type pos (
+ reference_cache_traits::insert (db, id, obj));
+ reference_cache_traits::insert_guard ig (pos);
+
+ callback (db, obj, callback_event::pre_load);
+ init (obj, sts.image (), &db);
+ load_ (sts, obj, false);
+ sts.load_delayed (0);
+ l.unlock ();
+ callback (db, obj, callback_event::post_load);
+ reference_cache_traits::load (pos);
+ ig.release ();
+ return true;
+ }
+
+ bool access::object_traits_impl< ::brep::build_delay, id_pgsql >::
+ reload (database& db, object_type& obj)
+ {
+ using namespace pgsql;
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ statements_type::auto_lock l (sts);
+ assert (l.locked ()) /* Must be a top-level call. */;
+
+ const id_type& id (object_traits_impl::id (obj));
+ if (!find_ (sts, &id))
+ return false;
+
+ select_statement& st (sts.find_statement ());
+ ODB_POTENTIALLY_UNUSED (st);
+
+ callback (db, obj, callback_event::pre_load);
+ init (obj, sts.image (), &db);
+ load_ (sts, obj, true);
+ sts.load_delayed (0);
+ l.unlock ();
+ callback (db, obj, callback_event::post_load);
+ return true;
+ }
+
+ bool access::object_traits_impl< ::brep::build_delay, id_pgsql >::
+ find_ (statements_type& sts,
+ const id_type* id)
+ {
+ using namespace pgsql;
+
+ id_image_type& i (sts.id_image ());
+ init (i, *id);
+
+ binding& idb (sts.id_image_binding ());
+ if (i.version != sts.id_image_version () || idb.version == 0)
+ {
+ bind (idb.bind, i);
+ sts.id_image_version (i.version);
+ idb.version++;
+ }
+
+ image_type& im (sts.image ());
+ binding& imb (sts.select_image_binding ());
+
+ if (im.version != sts.select_image_version () ||
+ imb.version == 0)
+ {
+ bind (imb.bind, im, statement_select);
+ sts.select_image_version (im.version);
+ imb.version++;
+ }
+
+ select_statement& st (sts.find_statement ());
+
+ st.execute ();
+ auto_result ar (st);
+ select_statement::result r (st.fetch ());
+
+ if (r == select_statement::truncated)
+ {
+ if (grow (im, sts.select_image_truncated ()))
+ im.version++;
+
+ if (im.version != sts.select_image_version ())
+ {
+ bind (imb.bind, im, statement_select);
+ sts.select_image_version (im.version);
+ imb.version++;
+ st.refetch ();
+ }
+ }
+
+ return r != select_statement::no_data;
+ }
+
+ result< access::object_traits_impl< ::brep::build_delay, id_pgsql >::object_type >
+ access::object_traits_impl< ::brep::build_delay, id_pgsql >::
+ query (database&, const query_base_type& q)
+ {
+ using namespace pgsql;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.select_image_binding ());
+
+ if (im.version != sts.select_image_version () ||
+ imb.version == 0)
+ {
+ bind (imb.bind, im, statement_select);
+ sts.select_image_version (im.version);
+ imb.version++;
+ }
+
+ std::string text (query_statement);
+ if (!q.empty ())
+ {
+ text += " ";
+ text += q.clause ();
+ }
+
+ q.init_parameters ();
+ shared_ptr<select_statement> st (
+ new (shared) select_statement (
+ sts.connection (),
+ query_statement_name,
+ text,
+ false,
+ true,
+ q.parameter_types (),
+ q.parameter_count (),
+ q.parameters_binding (),
+ imb));
+
+ st->execute ();
+ st->deallocate ();
+
+ shared_ptr< odb::object_result_impl<object_type> > r (
+ new (shared) pgsql::object_result_impl<object_type> (
+ q, st, sts, 0));
+
+ return result<object_type> (r);
+ }
+
+ unsigned long long access::object_traits_impl< ::brep::build_delay, id_pgsql >::
+ erase_query (database&, const query_base_type& q)
+ {
+ using namespace pgsql;
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+
+ std::string text (erase_query_statement);
+ if (!q.empty ())
+ {
+ text += ' ';
+ text += q.clause ();
+ }
+
+ q.init_parameters ();
+ delete_statement st (
+ conn,
+ erase_query_statement_name,
+ text,
+ q.parameter_types (),
+ q.parameter_count (),
+ q.parameters_binding ());
+
+ return st.execute ();
+ }
+
+ odb::details::shared_ptr<prepared_query_impl>
+ access::object_traits_impl< ::brep::build_delay, id_pgsql >::
+ prepare_query (connection& c, const char* n, const query_base_type& q)
+ {
+ using namespace pgsql;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ pgsql::connection& conn (
+ static_cast<pgsql::connection&> (c));
+
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.select_image_binding ());
+
+ if (im.version != sts.select_image_version () ||
+ imb.version == 0)
+ {
+ bind (imb.bind, im, statement_select);
+ sts.select_image_version (im.version);
+ imb.version++;
+ }
+
+ std::string text (query_statement);
+ if (!q.empty ())
+ {
+ text += " ";
+ text += q.clause ();
+ }
+
+ shared_ptr<pgsql::prepared_query_impl> r (
+ new (shared) pgsql::prepared_query_impl (conn));
+ r->name = n;
+ r->execute = &execute_query;
+ r->query = q;
+ r->stmt.reset (
+ new (shared) select_statement (
+ sts.connection (),
+ n,
+ text,
+ false,
+ true,
+ r->query.parameter_types (),
+ r->query.parameter_count (),
+ r->query.parameters_binding (),
+ imb));
+
+ return r;
+ }
+
+ odb::details::shared_ptr<result_impl>
+ access::object_traits_impl< ::brep::build_delay, id_pgsql >::
+ execute_query (prepared_query_impl& q)
+ {
+ using namespace pgsql;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ pgsql::prepared_query_impl& pq (
+ static_cast<pgsql::prepared_query_impl&> (q));
+ shared_ptr<select_statement> st (
+ odb::details::inc_ref (
+ static_cast<select_statement*> (pq.stmt.get ())));
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+
+ // The connection used by the current transaction and the
+ // one used to prepare this statement must be the same.
+ //
+ assert (&conn == &st->connection ());
+
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.select_image_binding ());
+
+ if (im.version != sts.select_image_version () ||
+ imb.version == 0)
+ {
+ bind (imb.bind, im, statement_select);
+ sts.select_image_version (im.version);
+ imb.version++;
+ }
+
+ pq.query.init_parameters ();
+ st->execute ();
+
+ return shared_ptr<result_impl> (
+ new (shared) pgsql::object_result_impl<object_type> (
+ pq.query, st, sts, 0));
+ }
+}
+
+namespace odb
+{
+ static bool
+ create_schema (database& db, unsigned short pass, bool drop)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+ ODB_POTENTIALLY_UNUSED (pass);
+ ODB_POTENTIALLY_UNUSED (drop);
+
+ if (drop)
+ {
+ switch (pass)
+ {
+ case 1:
+ {
+ return true;
+ }
+ case 2:
+ {
+ db.execute ("DROP TABLE IF EXISTS \"build_delay\" CASCADE");
+ db.execute ("DROP TABLE IF EXISTS \"build_results\" CASCADE");
+ db.execute ("DROP TABLE IF EXISTS \"build\" CASCADE");
+ db.execute ("DROP TABLE IF EXISTS \"schema_version\"");
+ return false;
+ }
+ }
+ }
+ else
+ {
+ switch (pass)
+ {
+ case 1:
+ {
+ db.execute ("CREATE TABLE \"build\" (\n"
+ " \"package_tenant\" TEXT NOT NULL,\n"
+ " \"package_name\" CITEXT NOT NULL,\n"
+ " \"package_version_epoch\" INTEGER NOT NULL,\n"
+ " \"package_version_canonical_upstream\" TEXT NOT NULL,\n"
+ " \"package_version_canonical_release\" TEXT NOT NULL COLLATE \"C\",\n"
+ " \"package_version_revision\" INTEGER NOT NULL,\n"
+ " \"configuration\" TEXT NOT NULL,\n"
+ " \"toolchain_name\" TEXT NOT NULL,\n"
+ " \"toolchain_version_epoch\" INTEGER NOT NULL,\n"
+ " \"toolchain_version_canonical_upstream\" TEXT NOT NULL,\n"
+ " \"toolchain_version_canonical_release\" TEXT NOT NULL COLLATE \"C\",\n"
+ " \"toolchain_version_revision\" INTEGER NOT NULL,\n"
+ " \"package_version_upstream\" TEXT NOT NULL,\n"
+ " \"package_version_release\" TEXT NULL,\n"
+ " \"toolchain_version_upstream\" TEXT NOT NULL,\n"
+ " \"toolchain_version_release\" TEXT NULL,\n"
+ " \"state\" TEXT NOT NULL,\n"
+ " \"timestamp\" BIGINT NOT NULL,\n"
+ " \"force\" TEXT NOT NULL,\n"
+ " \"status\" TEXT NULL,\n"
+ " \"completion_timestamp\" BIGINT NOT NULL DEFAULT 0,\n"
+ " \"agent_fingerprint\" TEXT NULL,\n"
+ " \"agent_challenge\" TEXT NULL,\n"
+ " \"machine\" TEXT NOT NULL,\n"
+ " \"machine_summary\" TEXT NOT NULL,\n"
+ " \"target\" TEXT NOT NULL,\n"
+ " PRIMARY KEY (\"package_tenant\",\n"
+ " \"package_name\",\n"
+ " \"package_version_epoch\",\n"
+ " \"package_version_canonical_upstream\",\n"
+ " \"package_version_canonical_release\",\n"
+ " \"package_version_revision\",\n"
+ " \"configuration\",\n"
+ " \"toolchain_name\",\n"
+ " \"toolchain_version_epoch\",\n"
+ " \"toolchain_version_canonical_upstream\",\n"
+ " \"toolchain_version_canonical_release\",\n"
+ " \"toolchain_version_revision\"))");
+ db.execute ("CREATE INDEX \"build_timestamp_i\"\n"
+ " ON \"build\" (\"timestamp\")");
+ db.execute ("CREATE TABLE \"build_results\" (\n"
+ " \"package_tenant\" TEXT NOT NULL,\n"
+ " \"package_name\" CITEXT NOT NULL,\n"
+ " \"package_version_epoch\" INTEGER NOT NULL,\n"
+ " \"package_version_canonical_upstream\" TEXT NOT NULL,\n"
+ " \"package_version_canonical_release\" TEXT NOT NULL COLLATE \"C\",\n"
+ " \"package_version_revision\" INTEGER NOT NULL,\n"
+ " \"configuration\" TEXT NOT NULL,\n"
+ " \"toolchain_name\" TEXT NOT NULL,\n"
+ " \"toolchain_version_epoch\" INTEGER NOT NULL,\n"
+ " \"toolchain_version_canonical_upstream\" TEXT NOT NULL,\n"
+ " \"toolchain_version_canonical_release\" TEXT NOT NULL COLLATE \"C\",\n"
+ " \"toolchain_version_revision\" INTEGER NOT NULL,\n"
+ " \"index\" BIGINT NOT NULL,\n"
+ " \"operation\" TEXT NOT NULL,\n"
+ " \"status\" TEXT NOT NULL,\n"
+ " \"log\" TEXT NOT NULL,\n"
+ " CONSTRAINT \"object_id_fk\"\n"
+ " FOREIGN KEY (\"package_tenant\",\n"
+ " \"package_name\",\n"
+ " \"package_version_epoch\",\n"
+ " \"package_version_canonical_upstream\",\n"
+ " \"package_version_canonical_release\",\n"
+ " \"package_version_revision\",\n"
+ " \"configuration\",\n"
+ " \"toolchain_name\",\n"
+ " \"toolchain_version_epoch\",\n"
+ " \"toolchain_version_canonical_upstream\",\n"
+ " \"toolchain_version_canonical_release\",\n"
+ " \"toolchain_version_revision\")\n"
+ " REFERENCES \"build\" (\"package_tenant\",\n"
+ " \"package_name\",\n"
+ " \"package_version_epoch\",\n"
+ " \"package_version_canonical_upstream\",\n"
+ " \"package_version_canonical_release\",\n"
+ " \"package_version_revision\",\n"
+ " \"configuration\",\n"
+ " \"toolchain_name\",\n"
+ " \"toolchain_version_epoch\",\n"
+ " \"toolchain_version_canonical_upstream\",\n"
+ " \"toolchain_version_canonical_release\",\n"
+ " \"toolchain_version_revision\")\n"
+ " ON DELETE CASCADE)");
+ db.execute ("CREATE INDEX \"build_results_object_id_i\"\n"
+ " ON \"build_results\" (\n"
+ " \"package_tenant\",\n"
+ " \"package_name\",\n"
+ " \"package_version_epoch\",\n"
+ " \"package_version_canonical_upstream\",\n"
+ " \"package_version_canonical_release\",\n"
+ " \"package_version_revision\",\n"
+ " \"configuration\",\n"
+ " \"toolchain_name\",\n"
+ " \"toolchain_version_epoch\",\n"
+ " \"toolchain_version_canonical_upstream\",\n"
+ " \"toolchain_version_canonical_release\",\n"
+ " \"toolchain_version_revision\")");
+ db.execute ("CREATE INDEX \"build_results_index_i\"\n"
+ " ON \"build_results\" (\"index\")");
+ db.execute ("CREATE TABLE \"build_delay\" (\n"
+ " \"package_tenant\" TEXT NOT NULL,\n"
+ " \"package_name\" CITEXT NOT NULL,\n"
+ " \"package_version_epoch\" INTEGER NOT NULL,\n"
+ " \"package_version_canonical_upstream\" TEXT NOT NULL,\n"
+ " \"package_version_canonical_release\" TEXT NOT NULL COLLATE \"C\",\n"
+ " \"package_version_revision\" INTEGER NOT NULL,\n"
+ " \"configuration\" TEXT NOT NULL,\n"
+ " \"toolchain_name\" TEXT NOT NULL,\n"
+ " \"toolchain_version_epoch\" INTEGER NOT NULL,\n"
+ " \"toolchain_version_canonical_upstream\" TEXT NOT NULL,\n"
+ " \"toolchain_version_canonical_release\" TEXT NOT NULL COLLATE \"C\",\n"
+ " \"toolchain_version_revision\" INTEGER NOT NULL,\n"
+ " \"package_version_upstream\" TEXT NOT NULL,\n"
+ " \"package_version_release\" TEXT NULL,\n"
+ " \"toolchain_version_upstream\" TEXT NOT NULL,\n"
+ " \"toolchain_version_release\" TEXT NULL,\n"
+ " \"report_timestamp\" BIGINT NOT NULL,\n"
+ " \"package_timestamp\" BIGINT NOT NULL,\n"
+ " PRIMARY KEY (\"package_tenant\",\n"
+ " \"package_name\",\n"
+ " \"package_version_epoch\",\n"
+ " \"package_version_canonical_upstream\",\n"
+ " \"package_version_canonical_release\",\n"
+ " \"package_version_revision\",\n"
+ " \"configuration\",\n"
+ " \"toolchain_name\",\n"
+ " \"toolchain_version_epoch\",\n"
+ " \"toolchain_version_canonical_upstream\",\n"
+ " \"toolchain_version_canonical_release\",\n"
+ " \"toolchain_version_revision\"))");
+ return true;
+ }
+ case 2:
+ {
+ db.execute ("CREATE TABLE \"schema_version\" (\n"
+ " \"name\" TEXT NOT NULL PRIMARY KEY,\n"
+ " \"version\" BIGINT NOT NULL,\n"
+ " \"migration\" BOOLEAN NOT NULL)");
+ db.execute ("INSERT INTO \"schema_version\" (\n"
+ " \"name\", \"version\", \"migration\")\n"
+ " VALUES ('build', 12, FALSE)");
+ return false;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ static const schema_catalog_create_entry
+ create_schema_entry_ (
+ id_pgsql,
+ "build",
+ &create_schema);
+
+ static const schema_catalog_migrate_entry
+ migrate_schema_entry_12_ (
+ id_pgsql,
+ "build",
+ 12ULL,
+ 0);
+}
+
+#include <odb/post.hxx>
diff --git a/libbrep/build-odb.hxx b/libbrep/build-odb.hxx
new file mode 100644
index 0000000..9000a24
--- /dev/null
+++ b/libbrep/build-odb.hxx
@@ -0,0 +1,2056 @@
+// -*- C++ -*-
+//
+// This file was generated by ODB, object-relational mapping (ORM)
+// compiler for C++.
+//
+
+#ifndef LIBBREP_BUILD_ODB_HXX
+#define LIBBREP_BUILD_ODB_HXX
+
+#include <odb/version.hxx>
+
+#if (ODB_VERSION != 20470UL)
+#error ODB runtime version mismatch
+#endif
+
+#include <odb/pre.hxx>
+
+#include <libbrep/build.hxx>
+
+#include <libbrep/build-package-odb.hxx>
+#include <libbrep/common-odb.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/prepared-query.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
+{
+ // build
+ //
+ template <>
+ struct class_traits< ::brep::build >
+ {
+ static const class_kind kind = class_object;
+ };
+
+ template <>
+ class access::object_traits< ::brep::build >
+ {
+ public:
+ typedef ::brep::build object_type;
+ typedef ::std::shared_ptr< ::brep::build > pointer_type;
+ typedef odb::pointer_traits<pointer_type> pointer_traits;
+
+ static const bool polymorphic = false;
+
+ typedef ::brep::build_id id_type;
+
+ static const bool auto_id = false;
+
+ 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);
+ };
+
+ // toolchain
+ //
+ template <>
+ struct class_traits< ::brep::toolchain >
+ {
+ static const class_kind kind = class_view;
+ };
+
+ template <>
+ class access::view_traits< ::brep::toolchain >
+ {
+ public:
+ typedef ::brep::toolchain view_type;
+ typedef ::brep::toolchain* pointer_type;
+
+ static void
+ callback (database&, view_type&, callback_event);
+ };
+
+ // package_build
+ //
+ template <>
+ struct class_traits< ::brep::package_build >
+ {
+ static const class_kind kind = class_view;
+ };
+
+ template <>
+ class access::view_traits< ::brep::package_build >
+ {
+ public:
+ typedef ::brep::package_build view_type;
+ typedef ::brep::package_build* pointer_type;
+
+ static void
+ callback (database&, view_type&, callback_event);
+ };
+
+ // package_build_count
+ //
+ template <>
+ struct class_traits< ::brep::package_build_count >
+ {
+ static const class_kind kind = class_view;
+ };
+
+ template <>
+ class access::view_traits< ::brep::package_build_count >
+ {
+ public:
+ typedef ::brep::package_build_count view_type;
+ typedef ::brep::package_build_count* pointer_type;
+
+ static void
+ callback (database&, view_type&, callback_event);
+ };
+
+ // build_delay
+ //
+ template <>
+ struct class_traits< ::brep::build_delay >
+ {
+ static const class_kind kind = class_object;
+ };
+
+ template <>
+ class access::object_traits< ::brep::build_delay >
+ {
+ public:
+ typedef ::brep::build_delay object_type;
+ typedef ::std::shared_ptr< ::brep::build_delay > pointer_type;
+ typedef odb::pointer_traits<pointer_type> pointer_traits;
+
+ static const bool polymorphic = false;
+
+ typedef ::brep::build_id id_type;
+
+ static const bool auto_id = false;
+
+ 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);
+ };
+}
+
+#include <odb/details/buffer.hxx>
+
+#include <odb/pgsql/version.hxx>
+#include <odb/pgsql/forward.hxx>
+#include <odb/pgsql/binding.hxx>
+#include <odb/pgsql/pgsql-types.hxx>
+#include <odb/pgsql/query.hxx>
+
+namespace odb
+{
+ // operation_result
+ //
+ template <>
+ class access::composite_value_traits< ::bbot::operation_result, id_pgsql >
+ {
+ public:
+ typedef ::bbot::operation_result value_type;
+
+ struct image_type
+ {
+ // operation
+ //
+ details::buffer operation_value;
+ std::size_t operation_size;
+ bool operation_null;
+
+ // status
+ //
+ details::buffer status_value;
+ std::size_t status_size;
+ bool status_null;
+
+ // log
+ //
+ details::buffer log_value;
+ std::size_t log_size;
+ bool log_null;
+ };
+
+ static bool
+ grow (image_type&,
+ bool*);
+
+ static void
+ bind (pgsql::bind*,
+ image_type&,
+ pgsql::statement_kind);
+
+ static bool
+ init (image_type&,
+ const value_type&,
+ pgsql::statement_kind);
+
+ static void
+ init (value_type&,
+ const image_type&,
+ database*);
+
+ static bool
+ get_null (const image_type&);
+
+ static void
+ set_null (image_type&,
+ pgsql::statement_kind);
+
+ static const std::size_t column_count = 3UL;
+ };
+
+ // build_id
+ //
+ template <>
+ class access::composite_value_traits< ::brep::build_id, id_pgsql >
+ {
+ public:
+ typedef ::brep::build_id value_type;
+
+ struct image_type
+ {
+ // package
+ //
+ composite_value_traits< ::brep::package_id, id_pgsql >::image_type package_value;
+
+ // configuration
+ //
+ details::buffer configuration_value;
+ std::size_t configuration_size;
+ bool configuration_null;
+
+ // toolchain_name
+ //
+ details::buffer toolchain_name_value;
+ std::size_t toolchain_name_size;
+ bool toolchain_name_null;
+
+ // toolchain_version
+ //
+ composite_value_traits< ::brep::canonical_version, id_pgsql >::image_type toolchain_version_value;
+ };
+
+ static bool
+ grow (image_type&,
+ bool*);
+
+ static void
+ bind (pgsql::bind*,
+ image_type&,
+ pgsql::statement_kind);
+
+ static bool
+ init (image_type&,
+ const value_type&,
+ pgsql::statement_kind);
+
+ static void
+ init (value_type&,
+ const image_type&,
+ database*);
+
+ static bool
+ get_null (const image_type&);
+
+ static void
+ set_null (image_type&,
+ pgsql::statement_kind);
+
+ static const std::size_t column_count = 12UL;
+ };
+
+ // build
+ //
+ template <typename A>
+ struct query_columns< ::brep::build, id_pgsql, A >
+ {
+ // id
+ //
+ struct id_class_
+ {
+ id_class_ ()
+ {
+ }
+
+ // package
+ //
+ struct package_class_1_
+ {
+ package_class_1_ ()
+ {
+ }
+
+ // tenant
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ tenant_type_;
+
+ static const tenant_type_ tenant;
+
+ // name
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::bpkg::package_name,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ name_type_;
+
+ static const name_type_ name;
+
+ // version
+ //
+ struct version_class_2_
+ {
+ version_class_2_ ()
+ {
+ }
+
+ // epoch
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::uint16_t,
+ pgsql::id_integer >::query_type,
+ pgsql::id_integer >
+ epoch_type_;
+
+ static const epoch_type_ epoch;
+
+ // canonical_upstream
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ canonical_upstream_type_;
+
+ static const canonical_upstream_type_ canonical_upstream;
+
+ // canonical_release
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ canonical_release_type_;
+
+ static const canonical_release_type_ canonical_release;
+
+ // revision
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::uint16_t,
+ pgsql::id_integer >::query_type,
+ pgsql::id_integer >
+ revision_type_;
+
+ static const revision_type_ revision;
+ };
+
+ static const version_class_2_ version;
+ };
+
+ static const package_class_1_ package;
+
+ // configuration
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ configuration_type_;
+
+ static const configuration_type_ configuration;
+
+ // toolchain_name
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ toolchain_name_type_;
+
+ static const toolchain_name_type_ toolchain_name;
+
+ // toolchain_version
+ //
+ struct toolchain_version_class_1_
+ {
+ toolchain_version_class_1_ ()
+ {
+ }
+
+ // epoch
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::uint16_t,
+ pgsql::id_integer >::query_type,
+ pgsql::id_integer >
+ epoch_type_;
+
+ static const epoch_type_ epoch;
+
+ // canonical_upstream
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ canonical_upstream_type_;
+
+ static const canonical_upstream_type_ canonical_upstream;
+
+ // canonical_release
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ canonical_release_type_;
+
+ static const canonical_release_type_ canonical_release;
+
+ // revision
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::uint16_t,
+ pgsql::id_integer >::query_type,
+ pgsql::id_integer >
+ revision_type_;
+
+ static const revision_type_ revision;
+ };
+
+ static const toolchain_version_class_1_ toolchain_version;
+ };
+
+ static const id_class_ id;
+
+ // package_version
+ //
+ struct package_version_class_
+ {
+ package_version_class_ ()
+ {
+ }
+
+ // upstream
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ upstream_type_;
+
+ static const upstream_type_ upstream;
+
+ // release
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::basic_string< char >,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ release_type_;
+
+ static const release_type_ release;
+ };
+
+ static const package_version_class_ package_version;
+
+ // toolchain_version
+ //
+ struct toolchain_version_class_
+ {
+ toolchain_version_class_ ()
+ {
+ }
+
+ // upstream
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ upstream_type_;
+
+ static const upstream_type_ upstream;
+
+ // release
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::basic_string< char >,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ release_type_;
+
+ static const release_type_ release;
+ };
+
+ static const toolchain_version_class_ toolchain_version;
+
+ // state
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ state_type_;
+
+ static const state_type_ state;
+
+ // timestamp
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::uint64_t,
+ pgsql::id_bigint >::query_type,
+ pgsql::id_bigint >
+ timestamp_type_;
+
+ static const timestamp_type_ timestamp;
+
+ // force
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ force_type_;
+
+ static const force_type_ force;
+
+ // status
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::basic_string< char >,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ status_type_;
+
+ static const status_type_ status;
+
+ // completion_timestamp
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::uint64_t,
+ pgsql::id_bigint >::query_type,
+ pgsql::id_bigint >
+ completion_timestamp_type_;
+
+ static const completion_timestamp_type_ completion_timestamp;
+
+ // agent_fingerprint
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::basic_string< char >,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ agent_fingerprint_type_;
+
+ static const agent_fingerprint_type_ agent_fingerprint;
+
+ // agent_challenge
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::basic_string< char >,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ agent_challenge_type_;
+
+ static const agent_challenge_type_ agent_challenge;
+
+ // machine
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ machine_type_;
+
+ static const machine_type_ machine;
+
+ // machine_summary
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ machine_summary_type_;
+
+ static const machine_summary_type_ machine_summary;
+
+ // target
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ target_type_;
+
+ static const target_type_ target;
+ };
+
+ template <typename A>
+ const typename query_columns< ::brep::build, id_pgsql, A >::id_class_::package_class_1_::tenant_type_
+ query_columns< ::brep::build, id_pgsql, A >::id_class_::package_class_1_::
+ tenant (A::table_name, "\"package_tenant\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build, id_pgsql, A >::id_class_::package_class_1_::name_type_
+ query_columns< ::brep::build, id_pgsql, A >::id_class_::package_class_1_::
+ name (A::table_name, "\"package_name\"", "(?)::CITEXT");
+
+ template <typename A>
+ const typename query_columns< ::brep::build, id_pgsql, A >::id_class_::package_class_1_::version_class_2_::epoch_type_
+ query_columns< ::brep::build, id_pgsql, A >::id_class_::package_class_1_::version_class_2_::
+ epoch (A::table_name, "\"package_version_epoch\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build, id_pgsql, A >::id_class_::package_class_1_::version_class_2_::canonical_upstream_type_
+ query_columns< ::brep::build, id_pgsql, A >::id_class_::package_class_1_::version_class_2_::
+ canonical_upstream (A::table_name, "\"package_version_canonical_upstream\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build, id_pgsql, A >::id_class_::package_class_1_::version_class_2_::canonical_release_type_
+ query_columns< ::brep::build, id_pgsql, A >::id_class_::package_class_1_::version_class_2_::
+ canonical_release (A::table_name, "\"package_version_canonical_release\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build, id_pgsql, A >::id_class_::package_class_1_::version_class_2_::revision_type_
+ query_columns< ::brep::build, id_pgsql, A >::id_class_::package_class_1_::version_class_2_::
+ revision (A::table_name, "\"package_version_revision\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build, id_pgsql, A >::id_class_::package_class_1_::version_class_2_
+ query_columns< ::brep::build, id_pgsql, A >::id_class_::package_class_1_::version;
+
+ template <typename A>
+ const typename query_columns< ::brep::build, id_pgsql, A >::id_class_::package_class_1_
+ query_columns< ::brep::build, id_pgsql, A >::id_class_::package;
+
+ template <typename A>
+ const typename query_columns< ::brep::build, id_pgsql, A >::id_class_::configuration_type_
+ query_columns< ::brep::build, id_pgsql, A >::id_class_::
+ configuration (A::table_name, "\"configuration\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build, id_pgsql, A >::id_class_::toolchain_name_type_
+ query_columns< ::brep::build, id_pgsql, A >::id_class_::
+ toolchain_name (A::table_name, "\"toolchain_name\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build, id_pgsql, A >::id_class_::toolchain_version_class_1_::epoch_type_
+ query_columns< ::brep::build, id_pgsql, A >::id_class_::toolchain_version_class_1_::
+ epoch (A::table_name, "\"toolchain_version_epoch\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build, id_pgsql, A >::id_class_::toolchain_version_class_1_::canonical_upstream_type_
+ query_columns< ::brep::build, id_pgsql, A >::id_class_::toolchain_version_class_1_::
+ canonical_upstream (A::table_name, "\"toolchain_version_canonical_upstream\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build, id_pgsql, A >::id_class_::toolchain_version_class_1_::canonical_release_type_
+ query_columns< ::brep::build, id_pgsql, A >::id_class_::toolchain_version_class_1_::
+ canonical_release (A::table_name, "\"toolchain_version_canonical_release\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build, id_pgsql, A >::id_class_::toolchain_version_class_1_::revision_type_
+ query_columns< ::brep::build, id_pgsql, A >::id_class_::toolchain_version_class_1_::
+ revision (A::table_name, "\"toolchain_version_revision\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build, id_pgsql, A >::id_class_::toolchain_version_class_1_
+ query_columns< ::brep::build, id_pgsql, A >::id_class_::toolchain_version;
+
+ template <typename A>
+ const typename query_columns< ::brep::build, id_pgsql, A >::id_class_
+ query_columns< ::brep::build, id_pgsql, A >::id;
+
+ template <typename A>
+ const typename query_columns< ::brep::build, id_pgsql, A >::package_version_class_::upstream_type_
+ query_columns< ::brep::build, id_pgsql, A >::package_version_class_::
+ upstream (A::table_name, "\"package_version_upstream\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build, id_pgsql, A >::package_version_class_::release_type_
+ query_columns< ::brep::build, id_pgsql, A >::package_version_class_::
+ release (A::table_name, "\"package_version_release\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build, id_pgsql, A >::package_version_class_
+ query_columns< ::brep::build, id_pgsql, A >::package_version;
+
+ template <typename A>
+ const typename query_columns< ::brep::build, id_pgsql, A >::toolchain_version_class_::upstream_type_
+ query_columns< ::brep::build, id_pgsql, A >::toolchain_version_class_::
+ upstream (A::table_name, "\"toolchain_version_upstream\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build, id_pgsql, A >::toolchain_version_class_::release_type_
+ query_columns< ::brep::build, id_pgsql, A >::toolchain_version_class_::
+ release (A::table_name, "\"toolchain_version_release\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build, id_pgsql, A >::toolchain_version_class_
+ query_columns< ::brep::build, id_pgsql, A >::toolchain_version;
+
+ template <typename A>
+ const typename query_columns< ::brep::build, id_pgsql, A >::state_type_
+ query_columns< ::brep::build, id_pgsql, A >::
+ state (A::table_name, "\"state\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build, id_pgsql, A >::timestamp_type_
+ query_columns< ::brep::build, id_pgsql, A >::
+ timestamp (A::table_name, "\"timestamp\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build, id_pgsql, A >::force_type_
+ query_columns< ::brep::build, id_pgsql, A >::
+ force (A::table_name, "\"force\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build, id_pgsql, A >::status_type_
+ query_columns< ::brep::build, id_pgsql, A >::
+ status (A::table_name, "\"status\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build, id_pgsql, A >::completion_timestamp_type_
+ query_columns< ::brep::build, id_pgsql, A >::
+ completion_timestamp (A::table_name, "\"completion_timestamp\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build, id_pgsql, A >::agent_fingerprint_type_
+ query_columns< ::brep::build, id_pgsql, A >::
+ agent_fingerprint (A::table_name, "\"agent_fingerprint\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build, id_pgsql, A >::agent_challenge_type_
+ query_columns< ::brep::build, id_pgsql, A >::
+ agent_challenge (A::table_name, "\"agent_challenge\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build, id_pgsql, A >::machine_type_
+ query_columns< ::brep::build, id_pgsql, A >::
+ machine (A::table_name, "\"machine\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build, id_pgsql, A >::machine_summary_type_
+ query_columns< ::brep::build, id_pgsql, A >::
+ machine_summary (A::table_name, "\"machine_summary\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build, id_pgsql, A >::target_type_
+ query_columns< ::brep::build, id_pgsql, A >::
+ target (A::table_name, "\"target\"", 0);
+
+ template <typename A>
+ struct pointer_query_columns< ::brep::build, id_pgsql, A >:
+ query_columns< ::brep::build, id_pgsql, A >
+ {
+ };
+
+ template <>
+ class access::object_traits_impl< ::brep::build, id_pgsql >:
+ public access::object_traits< ::brep::build >
+ {
+ public:
+ struct id_image_type
+ {
+ composite_value_traits< ::brep::build_id, id_pgsql >::image_type id_value;
+
+ std::size_t version;
+ };
+
+ struct image_type
+ {
+ // id
+ //
+ composite_value_traits< ::brep::build_id, id_pgsql >::image_type id_value;
+
+ // package_version
+ //
+ composite_value_traits< ::brep::upstream_version, id_pgsql >::image_type package_version_value;
+
+ // toolchain_version
+ //
+ composite_value_traits< ::brep::upstream_version, id_pgsql >::image_type toolchain_version_value;
+
+ // state
+ //
+ details::buffer state_value;
+ std::size_t state_size;
+ bool state_null;
+
+ // timestamp
+ //
+ long long timestamp_value;
+ bool timestamp_null;
+
+ // force
+ //
+ details::buffer force_value;
+ std::size_t force_size;
+ bool force_null;
+
+ // status
+ //
+ details::buffer status_value;
+ std::size_t status_size;
+ bool status_null;
+
+ // completion_timestamp
+ //
+ long long completion_timestamp_value;
+ bool completion_timestamp_null;
+
+ // agent_fingerprint
+ //
+ details::buffer agent_fingerprint_value;
+ std::size_t agent_fingerprint_size;
+ bool agent_fingerprint_null;
+
+ // agent_challenge
+ //
+ details::buffer agent_challenge_value;
+ std::size_t agent_challenge_size;
+ bool agent_challenge_null;
+
+ // machine
+ //
+ details::buffer machine_value;
+ std::size_t machine_size;
+ bool machine_null;
+
+ // machine_summary
+ //
+ details::buffer machine_summary_value;
+ std::size_t machine_summary_size;
+ bool machine_summary_null;
+
+ // target
+ //
+ details::buffer target_value;
+ std::size_t target_size;
+ bool target_null;
+
+ std::size_t version;
+ };
+
+ struct extra_statement_cache_type;
+
+ // results
+ //
+ struct results_traits
+ {
+ static const char select_name[];
+ static const char insert_name[];
+ static const char delete_name[];
+
+ static const unsigned int insert_types[];
+
+ static const std::size_t id_column_count = 12UL;
+ static const std::size_t data_column_count = 16UL;
+
+ static const bool versioned = false;
+
+ static const char insert_statement[];
+ static const char select_statement[];
+ static const char delete_statement[];
+
+ typedef ::bbot::operation_results 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 pgsql::container_statements< results_traits > statements_type;
+
+ struct data_image_type
+ {
+ // index
+ //
+ long long index_value;
+ bool index_null;
+
+ // value
+ //
+ composite_value_traits< value_type, id_pgsql >::image_type value_value;
+
+ std::size_t version;
+ };
+
+ static void
+ bind (pgsql::bind*,
+ const pgsql::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&);
+ };
+
+ // results_section
+ //
+ struct results_section_traits
+ {
+ typedef object_traits_impl<object_type, id_pgsql>::image_type image_type;
+ typedef object_traits_impl<object_type, id_pgsql>::id_image_type id_image_type;
+
+ static const std::size_t id_column_count = 12UL;
+ static const std::size_t managed_optimistic_load_column_count = 0UL;
+ static const std::size_t load_column_count = 0UL;
+ static const std::size_t managed_optimistic_update_column_count = 0UL;
+ static const std::size_t update_column_count = 0UL;
+
+ static const bool versioned = false;
+
+ static void
+ load (extra_statement_cache_type&, object_type&);
+
+ static void
+ update (extra_statement_cache_type&, const object_type&);
+ };
+
+ using object_traits<object_type>::id;
+
+ static id_type
+ id (const image_type&);
+
+ static bool
+ grow (image_type&,
+ bool*);
+
+ static void
+ bind (pgsql::bind*,
+ image_type&,
+ pgsql::statement_kind);
+
+ static void
+ bind (pgsql::bind*, id_image_type&);
+
+ static bool
+ init (image_type&,
+ const object_type&,
+ pgsql::statement_kind);
+
+ static void
+ init (object_type&,
+ const image_type&,
+ database*);
+
+ static void
+ init (id_image_type&, const id_type&);
+
+ typedef pgsql::object_statements<object_type> statements_type;
+
+ typedef pgsql::query_base query_base_type;
+
+ static const std::size_t column_count = 26UL;
+ static const std::size_t id_column_count = 12UL;
+ 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&, const 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 bool
+ load (connection&, object_type&, section&);
+
+ static bool
+ update (connection&, const object_type&, const section&);
+
+ static result<object_type>
+ query (database&, const query_base_type&);
+
+ static unsigned long long
+ erase_query (database&, const query_base_type&);
+
+ static odb::details::shared_ptr<prepared_query_impl>
+ prepare_query (connection&, const char*, const query_base_type&);
+
+ static odb::details::shared_ptr<result_impl>
+ execute_query (prepared_query_impl&);
+
+ static const char persist_statement_name[];
+ static const char find_statement_name[];
+ static const char update_statement_name[];
+ static const char erase_statement_name[];
+ static const char query_statement_name[];
+ static const char erase_query_statement_name[];
+
+ static const unsigned int persist_statement_types[];
+ static const unsigned int find_statement_types[];
+ static const unsigned int update_statement_types[];
+
+ public:
+ static bool
+ find_ (statements_type&,
+ const id_type*);
+
+ static void
+ load_ (statements_type&,
+ object_type&,
+ bool reload);
+ };
+
+ template <>
+ class access::object_traits_impl< ::brep::build, id_common >:
+ public access::object_traits_impl< ::brep::build, id_pgsql >
+ {
+ };
+
+ // toolchain
+ //
+ template <>
+ class access::view_traits_impl< ::brep::toolchain, id_pgsql >:
+ public access::view_traits< ::brep::toolchain >
+ {
+ public:
+ struct image_type
+ {
+ // name
+ //
+ details::buffer name_value;
+ std::size_t name_size;
+ bool name_null;
+
+ // epoch
+ //
+ int epoch_value;
+ bool epoch_null;
+
+ // canonical_upstream
+ //
+ details::buffer canonical_upstream_value;
+ std::size_t canonical_upstream_size;
+ bool canonical_upstream_null;
+
+ // canonical_release
+ //
+ details::buffer canonical_release_value;
+ std::size_t canonical_release_size;
+ bool canonical_release_null;
+
+ // revision
+ //
+ int revision_value;
+ bool revision_null;
+
+ // version
+ //
+ composite_value_traits< ::brep::upstream_version, id_pgsql >::image_type version_value;
+
+ std::size_t version;
+ };
+
+ typedef pgsql::view_statements<view_type> statements_type;
+
+ typedef pgsql::query_base query_base_type;
+ struct query_columns;
+
+ static const bool versioned = false;
+
+ static bool
+ grow (image_type&,
+ bool*);
+
+ static void
+ bind (pgsql::bind*,
+ image_type&);
+
+ static void
+ init (view_type&,
+ const image_type&,
+ database*);
+
+ static const std::size_t column_count = 7UL;
+
+ static query_base_type
+ query_statement (const query_base_type&);
+
+ static result<view_type>
+ query (database&, const query_base_type&);
+
+ static odb::details::shared_ptr<prepared_query_impl>
+ prepare_query (connection&, const char*, const query_base_type&);
+
+ static odb::details::shared_ptr<result_impl>
+ execute_query (prepared_query_impl&);
+
+ static const char query_statement_name[];
+ };
+
+ template <>
+ class access::view_traits_impl< ::brep::toolchain, id_common >:
+ public access::view_traits_impl< ::brep::toolchain, id_pgsql >
+ {
+ };
+
+ // package_build
+ //
+ template <>
+ class access::view_traits_impl< ::brep::package_build, id_pgsql >:
+ public access::view_traits< ::brep::package_build >
+ {
+ public:
+ struct image_type
+ {
+ // build
+ //
+ object_traits_impl< ::brep::build, id_pgsql >::image_type build_value;
+
+ std::size_t version;
+ };
+
+ typedef pgsql::view_statements<view_type> statements_type;
+
+ typedef pgsql::query_base query_base_type;
+ struct query_columns;
+
+ static const bool versioned = false;
+
+ static bool
+ grow (image_type&,
+ bool*);
+
+ static void
+ bind (pgsql::bind*,
+ image_type&);
+
+ static void
+ init (view_type&,
+ const image_type&,
+ database*);
+
+ static const std::size_t column_count = 26UL;
+
+ static query_base_type
+ query_statement (const query_base_type&);
+
+ static result<view_type>
+ query (database&, const query_base_type&);
+
+ static odb::details::shared_ptr<prepared_query_impl>
+ prepare_query (connection&, const char*, const query_base_type&);
+
+ static odb::details::shared_ptr<result_impl>
+ execute_query (prepared_query_impl&);
+
+ static const char query_statement_name[];
+ };
+
+ template <>
+ class access::view_traits_impl< ::brep::package_build, id_common >:
+ public access::view_traits_impl< ::brep::package_build, id_pgsql >
+ {
+ };
+
+ // package_build_count
+ //
+ template <>
+ class access::view_traits_impl< ::brep::package_build_count, id_pgsql >:
+ public access::view_traits< ::brep::package_build_count >
+ {
+ public:
+ struct image_type
+ {
+ // result
+ //
+ long long result_value;
+ bool result_null;
+
+ std::size_t version;
+ };
+
+ typedef pgsql::view_statements<view_type> statements_type;
+
+ typedef pgsql::query_base query_base_type;
+ struct query_columns;
+
+ static const bool versioned = false;
+
+ static bool
+ grow (image_type&,
+ bool*);
+
+ static void
+ bind (pgsql::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&);
+
+ static odb::details::shared_ptr<prepared_query_impl>
+ prepare_query (connection&, const char*, const query_base_type&);
+
+ static odb::details::shared_ptr<result_impl>
+ execute_query (prepared_query_impl&);
+
+ static const char query_statement_name[];
+ };
+
+ template <>
+ class access::view_traits_impl< ::brep::package_build_count, id_common >:
+ public access::view_traits_impl< ::brep::package_build_count, id_pgsql >
+ {
+ };
+
+ // build_delay
+ //
+ template <typename A>
+ struct query_columns< ::brep::build_delay, id_pgsql, A >
+ {
+ // id
+ //
+ struct id_class_
+ {
+ id_class_ ()
+ {
+ }
+
+ // package
+ //
+ struct package_class_1_
+ {
+ package_class_1_ ()
+ {
+ }
+
+ // tenant
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ tenant_type_;
+
+ static const tenant_type_ tenant;
+
+ // name
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::bpkg::package_name,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ name_type_;
+
+ static const name_type_ name;
+
+ // version
+ //
+ struct version_class_2_
+ {
+ version_class_2_ ()
+ {
+ }
+
+ // epoch
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::uint16_t,
+ pgsql::id_integer >::query_type,
+ pgsql::id_integer >
+ epoch_type_;
+
+ static const epoch_type_ epoch;
+
+ // canonical_upstream
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ canonical_upstream_type_;
+
+ static const canonical_upstream_type_ canonical_upstream;
+
+ // canonical_release
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ canonical_release_type_;
+
+ static const canonical_release_type_ canonical_release;
+
+ // revision
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::uint16_t,
+ pgsql::id_integer >::query_type,
+ pgsql::id_integer >
+ revision_type_;
+
+ static const revision_type_ revision;
+ };
+
+ static const version_class_2_ version;
+ };
+
+ static const package_class_1_ package;
+
+ // configuration
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ configuration_type_;
+
+ static const configuration_type_ configuration;
+
+ // toolchain_name
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ toolchain_name_type_;
+
+ static const toolchain_name_type_ toolchain_name;
+
+ // toolchain_version
+ //
+ struct toolchain_version_class_1_
+ {
+ toolchain_version_class_1_ ()
+ {
+ }
+
+ // epoch
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::uint16_t,
+ pgsql::id_integer >::query_type,
+ pgsql::id_integer >
+ epoch_type_;
+
+ static const epoch_type_ epoch;
+
+ // canonical_upstream
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ canonical_upstream_type_;
+
+ static const canonical_upstream_type_ canonical_upstream;
+
+ // canonical_release
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ canonical_release_type_;
+
+ static const canonical_release_type_ canonical_release;
+
+ // revision
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::uint16_t,
+ pgsql::id_integer >::query_type,
+ pgsql::id_integer >
+ revision_type_;
+
+ static const revision_type_ revision;
+ };
+
+ static const toolchain_version_class_1_ toolchain_version;
+ };
+
+ static const id_class_ id;
+
+ // package_version
+ //
+ struct package_version_class_
+ {
+ package_version_class_ ()
+ {
+ }
+
+ // upstream
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ upstream_type_;
+
+ static const upstream_type_ upstream;
+
+ // release
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::basic_string< char >,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ release_type_;
+
+ static const release_type_ release;
+ };
+
+ static const package_version_class_ package_version;
+
+ // toolchain_version
+ //
+ struct toolchain_version_class_
+ {
+ toolchain_version_class_ ()
+ {
+ }
+
+ // upstream
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ upstream_type_;
+
+ static const upstream_type_ upstream;
+
+ // release
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::basic_string< char >,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ release_type_;
+
+ static const release_type_ release;
+ };
+
+ static const toolchain_version_class_ toolchain_version;
+
+ // report_timestamp
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::uint64_t,
+ pgsql::id_bigint >::query_type,
+ pgsql::id_bigint >
+ report_timestamp_type_;
+
+ static const report_timestamp_type_ report_timestamp;
+
+ // package_timestamp
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::uint64_t,
+ pgsql::id_bigint >::query_type,
+ pgsql::id_bigint >
+ package_timestamp_type_;
+
+ static const package_timestamp_type_ package_timestamp;
+ };
+
+ template <typename A>
+ const typename query_columns< ::brep::build_delay, id_pgsql, A >::id_class_::package_class_1_::tenant_type_
+ query_columns< ::brep::build_delay, id_pgsql, A >::id_class_::package_class_1_::
+ tenant (A::table_name, "\"package_tenant\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build_delay, id_pgsql, A >::id_class_::package_class_1_::name_type_
+ query_columns< ::brep::build_delay, id_pgsql, A >::id_class_::package_class_1_::
+ name (A::table_name, "\"package_name\"", "(?)::CITEXT");
+
+ template <typename A>
+ const typename query_columns< ::brep::build_delay, id_pgsql, A >::id_class_::package_class_1_::version_class_2_::epoch_type_
+ query_columns< ::brep::build_delay, id_pgsql, A >::id_class_::package_class_1_::version_class_2_::
+ epoch (A::table_name, "\"package_version_epoch\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build_delay, id_pgsql, A >::id_class_::package_class_1_::version_class_2_::canonical_upstream_type_
+ query_columns< ::brep::build_delay, id_pgsql, A >::id_class_::package_class_1_::version_class_2_::
+ canonical_upstream (A::table_name, "\"package_version_canonical_upstream\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build_delay, id_pgsql, A >::id_class_::package_class_1_::version_class_2_::canonical_release_type_
+ query_columns< ::brep::build_delay, id_pgsql, A >::id_class_::package_class_1_::version_class_2_::
+ canonical_release (A::table_name, "\"package_version_canonical_release\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build_delay, id_pgsql, A >::id_class_::package_class_1_::version_class_2_::revision_type_
+ query_columns< ::brep::build_delay, id_pgsql, A >::id_class_::package_class_1_::version_class_2_::
+ revision (A::table_name, "\"package_version_revision\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build_delay, id_pgsql, A >::id_class_::package_class_1_::version_class_2_
+ query_columns< ::brep::build_delay, id_pgsql, A >::id_class_::package_class_1_::version;
+
+ template <typename A>
+ const typename query_columns< ::brep::build_delay, id_pgsql, A >::id_class_::package_class_1_
+ query_columns< ::brep::build_delay, id_pgsql, A >::id_class_::package;
+
+ template <typename A>
+ const typename query_columns< ::brep::build_delay, id_pgsql, A >::id_class_::configuration_type_
+ query_columns< ::brep::build_delay, id_pgsql, A >::id_class_::
+ configuration (A::table_name, "\"configuration\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build_delay, id_pgsql, A >::id_class_::toolchain_name_type_
+ query_columns< ::brep::build_delay, id_pgsql, A >::id_class_::
+ toolchain_name (A::table_name, "\"toolchain_name\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build_delay, id_pgsql, A >::id_class_::toolchain_version_class_1_::epoch_type_
+ query_columns< ::brep::build_delay, id_pgsql, A >::id_class_::toolchain_version_class_1_::
+ epoch (A::table_name, "\"toolchain_version_epoch\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build_delay, id_pgsql, A >::id_class_::toolchain_version_class_1_::canonical_upstream_type_
+ query_columns< ::brep::build_delay, id_pgsql, A >::id_class_::toolchain_version_class_1_::
+ canonical_upstream (A::table_name, "\"toolchain_version_canonical_upstream\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build_delay, id_pgsql, A >::id_class_::toolchain_version_class_1_::canonical_release_type_
+ query_columns< ::brep::build_delay, id_pgsql, A >::id_class_::toolchain_version_class_1_::
+ canonical_release (A::table_name, "\"toolchain_version_canonical_release\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build_delay, id_pgsql, A >::id_class_::toolchain_version_class_1_::revision_type_
+ query_columns< ::brep::build_delay, id_pgsql, A >::id_class_::toolchain_version_class_1_::
+ revision (A::table_name, "\"toolchain_version_revision\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build_delay, id_pgsql, A >::id_class_::toolchain_version_class_1_
+ query_columns< ::brep::build_delay, id_pgsql, A >::id_class_::toolchain_version;
+
+ template <typename A>
+ const typename query_columns< ::brep::build_delay, id_pgsql, A >::id_class_
+ query_columns< ::brep::build_delay, id_pgsql, A >::id;
+
+ template <typename A>
+ const typename query_columns< ::brep::build_delay, id_pgsql, A >::package_version_class_::upstream_type_
+ query_columns< ::brep::build_delay, id_pgsql, A >::package_version_class_::
+ upstream (A::table_name, "\"package_version_upstream\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build_delay, id_pgsql, A >::package_version_class_::release_type_
+ query_columns< ::brep::build_delay, id_pgsql, A >::package_version_class_::
+ release (A::table_name, "\"package_version_release\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build_delay, id_pgsql, A >::package_version_class_
+ query_columns< ::brep::build_delay, id_pgsql, A >::package_version;
+
+ template <typename A>
+ const typename query_columns< ::brep::build_delay, id_pgsql, A >::toolchain_version_class_::upstream_type_
+ query_columns< ::brep::build_delay, id_pgsql, A >::toolchain_version_class_::
+ upstream (A::table_name, "\"toolchain_version_upstream\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build_delay, id_pgsql, A >::toolchain_version_class_::release_type_
+ query_columns< ::brep::build_delay, id_pgsql, A >::toolchain_version_class_::
+ release (A::table_name, "\"toolchain_version_release\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build_delay, id_pgsql, A >::toolchain_version_class_
+ query_columns< ::brep::build_delay, id_pgsql, A >::toolchain_version;
+
+ template <typename A>
+ const typename query_columns< ::brep::build_delay, id_pgsql, A >::report_timestamp_type_
+ query_columns< ::brep::build_delay, id_pgsql, A >::
+ report_timestamp (A::table_name, "\"report_timestamp\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build_delay, id_pgsql, A >::package_timestamp_type_
+ query_columns< ::brep::build_delay, id_pgsql, A >::
+ package_timestamp (A::table_name, "\"package_timestamp\"", 0);
+
+ template <typename A>
+ struct pointer_query_columns< ::brep::build_delay, id_pgsql, A >:
+ query_columns< ::brep::build_delay, id_pgsql, A >
+ {
+ };
+
+ template <>
+ class access::object_traits_impl< ::brep::build_delay, id_pgsql >:
+ public access::object_traits< ::brep::build_delay >
+ {
+ public:
+ struct id_image_type
+ {
+ composite_value_traits< ::brep::build_id, id_pgsql >::image_type id_value;
+
+ std::size_t version;
+ };
+
+ struct image_type
+ {
+ // id
+ //
+ composite_value_traits< ::brep::build_id, id_pgsql >::image_type id_value;
+
+ // package_version
+ //
+ composite_value_traits< ::brep::upstream_version, id_pgsql >::image_type package_version_value;
+
+ // toolchain_version
+ //
+ composite_value_traits< ::brep::upstream_version, id_pgsql >::image_type toolchain_version_value;
+
+ // report_timestamp
+ //
+ long long report_timestamp_value;
+ bool report_timestamp_null;
+
+ // package_timestamp
+ //
+ long long package_timestamp_value;
+ bool package_timestamp_null;
+
+ std::size_t version;
+ };
+
+ struct extra_statement_cache_type;
+
+ using object_traits<object_type>::id;
+
+ static id_type
+ id (const image_type&);
+
+ static bool
+ grow (image_type&,
+ bool*);
+
+ static void
+ bind (pgsql::bind*,
+ image_type&,
+ pgsql::statement_kind);
+
+ static void
+ bind (pgsql::bind*, id_image_type&);
+
+ static bool
+ init (image_type&,
+ const object_type&,
+ pgsql::statement_kind);
+
+ static void
+ init (object_type&,
+ const image_type&,
+ database*);
+
+ static void
+ init (id_image_type&, const id_type&);
+
+ typedef pgsql::object_statements<object_type> statements_type;
+
+ typedef pgsql::query_base query_base_type;
+
+ static const std::size_t column_count = 18UL;
+ static const std::size_t id_column_count = 12UL;
+ 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&, const 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&);
+
+ static odb::details::shared_ptr<prepared_query_impl>
+ prepare_query (connection&, const char*, const query_base_type&);
+
+ static odb::details::shared_ptr<result_impl>
+ execute_query (prepared_query_impl&);
+
+ static const char persist_statement_name[];
+ static const char find_statement_name[];
+ static const char update_statement_name[];
+ static const char erase_statement_name[];
+ static const char query_statement_name[];
+ static const char erase_query_statement_name[];
+
+ static const unsigned int persist_statement_types[];
+ static const unsigned int find_statement_types[];
+ static const unsigned int update_statement_types[];
+
+ public:
+ static bool
+ find_ (statements_type&,
+ const id_type*);
+
+ static void
+ load_ (statements_type&,
+ object_type&,
+ bool reload);
+ };
+
+ template <>
+ class access::object_traits_impl< ::brep::build_delay, id_common >:
+ public access::object_traits_impl< ::brep::build_delay, id_pgsql >
+ {
+ };
+
+ // build
+ //
+ // toolchain
+ //
+ struct access::view_traits_impl< ::brep::toolchain, id_pgsql >::query_columns
+ {
+ // build
+ //
+ typedef
+ odb::pointer_query_columns<
+ ::brep::build,
+ id_pgsql,
+ odb::access::object_traits_impl< ::brep::build, id_pgsql > >
+ build;
+
+ // build_package
+ //
+ typedef
+ odb::pointer_query_columns<
+ ::brep::build_package,
+ id_pgsql,
+ odb::access::object_traits_impl< ::brep::build_package, id_pgsql > >
+ build_package;
+ };
+
+ // package_build
+ //
+ struct access::view_traits_impl< ::brep::package_build, id_pgsql >::query_columns
+ {
+ // build
+ //
+ typedef
+ odb::pointer_query_columns<
+ ::brep::build,
+ id_pgsql,
+ odb::access::object_traits_impl< ::brep::build, id_pgsql > >
+ build;
+
+ // build_package
+ //
+ typedef
+ odb::pointer_query_columns<
+ ::brep::build_package,
+ id_pgsql,
+ odb::access::object_traits_impl< ::brep::build_package, id_pgsql > >
+ build_package;
+
+ // build_tenant
+ //
+ typedef
+ odb::pointer_query_columns<
+ ::brep::build_tenant,
+ id_pgsql,
+ odb::access::object_traits_impl< ::brep::build_tenant, id_pgsql > >
+ build_tenant;
+ };
+
+ // package_build_count
+ //
+ struct access::view_traits_impl< ::brep::package_build_count, id_pgsql >::query_columns
+ {
+ // build
+ //
+ typedef
+ odb::pointer_query_columns<
+ ::brep::build,
+ id_pgsql,
+ odb::access::object_traits_impl< ::brep::build, id_pgsql > >
+ build;
+
+ // build_package
+ //
+ typedef
+ odb::pointer_query_columns<
+ ::brep::build_package,
+ id_pgsql,
+ odb::access::object_traits_impl< ::brep::build_package, id_pgsql > >
+ build_package;
+
+ // build_tenant
+ //
+ typedef
+ odb::pointer_query_columns<
+ ::brep::build_tenant,
+ id_pgsql,
+ odb::access::object_traits_impl< ::brep::build_tenant, id_pgsql > >
+ build_tenant;
+ };
+
+ // build_delay
+ //
+}
+
+#include <libbrep/build-odb.ixx>
+
+#include <odb/post.hxx>
+
+#endif // LIBBREP_BUILD_ODB_HXX
diff --git a/libbrep/build-odb.ixx b/libbrep/build-odb.ixx
new file mode 100644
index 0000000..a1fe977
--- /dev/null
+++ b/libbrep/build-odb.ixx
@@ -0,0 +1,207 @@
+// -*- C++ -*-
+//
+// This file was generated by ODB, object-relational mapping (ORM)
+// compiler for C++.
+//
+
+namespace odb
+{
+ // build
+ //
+
+ inline
+ access::object_traits< ::brep::build >::id_type
+ access::object_traits< ::brep::build >::
+ id (const object_type& o)
+ {
+ return o.id;
+ }
+
+ inline
+ void access::object_traits< ::brep::build >::
+ callback (database& db, object_type& x, callback_event e)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+ ODB_POTENTIALLY_UNUSED (x);
+ ODB_POTENTIALLY_UNUSED (e);
+ }
+
+ inline
+ void access::object_traits< ::brep::build >::
+ callback (database& db, const object_type& x, callback_event e)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+ ODB_POTENTIALLY_UNUSED (x);
+ ODB_POTENTIALLY_UNUSED (e);
+ }
+
+ // toolchain
+ //
+
+ inline
+ void access::view_traits< ::brep::toolchain >::
+ callback (database& db, view_type& x, callback_event e)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+ ODB_POTENTIALLY_UNUSED (x);
+ ODB_POTENTIALLY_UNUSED (e);
+ }
+
+ // package_build
+ //
+
+ inline
+ void access::view_traits< ::brep::package_build >::
+ callback (database& db, view_type& x, callback_event e)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+ ODB_POTENTIALLY_UNUSED (x);
+ ODB_POTENTIALLY_UNUSED (e);
+ }
+
+ // package_build_count
+ //
+
+ inline
+ void access::view_traits< ::brep::package_build_count >::
+ callback (database& db, view_type& x, callback_event e)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+ ODB_POTENTIALLY_UNUSED (x);
+ ODB_POTENTIALLY_UNUSED (e);
+ }
+
+ // build_delay
+ //
+
+ inline
+ access::object_traits< ::brep::build_delay >::id_type
+ access::object_traits< ::brep::build_delay >::
+ id (const object_type& o)
+ {
+ return o.id;
+ }
+
+ inline
+ void access::object_traits< ::brep::build_delay >::
+ callback (database& db, object_type& x, callback_event e)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+ ODB_POTENTIALLY_UNUSED (x);
+ ODB_POTENTIALLY_UNUSED (e);
+ }
+
+ inline
+ void access::object_traits< ::brep::build_delay >::
+ callback (database& db, const object_type& x, callback_event e)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+ ODB_POTENTIALLY_UNUSED (x);
+ ODB_POTENTIALLY_UNUSED (e);
+ }
+}
+
+namespace odb
+{
+ // operation_result
+ //
+
+ inline
+ bool access::composite_value_traits< ::bbot::operation_result, id_pgsql >::
+ get_null (const image_type& i)
+ {
+ bool r (true);
+ r = r && i.operation_null;
+ r = r && i.status_null;
+ r = r && i.log_null;
+ return r;
+ }
+
+ inline
+ void access::composite_value_traits< ::bbot::operation_result, id_pgsql >::
+ set_null (image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ i.operation_null = true;
+ i.status_null = true;
+ i.log_null = true;
+ }
+
+ // build_id
+ //
+
+ inline
+ bool access::composite_value_traits< ::brep::build_id, id_pgsql >::
+ get_null (const image_type& i)
+ {
+ bool r (true);
+ r = r && composite_value_traits< ::brep::package_id, id_pgsql >::get_null (i.package_value);
+ r = r && i.configuration_null;
+ r = r && i.toolchain_name_null;
+ r = r && composite_value_traits< ::brep::canonical_version, id_pgsql >::get_null (i.toolchain_version_value);
+ return r;
+ }
+
+ inline
+ void access::composite_value_traits< ::brep::build_id, id_pgsql >::
+ set_null (image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ composite_value_traits< ::brep::package_id, id_pgsql >::set_null (i.package_value, sk);
+ i.configuration_null = true;
+ i.toolchain_name_null = true;
+ composite_value_traits< ::brep::canonical_version, id_pgsql >::set_null (i.toolchain_version_value, sk);
+ }
+
+ // build
+ //
+
+ inline
+ void access::object_traits_impl< ::brep::build, id_pgsql >::
+ erase (database& db, const object_type& obj)
+ {
+ callback (db, obj, callback_event::pre_erase);
+ erase (db, id (obj));
+ callback (db, obj, callback_event::post_erase);
+ }
+
+ // toolchain
+ //
+
+ // package_build
+ //
+
+ // package_build_count
+ //
+
+ // build_delay
+ //
+
+ inline
+ void access::object_traits_impl< ::brep::build_delay, id_pgsql >::
+ erase (database& db, const object_type& obj)
+ {
+ callback (db, obj, callback_event::pre_erase);
+ erase (db, id (obj));
+ callback (db, obj, callback_event::post_erase);
+ }
+
+ inline
+ void access::object_traits_impl< ::brep::build_delay, id_pgsql >::
+ load_ (statements_type& sts,
+ object_type& obj,
+ bool)
+ {
+ ODB_POTENTIALLY_UNUSED (sts);
+ ODB_POTENTIALLY_UNUSED (obj);
+ }
+}
+
diff --git a/libbrep/build-package-odb.cxx b/libbrep/build-package-odb.cxx
new file mode 100644
index 0000000..8b6e3ca
--- /dev/null
+++ b/libbrep/build-package-odb.cxx
@@ -0,0 +1,3988 @@
+// -*- C++ -*-
+//
+// This file was generated by ODB, object-relational mapping (ORM)
+// compiler for C++.
+//
+
+#include <odb/pre.hxx>
+
+#include <libbrep/build-package-odb.hxx>
+
+#include <cassert>
+#include <cstring> // std::memcpy
+
+
+#include <odb/pgsql/traits.hxx>
+#include <odb/pgsql/database.hxx>
+#include <odb/pgsql/transaction.hxx>
+#include <odb/pgsql/connection.hxx>
+#include <odb/pgsql/statement.hxx>
+#include <odb/pgsql/statement-cache.hxx>
+#include <odb/pgsql/simple-object-statements.hxx>
+#include <odb/pgsql/view-statements.hxx>
+#include <odb/pgsql/container-statements.hxx>
+#include <odb/pgsql/exceptions.hxx>
+#include <odb/pgsql/prepared-query.hxx>
+#include <odb/pgsql/simple-object-result.hxx>
+#include <odb/pgsql/view-result.hxx>
+
+namespace odb
+{
+ // build_tenant
+ //
+
+ const char access::object_traits_impl< ::brep::build_tenant, id_pgsql >::
+ persist_statement_name[] = "persist_brep_build_tenant";
+
+ const char access::object_traits_impl< ::brep::build_tenant, id_pgsql >::
+ find_statement_name[] = "find_brep_build_tenant";
+
+ const char access::object_traits_impl< ::brep::build_tenant, id_pgsql >::
+ erase_statement_name[] = "erase_brep_build_tenant";
+
+ const char access::object_traits_impl< ::brep::build_tenant, id_pgsql >::
+ query_statement_name[] = "query_brep_build_tenant";
+
+ const char access::object_traits_impl< ::brep::build_tenant, id_pgsql >::
+ erase_query_statement_name[] = "erase_query_brep_build_tenant";
+
+ const unsigned int access::object_traits_impl< ::brep::build_tenant, id_pgsql >::
+ persist_statement_types[] =
+ {
+ pgsql::text_oid,
+ pgsql::bool_oid
+ };
+
+ const unsigned int access::object_traits_impl< ::brep::build_tenant, id_pgsql >::
+ find_statement_types[] =
+ {
+ pgsql::text_oid
+ };
+
+ struct access::object_traits_impl< ::brep::build_tenant, id_pgsql >::extra_statement_cache_type
+ {
+ extra_statement_cache_type (
+ pgsql::connection&,
+ image_type&,
+ id_image_type&,
+ pgsql::binding&,
+ pgsql::binding&,
+ pgsql::native_binding&,
+ const unsigned int*)
+ {
+ }
+ };
+
+ access::object_traits_impl< ::brep::build_tenant, id_pgsql >::id_type
+ access::object_traits_impl< ::brep::build_tenant, id_pgsql >::
+ id (const image_type& i)
+ {
+ pgsql::database* db (0);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ id_type id;
+ {
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ id,
+ i.id_value,
+ i.id_size,
+ i.id_null);
+ }
+
+ return id;
+ }
+
+ bool access::object_traits_impl< ::brep::build_tenant, id_pgsql >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // id
+ //
+ if (t[0UL])
+ {
+ i.id_value.capacity (i.id_size);
+ grew = true;
+ }
+
+ // archived
+ //
+ t[1UL] = 0;
+
+ return grew;
+ }
+
+ void access::object_traits_impl< ::brep::build_tenant, id_pgsql >::
+ bind (pgsql::bind* b,
+ image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ assert (sk != statement_update);
+
+ std::size_t n (0);
+
+ // id
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.id_value.data ();
+ b[n].capacity = i.id_value.capacity ();
+ b[n].size = &i.id_size;
+ b[n].is_null = &i.id_null;
+ n++;
+
+ // archived
+ //
+ b[n].type = pgsql::bind::boolean_;
+ b[n].buffer = &i.archived_value;
+ b[n].is_null = &i.archived_null;
+ n++;
+ }
+
+ void access::object_traits_impl< ::brep::build_tenant, id_pgsql >::
+ bind (pgsql::bind* b, id_image_type& i)
+ {
+ std::size_t n (0);
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.id_value.data ();
+ b[n].capacity = i.id_value.capacity ();
+ b[n].size = &i.id_size;
+ b[n].is_null = &i.id_null;
+ }
+
+ bool access::object_traits_impl< ::brep::build_tenant, id_pgsql >::
+ init (image_type& i,
+ const object_type& o,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ assert (sk != statement_update);
+
+ bool grew (false);
+
+ // id
+ //
+ {
+ ::std::string const& v =
+ o.id;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.id_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.id_value,
+ size,
+ is_null,
+ v);
+ i.id_null = is_null;
+ i.id_size = size;
+ grew = grew || (cap != i.id_value.capacity ());
+ }
+
+ // archived
+ //
+ {
+ bool const& v =
+ o.archived;
+
+ bool is_null (false);
+ pgsql::value_traits<
+ bool,
+ pgsql::id_boolean >::set_image (
+ i.archived_value, is_null, v);
+ i.archived_null = is_null;
+ }
+
+ return grew;
+ }
+
+ void access::object_traits_impl< ::brep::build_tenant, id_pgsql >::
+ init (object_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // id
+ //
+ {
+ ::std::string& v =
+ o.id;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.id_value,
+ i.id_size,
+ i.id_null);
+ }
+
+ // archived
+ //
+ {
+ bool& v =
+ o.archived;
+
+ pgsql::value_traits<
+ bool,
+ pgsql::id_boolean >::set_value (
+ v,
+ i.archived_value,
+ i.archived_null);
+ }
+ }
+
+ void access::object_traits_impl< ::brep::build_tenant, id_pgsql >::
+ init (id_image_type& i, const id_type& id)
+ {
+ bool grew (false);
+ {
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.id_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.id_value,
+ size,
+ is_null,
+ id);
+ i.id_null = is_null;
+ i.id_size = size;
+ grew = grew || (cap != i.id_value.capacity ());
+ }
+
+ if (grew)
+ i.version++;
+ }
+
+ const char access::object_traits_impl< ::brep::build_tenant, id_pgsql >::persist_statement[] =
+ "INSERT INTO \"build_tenant\" "
+ "(\"id\", "
+ "\"archived\") "
+ "VALUES "
+ "($1, $2)";
+
+ const char access::object_traits_impl< ::brep::build_tenant, id_pgsql >::find_statement[] =
+ "SELECT "
+ "\"build_tenant\".\"id\", "
+ "\"build_tenant\".\"archived\" "
+ "FROM \"build_tenant\" "
+ "WHERE \"build_tenant\".\"id\"=$1";
+
+ const char access::object_traits_impl< ::brep::build_tenant, id_pgsql >::erase_statement[] =
+ "DELETE FROM \"build_tenant\" "
+ "WHERE \"id\"=$1";
+
+ const char access::object_traits_impl< ::brep::build_tenant, id_pgsql >::query_statement[] =
+ "SELECT "
+ "\"build_tenant\".\"id\", "
+ "\"build_tenant\".\"archived\" "
+ "FROM \"build_tenant\"";
+
+ const char access::object_traits_impl< ::brep::build_tenant, id_pgsql >::erase_query_statement[] =
+ "DELETE FROM \"build_tenant\"";
+
+ const char access::object_traits_impl< ::brep::build_tenant, id_pgsql >::table_name[] =
+ "\"build_tenant\"";
+
+ void access::object_traits_impl< ::brep::build_tenant, id_pgsql >::
+ persist (database& db, const object_type& obj)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+
+ using namespace pgsql;
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ callback (db,
+ obj,
+ callback_event::pre_persist);
+
+ image_type& im (sts.image ());
+ binding& imb (sts.insert_image_binding ());
+
+ if (init (im, obj, statement_insert))
+ im.version++;
+
+ if (im.version != sts.insert_image_version () ||
+ imb.version == 0)
+ {
+ bind (imb.bind, im, statement_insert);
+ sts.insert_image_version (im.version);
+ imb.version++;
+ }
+
+ insert_statement& st (sts.persist_statement ());
+ if (!st.execute ())
+ throw object_already_persistent ();
+
+ callback (db,
+ obj,
+ callback_event::post_persist);
+ }
+
+ void access::object_traits_impl< ::brep::build_tenant, id_pgsql >::
+ erase (database& db, const id_type& id)
+ {
+ using namespace pgsql;
+
+ ODB_POTENTIALLY_UNUSED (db);
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ id_image_type& i (sts.id_image ());
+ init (i, id);
+
+ binding& idb (sts.id_image_binding ());
+ if (i.version != sts.id_image_version () || idb.version == 0)
+ {
+ bind (idb.bind, i);
+ sts.id_image_version (i.version);
+ idb.version++;
+ }
+
+ if (sts.erase_statement ().execute () != 1)
+ throw object_not_persistent ();
+
+ pointer_cache_traits::erase (db, id);
+ }
+
+ access::object_traits_impl< ::brep::build_tenant, id_pgsql >::pointer_type
+ access::object_traits_impl< ::brep::build_tenant, id_pgsql >::
+ find (database& db, const id_type& id)
+ {
+ using namespace pgsql;
+
+ {
+ pointer_type p (pointer_cache_traits::find (db, id));
+
+ if (!pointer_traits::null_ptr (p))
+ return p;
+ }
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ statements_type::auto_lock l (sts);
+
+ if (l.locked ())
+ {
+ if (!find_ (sts, &id))
+ return pointer_type ();
+ }
+
+ pointer_type p (
+ access::object_factory<object_type, pointer_type>::create ());
+ pointer_traits::guard pg (p);
+
+ pointer_cache_traits::insert_guard ig (
+ pointer_cache_traits::insert (db, id, p));
+
+ object_type& obj (pointer_traits::get_ref (p));
+
+ if (l.locked ())
+ {
+ select_statement& st (sts.find_statement ());
+ ODB_POTENTIALLY_UNUSED (st);
+
+ callback (db, obj, callback_event::pre_load);
+ init (obj, sts.image (), &db);
+ load_ (sts, obj, false);
+ sts.load_delayed (0);
+ l.unlock ();
+ callback (db, obj, callback_event::post_load);
+ pointer_cache_traits::load (ig.position ());
+ }
+ else
+ sts.delay_load (id, obj, ig.position ());
+
+ ig.release ();
+ pg.release ();
+ return p;
+ }
+
+ bool access::object_traits_impl< ::brep::build_tenant, id_pgsql >::
+ find (database& db, const id_type& id, object_type& obj)
+ {
+ using namespace pgsql;
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ statements_type::auto_lock l (sts);
+ assert (l.locked ()) /* Must be a top-level call. */;
+
+ if (!find_ (sts, &id))
+ return false;
+
+ select_statement& st (sts.find_statement ());
+ ODB_POTENTIALLY_UNUSED (st);
+
+ reference_cache_traits::position_type pos (
+ reference_cache_traits::insert (db, id, obj));
+ reference_cache_traits::insert_guard ig (pos);
+
+ callback (db, obj, callback_event::pre_load);
+ init (obj, sts.image (), &db);
+ load_ (sts, obj, false);
+ sts.load_delayed (0);
+ l.unlock ();
+ callback (db, obj, callback_event::post_load);
+ reference_cache_traits::load (pos);
+ ig.release ();
+ return true;
+ }
+
+ bool access::object_traits_impl< ::brep::build_tenant, id_pgsql >::
+ reload (database& db, object_type& obj)
+ {
+ using namespace pgsql;
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ statements_type::auto_lock l (sts);
+ assert (l.locked ()) /* Must be a top-level call. */;
+
+ const id_type& id (object_traits_impl::id (obj));
+ if (!find_ (sts, &id))
+ return false;
+
+ select_statement& st (sts.find_statement ());
+ ODB_POTENTIALLY_UNUSED (st);
+
+ callback (db, obj, callback_event::pre_load);
+ init (obj, sts.image (), &db);
+ load_ (sts, obj, true);
+ sts.load_delayed (0);
+ l.unlock ();
+ callback (db, obj, callback_event::post_load);
+ return true;
+ }
+
+ bool access::object_traits_impl< ::brep::build_tenant, id_pgsql >::
+ find_ (statements_type& sts,
+ const id_type* id)
+ {
+ using namespace pgsql;
+
+ id_image_type& i (sts.id_image ());
+ init (i, *id);
+
+ binding& idb (sts.id_image_binding ());
+ if (i.version != sts.id_image_version () || idb.version == 0)
+ {
+ bind (idb.bind, i);
+ sts.id_image_version (i.version);
+ idb.version++;
+ }
+
+ image_type& im (sts.image ());
+ binding& imb (sts.select_image_binding ());
+
+ if (im.version != sts.select_image_version () ||
+ imb.version == 0)
+ {
+ bind (imb.bind, im, statement_select);
+ sts.select_image_version (im.version);
+ imb.version++;
+ }
+
+ select_statement& st (sts.find_statement ());
+
+ st.execute ();
+ auto_result ar (st);
+ select_statement::result r (st.fetch ());
+
+ if (r == select_statement::truncated)
+ {
+ if (grow (im, sts.select_image_truncated ()))
+ im.version++;
+
+ if (im.version != sts.select_image_version ())
+ {
+ bind (imb.bind, im, statement_select);
+ sts.select_image_version (im.version);
+ imb.version++;
+ st.refetch ();
+ }
+ }
+
+ return r != select_statement::no_data;
+ }
+
+ result< access::object_traits_impl< ::brep::build_tenant, id_pgsql >::object_type >
+ access::object_traits_impl< ::brep::build_tenant, id_pgsql >::
+ query (database&, const query_base_type& q)
+ {
+ using namespace pgsql;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.select_image_binding ());
+
+ if (im.version != sts.select_image_version () ||
+ imb.version == 0)
+ {
+ bind (imb.bind, im, statement_select);
+ sts.select_image_version (im.version);
+ imb.version++;
+ }
+
+ std::string text (query_statement);
+ if (!q.empty ())
+ {
+ text += " ";
+ text += q.clause ();
+ }
+
+ q.init_parameters ();
+ shared_ptr<select_statement> st (
+ new (shared) select_statement (
+ sts.connection (),
+ query_statement_name,
+ text,
+ false,
+ true,
+ q.parameter_types (),
+ q.parameter_count (),
+ q.parameters_binding (),
+ imb));
+
+ st->execute ();
+ st->deallocate ();
+
+ shared_ptr< odb::object_result_impl<object_type> > r (
+ new (shared) pgsql::object_result_impl<object_type> (
+ q, st, sts, 0));
+
+ return result<object_type> (r);
+ }
+
+ unsigned long long access::object_traits_impl< ::brep::build_tenant, id_pgsql >::
+ erase_query (database&, const query_base_type& q)
+ {
+ using namespace pgsql;
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+
+ std::string text (erase_query_statement);
+ if (!q.empty ())
+ {
+ text += ' ';
+ text += q.clause ();
+ }
+
+ q.init_parameters ();
+ delete_statement st (
+ conn,
+ erase_query_statement_name,
+ text,
+ q.parameter_types (),
+ q.parameter_count (),
+ q.parameters_binding ());
+
+ return st.execute ();
+ }
+
+ odb::details::shared_ptr<prepared_query_impl>
+ access::object_traits_impl< ::brep::build_tenant, id_pgsql >::
+ prepare_query (connection& c, const char* n, const query_base_type& q)
+ {
+ using namespace pgsql;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ pgsql::connection& conn (
+ static_cast<pgsql::connection&> (c));
+
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.select_image_binding ());
+
+ if (im.version != sts.select_image_version () ||
+ imb.version == 0)
+ {
+ bind (imb.bind, im, statement_select);
+ sts.select_image_version (im.version);
+ imb.version++;
+ }
+
+ std::string text (query_statement);
+ if (!q.empty ())
+ {
+ text += " ";
+ text += q.clause ();
+ }
+
+ shared_ptr<pgsql::prepared_query_impl> r (
+ new (shared) pgsql::prepared_query_impl (conn));
+ r->name = n;
+ r->execute = &execute_query;
+ r->query = q;
+ r->stmt.reset (
+ new (shared) select_statement (
+ sts.connection (),
+ n,
+ text,
+ false,
+ true,
+ r->query.parameter_types (),
+ r->query.parameter_count (),
+ r->query.parameters_binding (),
+ imb));
+
+ return r;
+ }
+
+ odb::details::shared_ptr<result_impl>
+ access::object_traits_impl< ::brep::build_tenant, id_pgsql >::
+ execute_query (prepared_query_impl& q)
+ {
+ using namespace pgsql;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ pgsql::prepared_query_impl& pq (
+ static_cast<pgsql::prepared_query_impl&> (q));
+ shared_ptr<select_statement> st (
+ odb::details::inc_ref (
+ static_cast<select_statement*> (pq.stmt.get ())));
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+
+ // The connection used by the current transaction and the
+ // one used to prepare this statement must be the same.
+ //
+ assert (&conn == &st->connection ());
+
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.select_image_binding ());
+
+ if (im.version != sts.select_image_version () ||
+ imb.version == 0)
+ {
+ bind (imb.bind, im, statement_select);
+ sts.select_image_version (im.version);
+ imb.version++;
+ }
+
+ pq.query.init_parameters ();
+ st->execute ();
+
+ return shared_ptr<result_impl> (
+ new (shared) pgsql::object_result_impl<object_type> (
+ pq.query, st, sts, 0));
+ }
+
+ // build_repository
+ //
+
+ const char access::object_traits_impl< ::brep::build_repository, id_pgsql >::
+ persist_statement_name[] = "persist_brep_build_repository";
+
+ const char access::object_traits_impl< ::brep::build_repository, id_pgsql >::
+ find_statement_name[] = "find_brep_build_repository";
+
+ const char access::object_traits_impl< ::brep::build_repository, id_pgsql >::
+ erase_statement_name[] = "erase_brep_build_repository";
+
+ const char access::object_traits_impl< ::brep::build_repository, id_pgsql >::
+ query_statement_name[] = "query_brep_build_repository";
+
+ const char access::object_traits_impl< ::brep::build_repository, id_pgsql >::
+ erase_query_statement_name[] = "erase_query_brep_build_repository";
+
+ const unsigned int access::object_traits_impl< ::brep::build_repository, id_pgsql >::
+ persist_statement_types[] =
+ {
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::text_oid
+ };
+
+ const unsigned int access::object_traits_impl< ::brep::build_repository, id_pgsql >::
+ find_statement_types[] =
+ {
+ pgsql::text_oid,
+ pgsql::text_oid
+ };
+
+ struct access::object_traits_impl< ::brep::build_repository, id_pgsql >::extra_statement_cache_type
+ {
+ extra_statement_cache_type (
+ pgsql::connection&,
+ image_type&,
+ id_image_type&,
+ pgsql::binding&,
+ pgsql::binding&,
+ pgsql::native_binding&,
+ const unsigned int*)
+ {
+ }
+ };
+
+ access::object_traits_impl< ::brep::build_repository, id_pgsql >::id_type
+ access::object_traits_impl< ::brep::build_repository, id_pgsql >::
+ id (const image_type& i)
+ {
+ pgsql::database* db (0);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ id_type id;
+ {
+ composite_value_traits< ::brep::repository_id, id_pgsql >::init (
+ id,
+ i.id_value,
+ db);
+ }
+
+ return id;
+ }
+
+ bool access::object_traits_impl< ::brep::build_repository, id_pgsql >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // id
+ //
+ if (composite_value_traits< ::brep::repository_id, id_pgsql >::grow (
+ i.id_value, t + 0UL))
+ grew = true;
+
+ // location
+ //
+ if (composite_value_traits< ::brep::_repository_location, id_pgsql >::grow (
+ i.location_value, t + 2UL))
+ grew = true;
+
+ // certificate_fingerprint
+ //
+ if (t[4UL])
+ {
+ i.certificate_fingerprint_value.capacity (i.certificate_fingerprint_size);
+ grew = true;
+ }
+
+ return grew;
+ }
+
+ void access::object_traits_impl< ::brep::build_repository, id_pgsql >::
+ bind (pgsql::bind* b,
+ image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ assert (sk != statement_update);
+
+ std::size_t n (0);
+
+ // id
+ //
+ composite_value_traits< ::brep::repository_id, id_pgsql >::bind (
+ b + n, i.id_value, sk);
+ n += 2UL;
+
+ // location
+ //
+ composite_value_traits< ::brep::_repository_location, id_pgsql >::bind (
+ b + n, i.location_value, sk);
+ n += 2UL;
+
+ // certificate_fingerprint
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.certificate_fingerprint_value.data ();
+ b[n].capacity = i.certificate_fingerprint_value.capacity ();
+ b[n].size = &i.certificate_fingerprint_size;
+ b[n].is_null = &i.certificate_fingerprint_null;
+ n++;
+ }
+
+ void access::object_traits_impl< ::brep::build_repository, id_pgsql >::
+ bind (pgsql::bind* b, id_image_type& i)
+ {
+ std::size_t n (0);
+ pgsql::statement_kind sk (pgsql::statement_select);
+ composite_value_traits< ::brep::repository_id, id_pgsql >::bind (
+ b + n, i.id_value, sk);
+ }
+
+ bool access::object_traits_impl< ::brep::build_repository, id_pgsql >::
+ init (image_type& i,
+ const object_type& o,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ assert (sk != statement_update);
+
+ bool grew (false);
+
+ // id
+ //
+ {
+ ::brep::repository_id const& v =
+ o.id;
+
+ if (composite_value_traits< ::brep::repository_id, id_pgsql >::init (
+ i.id_value,
+ v,
+ sk))
+ grew = true;
+ }
+
+ // location
+ //
+ {
+ ::bpkg::repository_location const& v =
+ o.location;
+
+ // From common.hxx:285:14
+ ::brep::_repository_location const& vt =
+ brep::_repository_location
+ {
+ (v).url (), (v).empty () ? brep::repository_type::pkg : (v).type ()
+ };
+
+
+ if (composite_value_traits< ::brep::_repository_location, id_pgsql >::init (
+ i.location_value,
+ vt,
+ sk))
+ grew = true;
+ }
+
+ // certificate_fingerprint
+ //
+ {
+ ::butl::optional< ::std::basic_string< char > > const& v =
+ o.certificate_fingerprint;
+
+ bool is_null (true);
+ std::size_t size (0);
+ std::size_t cap (i.certificate_fingerprint_value.capacity ());
+ pgsql::value_traits<
+ ::butl::optional< ::std::basic_string< char > >,
+ pgsql::id_string >::set_image (
+ i.certificate_fingerprint_value,
+ size,
+ is_null,
+ v);
+ i.certificate_fingerprint_null = is_null;
+ i.certificate_fingerprint_size = size;
+ grew = grew || (cap != i.certificate_fingerprint_value.capacity ());
+ }
+
+ return grew;
+ }
+
+ void access::object_traits_impl< ::brep::build_repository, id_pgsql >::
+ init (object_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // id
+ //
+ {
+ ::brep::repository_id& v =
+ o.id;
+
+ composite_value_traits< ::brep::repository_id, id_pgsql >::init (
+ v,
+ i.id_value,
+ db);
+ }
+
+ // location
+ //
+ {
+ // From build-package.hxx:63:7
+ ::bpkg::repository_location v;
+
+ ::brep::_repository_location vt;
+
+ composite_value_traits< ::brep::_repository_location, id_pgsql >::init (
+ vt,
+ i.location_value,
+ db);
+
+ // From common.hxx:285:14
+ v = brep::repository_location (std::move ((vt).url), (vt).type);
+ // From build-package.hxx:63:7
+ o.location = std::move (v);
+ assert (o.canonical_name == o.location.canonical_name ());
+ }
+
+ // certificate_fingerprint
+ //
+ {
+ ::butl::optional< ::std::basic_string< char > >& v =
+ o.certificate_fingerprint;
+
+ pgsql::value_traits<
+ ::butl::optional< ::std::basic_string< char > >,
+ pgsql::id_string >::set_value (
+ v,
+ i.certificate_fingerprint_value,
+ i.certificate_fingerprint_size,
+ i.certificate_fingerprint_null);
+ }
+ }
+
+ void access::object_traits_impl< ::brep::build_repository, id_pgsql >::
+ init (id_image_type& i, const id_type& id)
+ {
+ bool grew (false);
+ pgsql::statement_kind sk (pgsql::statement_select);
+ {
+ if (composite_value_traits< ::brep::repository_id, id_pgsql >::init (
+ i.id_value,
+ id,
+ sk))
+ grew = true;
+ }
+
+ if (grew)
+ i.version++;
+ }
+
+ const char access::object_traits_impl< ::brep::build_repository, id_pgsql >::persist_statement[] =
+ "INSERT INTO \"build_repository\" "
+ "(\"tenant\", "
+ "\"canonical_name\", "
+ "\"location_url\", "
+ "\"location_type\", "
+ "\"certificate_fingerprint\") "
+ "VALUES "
+ "($1, $2, $3, $4, $5)";
+
+ const char access::object_traits_impl< ::brep::build_repository, id_pgsql >::find_statement[] =
+ "SELECT "
+ "\"build_repository\".\"tenant\", "
+ "\"build_repository\".\"canonical_name\", "
+ "\"build_repository\".\"location_url\", "
+ "\"build_repository\".\"location_type\", "
+ "\"build_repository\".\"certificate_fingerprint\" "
+ "FROM \"build_repository\" "
+ "WHERE \"build_repository\".\"tenant\"=$1 AND \"build_repository\".\"canonical_name\"=$2";
+
+ const char access::object_traits_impl< ::brep::build_repository, id_pgsql >::erase_statement[] =
+ "DELETE FROM \"build_repository\" "
+ "WHERE \"tenant\"=$1 AND \"canonical_name\"=$2";
+
+ const char access::object_traits_impl< ::brep::build_repository, id_pgsql >::query_statement[] =
+ "SELECT "
+ "\"build_repository\".\"tenant\", "
+ "\"build_repository\".\"canonical_name\", "
+ "\"build_repository\".\"location_url\", "
+ "\"build_repository\".\"location_type\", "
+ "\"build_repository\".\"certificate_fingerprint\" "
+ "FROM \"build_repository\"";
+
+ const char access::object_traits_impl< ::brep::build_repository, id_pgsql >::erase_query_statement[] =
+ "DELETE FROM \"build_repository\"";
+
+ const char access::object_traits_impl< ::brep::build_repository, id_pgsql >::table_name[] =
+ "\"build_repository\"";
+
+ void access::object_traits_impl< ::brep::build_repository, id_pgsql >::
+ persist (database& db, const object_type& obj)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+
+ using namespace pgsql;
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ callback (db,
+ obj,
+ callback_event::pre_persist);
+
+ image_type& im (sts.image ());
+ binding& imb (sts.insert_image_binding ());
+
+ if (init (im, obj, statement_insert))
+ im.version++;
+
+ if (im.version != sts.insert_image_version () ||
+ imb.version == 0)
+ {
+ bind (imb.bind, im, statement_insert);
+ sts.insert_image_version (im.version);
+ imb.version++;
+ }
+
+ insert_statement& st (sts.persist_statement ());
+ if (!st.execute ())
+ throw object_already_persistent ();
+
+ callback (db,
+ obj,
+ callback_event::post_persist);
+ }
+
+ void access::object_traits_impl< ::brep::build_repository, id_pgsql >::
+ erase (database& db, const id_type& id)
+ {
+ using namespace pgsql;
+
+ ODB_POTENTIALLY_UNUSED (db);
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ id_image_type& i (sts.id_image ());
+ init (i, id);
+
+ binding& idb (sts.id_image_binding ());
+ if (i.version != sts.id_image_version () || idb.version == 0)
+ {
+ bind (idb.bind, i);
+ sts.id_image_version (i.version);
+ idb.version++;
+ }
+
+ if (sts.erase_statement ().execute () != 1)
+ throw object_not_persistent ();
+
+ pointer_cache_traits::erase (db, id);
+ }
+
+ access::object_traits_impl< ::brep::build_repository, id_pgsql >::pointer_type
+ access::object_traits_impl< ::brep::build_repository, id_pgsql >::
+ find (database& db, const id_type& id)
+ {
+ using namespace pgsql;
+
+ {
+ pointer_type p (pointer_cache_traits::find (db, id));
+
+ if (!pointer_traits::null_ptr (p))
+ return p;
+ }
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ statements_type::auto_lock l (sts);
+
+ if (l.locked ())
+ {
+ if (!find_ (sts, &id))
+ return pointer_type ();
+ }
+
+ pointer_type p (
+ access::object_factory<object_type, pointer_type>::create ());
+ pointer_traits::guard pg (p);
+
+ pointer_cache_traits::insert_guard ig (
+ pointer_cache_traits::insert (db, id, p));
+
+ object_type& obj (pointer_traits::get_ref (p));
+
+ if (l.locked ())
+ {
+ select_statement& st (sts.find_statement ());
+ ODB_POTENTIALLY_UNUSED (st);
+
+ callback (db, obj, callback_event::pre_load);
+ init (obj, sts.image (), &db);
+ load_ (sts, obj, false);
+ sts.load_delayed (0);
+ l.unlock ();
+ callback (db, obj, callback_event::post_load);
+ pointer_cache_traits::load (ig.position ());
+ }
+ else
+ sts.delay_load (id, obj, ig.position ());
+
+ ig.release ();
+ pg.release ();
+ return p;
+ }
+
+ bool access::object_traits_impl< ::brep::build_repository, id_pgsql >::
+ find (database& db, const id_type& id, object_type& obj)
+ {
+ using namespace pgsql;
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ statements_type::auto_lock l (sts);
+ assert (l.locked ()) /* Must be a top-level call. */;
+
+ if (!find_ (sts, &id))
+ return false;
+
+ select_statement& st (sts.find_statement ());
+ ODB_POTENTIALLY_UNUSED (st);
+
+ reference_cache_traits::position_type pos (
+ reference_cache_traits::insert (db, id, obj));
+ reference_cache_traits::insert_guard ig (pos);
+
+ callback (db, obj, callback_event::pre_load);
+ init (obj, sts.image (), &db);
+ load_ (sts, obj, false);
+ sts.load_delayed (0);
+ l.unlock ();
+ callback (db, obj, callback_event::post_load);
+ reference_cache_traits::load (pos);
+ ig.release ();
+ return true;
+ }
+
+ bool access::object_traits_impl< ::brep::build_repository, id_pgsql >::
+ reload (database& db, object_type& obj)
+ {
+ using namespace pgsql;
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ statements_type::auto_lock l (sts);
+ assert (l.locked ()) /* Must be a top-level call. */;
+
+ const id_type& id (object_traits_impl::id (obj));
+ if (!find_ (sts, &id))
+ return false;
+
+ select_statement& st (sts.find_statement ());
+ ODB_POTENTIALLY_UNUSED (st);
+
+ callback (db, obj, callback_event::pre_load);
+ init (obj, sts.image (), &db);
+ load_ (sts, obj, true);
+ sts.load_delayed (0);
+ l.unlock ();
+ callback (db, obj, callback_event::post_load);
+ return true;
+ }
+
+ bool access::object_traits_impl< ::brep::build_repository, id_pgsql >::
+ find_ (statements_type& sts,
+ const id_type* id)
+ {
+ using namespace pgsql;
+
+ id_image_type& i (sts.id_image ());
+ init (i, *id);
+
+ binding& idb (sts.id_image_binding ());
+ if (i.version != sts.id_image_version () || idb.version == 0)
+ {
+ bind (idb.bind, i);
+ sts.id_image_version (i.version);
+ idb.version++;
+ }
+
+ image_type& im (sts.image ());
+ binding& imb (sts.select_image_binding ());
+
+ if (im.version != sts.select_image_version () ||
+ imb.version == 0)
+ {
+ bind (imb.bind, im, statement_select);
+ sts.select_image_version (im.version);
+ imb.version++;
+ }
+
+ select_statement& st (sts.find_statement ());
+
+ st.execute ();
+ auto_result ar (st);
+ select_statement::result r (st.fetch ());
+
+ if (r == select_statement::truncated)
+ {
+ if (grow (im, sts.select_image_truncated ()))
+ im.version++;
+
+ if (im.version != sts.select_image_version ())
+ {
+ bind (imb.bind, im, statement_select);
+ sts.select_image_version (im.version);
+ imb.version++;
+ st.refetch ();
+ }
+ }
+
+ return r != select_statement::no_data;
+ }
+
+ result< access::object_traits_impl< ::brep::build_repository, id_pgsql >::object_type >
+ access::object_traits_impl< ::brep::build_repository, id_pgsql >::
+ query (database&, const query_base_type& q)
+ {
+ using namespace pgsql;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.select_image_binding ());
+
+ if (im.version != sts.select_image_version () ||
+ imb.version == 0)
+ {
+ bind (imb.bind, im, statement_select);
+ sts.select_image_version (im.version);
+ imb.version++;
+ }
+
+ std::string text (query_statement);
+ if (!q.empty ())
+ {
+ text += " ";
+ text += q.clause ();
+ }
+
+ q.init_parameters ();
+ shared_ptr<select_statement> st (
+ new (shared) select_statement (
+ sts.connection (),
+ query_statement_name,
+ text,
+ false,
+ true,
+ q.parameter_types (),
+ q.parameter_count (),
+ q.parameters_binding (),
+ imb));
+
+ st->execute ();
+ st->deallocate ();
+
+ shared_ptr< odb::object_result_impl<object_type> > r (
+ new (shared) pgsql::object_result_impl<object_type> (
+ q, st, sts, 0));
+
+ return result<object_type> (r);
+ }
+
+ unsigned long long access::object_traits_impl< ::brep::build_repository, id_pgsql >::
+ erase_query (database&, const query_base_type& q)
+ {
+ using namespace pgsql;
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+
+ std::string text (erase_query_statement);
+ if (!q.empty ())
+ {
+ text += ' ';
+ text += q.clause ();
+ }
+
+ q.init_parameters ();
+ delete_statement st (
+ conn,
+ erase_query_statement_name,
+ text,
+ q.parameter_types (),
+ q.parameter_count (),
+ q.parameters_binding ());
+
+ return st.execute ();
+ }
+
+ odb::details::shared_ptr<prepared_query_impl>
+ access::object_traits_impl< ::brep::build_repository, id_pgsql >::
+ prepare_query (connection& c, const char* n, const query_base_type& q)
+ {
+ using namespace pgsql;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ pgsql::connection& conn (
+ static_cast<pgsql::connection&> (c));
+
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.select_image_binding ());
+
+ if (im.version != sts.select_image_version () ||
+ imb.version == 0)
+ {
+ bind (imb.bind, im, statement_select);
+ sts.select_image_version (im.version);
+ imb.version++;
+ }
+
+ std::string text (query_statement);
+ if (!q.empty ())
+ {
+ text += " ";
+ text += q.clause ();
+ }
+
+ shared_ptr<pgsql::prepared_query_impl> r (
+ new (shared) pgsql::prepared_query_impl (conn));
+ r->name = n;
+ r->execute = &execute_query;
+ r->query = q;
+ r->stmt.reset (
+ new (shared) select_statement (
+ sts.connection (),
+ n,
+ text,
+ false,
+ true,
+ r->query.parameter_types (),
+ r->query.parameter_count (),
+ r->query.parameters_binding (),
+ imb));
+
+ return r;
+ }
+
+ odb::details::shared_ptr<result_impl>
+ access::object_traits_impl< ::brep::build_repository, id_pgsql >::
+ execute_query (prepared_query_impl& q)
+ {
+ using namespace pgsql;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ pgsql::prepared_query_impl& pq (
+ static_cast<pgsql::prepared_query_impl&> (q));
+ shared_ptr<select_statement> st (
+ odb::details::inc_ref (
+ static_cast<select_statement*> (pq.stmt.get ())));
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+
+ // The connection used by the current transaction and the
+ // one used to prepare this statement must be the same.
+ //
+ assert (&conn == &st->connection ());
+
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.select_image_binding ());
+
+ if (im.version != sts.select_image_version () ||
+ imb.version == 0)
+ {
+ bind (imb.bind, im, statement_select);
+ sts.select_image_version (im.version);
+ imb.version++;
+ }
+
+ pq.query.init_parameters ();
+ st->execute ();
+
+ return shared_ptr<result_impl> (
+ new (shared) pgsql::object_result_impl<object_type> (
+ pq.query, st, sts, 0));
+ }
+
+ // build_test_dependency
+ //
+
+ bool access::composite_value_traits< ::brep::build_test_dependency, id_pgsql >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // name
+ //
+ if (t[0UL])
+ {
+ i.name_value.capacity (i.name_size);
+ grew = true;
+ }
+
+ // package
+ //
+ if (composite_value_traits< ::brep::package_id, id_pgsql >::grow (
+ i.package_value, t + 1UL))
+ grew = true;
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::brep::build_test_dependency, id_pgsql >::
+ bind (pgsql::bind* b,
+ image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (b);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ std::size_t n (0);
+ ODB_POTENTIALLY_UNUSED (n);
+
+ // name
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.name_value.data ();
+ b[n].capacity = i.name_value.capacity ();
+ b[n].size = &i.name_size;
+ b[n].is_null = &i.name_null;
+ n++;
+
+ // package
+ //
+ composite_value_traits< ::brep::package_id, id_pgsql >::bind (
+ b + n, i.package_value, sk);
+ n += 6UL;
+ }
+
+ bool access::composite_value_traits< ::brep::build_test_dependency, id_pgsql >::
+ init (image_type& i,
+ const value_type& o,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ bool grew (false);
+
+ // name
+ //
+ {
+ ::bpkg::package_name const& v =
+ o.name;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.name_value.capacity ());
+ pgsql::value_traits<
+ ::bpkg::package_name,
+ pgsql::id_string >::set_image (
+ i.name_value,
+ size,
+ is_null,
+ v);
+ i.name_null = is_null;
+ i.name_size = size;
+ grew = grew || (cap != i.name_value.capacity ());
+ }
+
+ // package
+ //
+ {
+ ::odb::lazy_shared_ptr< ::brep::build_package > const& v =
+ o.package;
+
+ typedef object_traits< ::brep::build_package > obj_traits;
+ typedef odb::pointer_traits< ::odb::lazy_shared_ptr< ::brep::build_package > > ptr_traits;
+
+ bool is_null (ptr_traits::null_ptr (v));
+ if (!is_null)
+ {
+ const obj_traits::id_type& ptr_id (
+ ptr_traits::object_id< ptr_traits::element_type > (v));
+
+ if (composite_value_traits< obj_traits::id_type, id_pgsql >::init (
+ i.package_value,
+ ptr_id,
+ sk))
+ grew = true;
+ }
+ else
+ composite_value_traits< obj_traits::id_type, id_pgsql >::set_null (i.package_value, sk);
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::brep::build_test_dependency, id_pgsql >::
+ init (value_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // name
+ //
+ {
+ ::bpkg::package_name& v =
+ o.name;
+
+ pgsql::value_traits<
+ ::bpkg::package_name,
+ pgsql::id_string >::set_value (
+ v,
+ i.name_value,
+ i.name_size,
+ i.name_null);
+ }
+
+ // package
+ //
+ {
+ ::odb::lazy_shared_ptr< ::brep::build_package >& v =
+ o.package;
+
+ typedef object_traits< ::brep::build_package > obj_traits;
+ typedef odb::pointer_traits< ::odb::lazy_shared_ptr< ::brep::build_package > > ptr_traits;
+
+ if (composite_value_traits< obj_traits::id_type, id_pgsql >::get_null (
+ i.package_value))
+ v = ptr_traits::pointer_type ();
+ else
+ {
+ obj_traits::id_type ptr_id;
+ composite_value_traits< obj_traits::id_type, id_pgsql >::init (
+ ptr_id,
+ i.package_value,
+ db);
+
+ v = ptr_traits::pointer_type (
+ *static_cast<pgsql::database*> (db), ptr_id);
+ }
+ }
+ }
+
+ // build_package
+ //
+
+ const char access::object_traits_impl< ::brep::build_package, id_pgsql >::
+ persist_statement_name[] = "persist_brep_build_package";
+
+ const char access::object_traits_impl< ::brep::build_package, id_pgsql >::
+ find_statement_name[] = "find_brep_build_package";
+
+ const char access::object_traits_impl< ::brep::build_package, id_pgsql >::
+ erase_statement_name[] = "erase_brep_build_package";
+
+ const char access::object_traits_impl< ::brep::build_package, id_pgsql >::
+ query_statement_name[] = "query_brep_build_package";
+
+ const char access::object_traits_impl< ::brep::build_package, id_pgsql >::
+ erase_query_statement_name[] = "erase_query_brep_build_package";
+
+ const unsigned int access::object_traits_impl< ::brep::build_package, id_pgsql >::
+ persist_statement_types[] =
+ {
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::bool_oid
+ };
+
+ const unsigned int access::object_traits_impl< ::brep::build_package, id_pgsql >::
+ find_statement_types[] =
+ {
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid
+ };
+
+ const char alias_traits< ::brep::build_repository,
+ id_pgsql,
+ access::object_traits_impl< ::brep::build_package, id_pgsql >::internal_repository_tag>::
+ table_name[] = "\"internal_repository\"";
+
+ struct access::object_traits_impl< ::brep::build_package, id_pgsql >::extra_statement_cache_type
+ {
+ pgsql::container_statements_impl< tests_traits > tests;
+ pgsql::container_statements_impl< builds_traits > builds;
+ pgsql::container_statements_impl< constraints_traits > constraints;
+
+ extra_statement_cache_type (
+ pgsql::connection& c,
+ image_type&,
+ id_image_type&,
+ pgsql::binding& id,
+ pgsql::binding&,
+ pgsql::native_binding& idn,
+ const unsigned int* idt)
+ : tests (c, id, idn, idt),
+ builds (c, id, idn, idt),
+ constraints (c, id, idn, idt)
+ {
+ }
+ };
+
+ // tests
+ //
+
+ const char access::object_traits_impl< ::brep::build_package, id_pgsql >::tests_traits::
+ select_name[] = "select_brep_build_package_tests";
+
+ const char access::object_traits_impl< ::brep::build_package, id_pgsql >::tests_traits::
+ insert_name[] = "insert_brep_build_package_tests";
+
+ const char access::object_traits_impl< ::brep::build_package, id_pgsql >::tests_traits::
+ delete_name[] = "delete_brep_build_package_tests";
+
+ const unsigned int access::object_traits_impl< ::brep::build_package, id_pgsql >::tests_traits::
+ insert_types[] =
+ {
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::int8_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid
+ };
+
+ const char access::object_traits_impl< ::brep::build_package, id_pgsql >::tests_traits::
+ select_statement[] =
+ "SELECT "
+ "\"build_package_tests\".\"index\", "
+ "\"build_package_tests\".\"test_name\"::TEXT, "
+ "\"build_package_tests\".\"test_package_tenant\", "
+ "\"build_package_tests\".\"test_package_name\"::TEXT, "
+ "\"build_package_tests\".\"test_package_version_epoch\", "
+ "\"build_package_tests\".\"test_package_version_canonical_upstream\", "
+ "\"build_package_tests\".\"test_package_version_canonical_release\", "
+ "\"build_package_tests\".\"test_package_version_revision\" "
+ "FROM \"build_package_tests\" "
+ "WHERE \"build_package_tests\".\"tenant\"=$1 AND \"build_package_tests\".\"name\"=$2::CITEXT AND \"build_package_tests\".\"version_epoch\"=$3 AND \"build_package_tests\".\"version_canonical_upstream\"=$4 AND \"build_package_tests\".\"version_canonical_release\"=$5 AND \"build_package_tests\".\"version_revision\"=$6 ORDER BY \"build_package_tests\".\"index\"";
+
+ const char access::object_traits_impl< ::brep::build_package, id_pgsql >::tests_traits::
+ insert_statement[] =
+ "INSERT INTO \"build_package_tests\" "
+ "(\"tenant\", "
+ "\"name\", "
+ "\"version_epoch\", "
+ "\"version_canonical_upstream\", "
+ "\"version_canonical_release\", "
+ "\"version_revision\", "
+ "\"index\", "
+ "\"test_name\", "
+ "\"test_package_tenant\", "
+ "\"test_package_name\", "
+ "\"test_package_version_epoch\", "
+ "\"test_package_version_canonical_upstream\", "
+ "\"test_package_version_canonical_release\", "
+ "\"test_package_version_revision\") "
+ "VALUES "
+ "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8::CITEXT, $9, $10::CITEXT, $11, $12, $13, $14)";
+
+ const char access::object_traits_impl< ::brep::build_package, id_pgsql >::tests_traits::
+ delete_statement[] =
+ "DELETE FROM \"build_package_tests\" "
+ "WHERE \"tenant\"=$1 AND \"name\"=$2::CITEXT AND \"version_epoch\"=$3 AND \"version_canonical_upstream\"=$4 AND \"version_canonical_release\"=$5 AND \"version_revision\"=$6";
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::tests_traits::
+ bind (pgsql::bind* b,
+ const pgsql::bind* id,
+ std::size_t id_size,
+ data_image_type& d)
+ {
+ using namespace pgsql;
+
+ statement_kind sk (statement_select);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ size_t n (0);
+
+ // object_id
+ //
+ if (id != 0)
+ std::memcpy (&b[n], id, id_size * sizeof (id[0]));
+ n += id_size;
+
+ // index
+ //
+ b[n].type = pgsql::bind::bigint;
+ b[n].buffer = &d.index_value;
+ b[n].is_null = &d.index_null;
+ n++;
+
+ // value
+ //
+ composite_value_traits< value_type, id_pgsql >::bind (
+ b + n, d.value_value, sk);
+ }
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::tests_traits::
+ grow (data_image_type& i,
+ bool* t)
+ {
+ bool grew (false);
+
+ // index
+ //
+ t[0UL] = 0;
+
+ // value
+ //
+ if (composite_value_traits< value_type, id_pgsql >::grow (
+ i.value_value, t + 1UL))
+ grew = true;
+
+ if (grew)
+ i.version++;
+ }
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::tests_traits::
+ init (data_image_type& i,
+ index_type* j,
+ const value_type& v)
+ {
+ using namespace pgsql;
+
+ statement_kind sk (statement_insert);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ bool grew (false);
+
+ // index
+ //
+ if (j != 0)
+ {
+ bool is_null (false);
+ pgsql::value_traits<
+ index_type,
+ pgsql::id_bigint >::set_image (
+ i.index_value, is_null, *j);
+ i.index_null = is_null;
+ }
+
+ // value
+ //
+ {
+ if (composite_value_traits< value_type, id_pgsql >::init (
+ i.value_value,
+ v,
+ sk))
+ grew = true;
+ }
+
+ if (grew)
+ i.version++;
+ }
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::tests_traits::
+ init (index_type& j,
+ value_type& v,
+ const data_image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // index
+ //
+ {
+ pgsql::value_traits<
+ index_type,
+ pgsql::id_bigint >::set_value (
+ j,
+ i.index_value,
+ i.index_null);
+ }
+
+ // value
+ //
+ {
+ composite_value_traits< value_type, id_pgsql >::init (
+ v,
+ i.value_value,
+ db);
+ }
+ }
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::tests_traits::
+ insert (index_type i, const value_type& v, void* d)
+ {
+ using namespace pgsql;
+
+ statements_type& sts (*static_cast< statements_type* > (d));
+ data_image_type& di (sts.data_image ());
+
+ init (di, &i, v);
+
+ if (sts.data_binding_test_version ())
+ {
+ const binding& id (sts.id_binding ());
+ bind (sts.data_bind (), id.bind, id.count, di);
+ sts.data_binding_update_version ();
+ }
+
+ if (!sts.insert_statement ().execute ())
+ throw object_already_persistent ();
+ }
+
+ bool access::object_traits_impl< ::brep::build_package, id_pgsql >::tests_traits::
+ select (index_type& i, value_type& v, void* d)
+ {
+ using namespace pgsql;
+ using pgsql::select_statement;
+
+ statements_type& sts (*static_cast< statements_type* > (d));
+ data_image_type& di (sts.data_image ());
+
+ init (i, v, di, &sts.connection ().database ());
+
+ select_statement& st (sts.select_statement ());
+ select_statement::result r (st.fetch ());
+
+ if (r == select_statement::truncated)
+ {
+ grow (di, sts.select_image_truncated ());
+
+ if (sts.data_binding_test_version ())
+ {
+ bind (sts.data_bind (), 0, sts.id_binding ().count, di);
+ sts.data_binding_update_version ();
+ st.refetch ();
+ }
+ }
+
+ return r != select_statement::no_data;
+ }
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::tests_traits::
+ delete_ (void* d)
+ {
+ using namespace pgsql;
+
+ statements_type& sts (*static_cast< statements_type* > (d));
+ sts.delete_statement ().execute ();
+ }
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::tests_traits::
+ persist (const container_type& c,
+ statements_type& sts)
+ {
+ using namespace pgsql;
+
+ functions_type& fs (sts.functions ());
+ fs.ordered_ = true;
+ container_traits_type::persist (c, fs);
+ }
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::tests_traits::
+ load (container_type& c,
+ statements_type& sts)
+ {
+ using namespace pgsql;
+ using pgsql::select_statement;
+
+ const binding& id (sts.id_binding ());
+
+ if (sts.data_binding_test_version ())
+ {
+ bind (sts.data_bind (), id.bind, id.count, sts.data_image ());
+ sts.data_binding_update_version ();
+ }
+
+ select_statement& st (sts.select_statement ());
+ st.execute ();
+ auto_result ar (st);
+ select_statement::result r (st.fetch ());
+
+ if (r == select_statement::truncated)
+ {
+ data_image_type& di (sts.data_image ());
+ grow (di, sts.select_image_truncated ());
+
+ if (sts.data_binding_test_version ())
+ {
+ bind (sts.data_bind (), 0, id.count, di);
+ sts.data_binding_update_version ();
+ st.refetch ();
+ }
+ }
+
+ bool more (r != select_statement::no_data);
+
+ functions_type& fs (sts.functions ());
+ fs.ordered_ = true;
+ container_traits_type::load (c, more, fs);
+ }
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::tests_traits::
+ erase (statements_type& sts)
+ {
+ using namespace pgsql;
+
+ functions_type& fs (sts.functions ());
+ fs.ordered_ = true;
+ container_traits_type::erase (fs);
+ }
+
+ // builds
+ //
+
+ const char access::object_traits_impl< ::brep::build_package, id_pgsql >::builds_traits::
+ select_name[] = "select_brep_build_package_builds";
+
+ const char access::object_traits_impl< ::brep::build_package, id_pgsql >::builds_traits::
+ insert_name[] = "insert_brep_build_package_builds";
+
+ const char access::object_traits_impl< ::brep::build_package, id_pgsql >::builds_traits::
+ delete_name[] = "delete_brep_build_package_builds";
+
+ const unsigned int access::object_traits_impl< ::brep::build_package, id_pgsql >::builds_traits::
+ insert_types[] =
+ {
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::int8_oid,
+ pgsql::text_oid,
+ pgsql::text_oid
+ };
+
+ const char access::object_traits_impl< ::brep::build_package, id_pgsql >::builds_traits::
+ select_statement[] =
+ "SELECT "
+ "\"build_package_builds\".\"index\", "
+ "\"build_package_builds\".\"expression\", "
+ "\"build_package_builds\".\"comment\" "
+ "FROM \"build_package_builds\" "
+ "WHERE \"build_package_builds\".\"tenant\"=$1 AND \"build_package_builds\".\"name\"=$2::CITEXT AND \"build_package_builds\".\"version_epoch\"=$3 AND \"build_package_builds\".\"version_canonical_upstream\"=$4 AND \"build_package_builds\".\"version_canonical_release\"=$5 AND \"build_package_builds\".\"version_revision\"=$6 ORDER BY \"build_package_builds\".\"index\"";
+
+ const char access::object_traits_impl< ::brep::build_package, id_pgsql >::builds_traits::
+ insert_statement[] =
+ "INSERT INTO \"build_package_builds\" "
+ "(\"tenant\", "
+ "\"name\", "
+ "\"version_epoch\", "
+ "\"version_canonical_upstream\", "
+ "\"version_canonical_release\", "
+ "\"version_revision\", "
+ "\"index\", "
+ "\"expression\", "
+ "\"comment\") "
+ "VALUES "
+ "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8, $9)";
+
+ const char access::object_traits_impl< ::brep::build_package, id_pgsql >::builds_traits::
+ delete_statement[] =
+ "DELETE FROM \"build_package_builds\" "
+ "WHERE \"tenant\"=$1 AND \"name\"=$2::CITEXT AND \"version_epoch\"=$3 AND \"version_canonical_upstream\"=$4 AND \"version_canonical_release\"=$5 AND \"version_revision\"=$6";
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::builds_traits::
+ bind (pgsql::bind* b,
+ const pgsql::bind* id,
+ std::size_t id_size,
+ data_image_type& d)
+ {
+ using namespace pgsql;
+
+ statement_kind sk (statement_select);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ size_t n (0);
+
+ // object_id
+ //
+ if (id != 0)
+ std::memcpy (&b[n], id, id_size * sizeof (id[0]));
+ n += id_size;
+
+ // index
+ //
+ b[n].type = pgsql::bind::bigint;
+ b[n].buffer = &d.index_value;
+ b[n].is_null = &d.index_null;
+ n++;
+
+ // value
+ //
+ composite_value_traits< value_type, id_pgsql >::bind (
+ b + n, d.value_value, sk);
+ }
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::builds_traits::
+ grow (data_image_type& i,
+ bool* t)
+ {
+ bool grew (false);
+
+ // index
+ //
+ t[0UL] = 0;
+
+ // value
+ //
+ if (composite_value_traits< value_type, id_pgsql >::grow (
+ i.value_value, t + 1UL))
+ grew = true;
+
+ if (grew)
+ i.version++;
+ }
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::builds_traits::
+ init (data_image_type& i,
+ index_type* j,
+ const value_type& v)
+ {
+ using namespace pgsql;
+
+ statement_kind sk (statement_insert);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ bool grew (false);
+
+ // index
+ //
+ if (j != 0)
+ {
+ bool is_null (false);
+ pgsql::value_traits<
+ index_type,
+ pgsql::id_bigint >::set_image (
+ i.index_value, is_null, *j);
+ i.index_null = is_null;
+ }
+
+ // value
+ //
+ {
+ if (composite_value_traits< value_type, id_pgsql >::init (
+ i.value_value,
+ v,
+ sk))
+ grew = true;
+ }
+
+ if (grew)
+ i.version++;
+ }
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::builds_traits::
+ init (index_type& j,
+ value_type& v,
+ const data_image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // index
+ //
+ {
+ pgsql::value_traits<
+ index_type,
+ pgsql::id_bigint >::set_value (
+ j,
+ i.index_value,
+ i.index_null);
+ }
+
+ // value
+ //
+ {
+ composite_value_traits< value_type, id_pgsql >::init (
+ v,
+ i.value_value,
+ db);
+ }
+ }
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::builds_traits::
+ insert (index_type i, const value_type& v, void* d)
+ {
+ using namespace pgsql;
+
+ statements_type& sts (*static_cast< statements_type* > (d));
+ data_image_type& di (sts.data_image ());
+
+ init (di, &i, v);
+
+ if (sts.data_binding_test_version ())
+ {
+ const binding& id (sts.id_binding ());
+ bind (sts.data_bind (), id.bind, id.count, di);
+ sts.data_binding_update_version ();
+ }
+
+ if (!sts.insert_statement ().execute ())
+ throw object_already_persistent ();
+ }
+
+ bool access::object_traits_impl< ::brep::build_package, id_pgsql >::builds_traits::
+ select (index_type& i, value_type& v, void* d)
+ {
+ using namespace pgsql;
+ using pgsql::select_statement;
+
+ statements_type& sts (*static_cast< statements_type* > (d));
+ data_image_type& di (sts.data_image ());
+
+ init (i, v, di, &sts.connection ().database ());
+
+ select_statement& st (sts.select_statement ());
+ select_statement::result r (st.fetch ());
+
+ if (r == select_statement::truncated)
+ {
+ grow (di, sts.select_image_truncated ());
+
+ if (sts.data_binding_test_version ())
+ {
+ bind (sts.data_bind (), 0, sts.id_binding ().count, di);
+ sts.data_binding_update_version ();
+ st.refetch ();
+ }
+ }
+
+ return r != select_statement::no_data;
+ }
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::builds_traits::
+ delete_ (void* d)
+ {
+ using namespace pgsql;
+
+ statements_type& sts (*static_cast< statements_type* > (d));
+ sts.delete_statement ().execute ();
+ }
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::builds_traits::
+ persist (const container_type& c,
+ statements_type& sts)
+ {
+ using namespace pgsql;
+
+ functions_type& fs (sts.functions ());
+ fs.ordered_ = true;
+ container_traits_type::persist (c, fs);
+ }
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::builds_traits::
+ load (container_type& c,
+ statements_type& sts)
+ {
+ using namespace pgsql;
+ using pgsql::select_statement;
+
+ const binding& id (sts.id_binding ());
+
+ if (sts.data_binding_test_version ())
+ {
+ bind (sts.data_bind (), id.bind, id.count, sts.data_image ());
+ sts.data_binding_update_version ();
+ }
+
+ select_statement& st (sts.select_statement ());
+ st.execute ();
+ auto_result ar (st);
+ select_statement::result r (st.fetch ());
+
+ if (r == select_statement::truncated)
+ {
+ data_image_type& di (sts.data_image ());
+ grow (di, sts.select_image_truncated ());
+
+ if (sts.data_binding_test_version ())
+ {
+ bind (sts.data_bind (), 0, id.count, di);
+ sts.data_binding_update_version ();
+ st.refetch ();
+ }
+ }
+
+ bool more (r != select_statement::no_data);
+
+ functions_type& fs (sts.functions ());
+ fs.ordered_ = true;
+ container_traits_type::load (c, more, fs);
+ }
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::builds_traits::
+ erase (statements_type& sts)
+ {
+ using namespace pgsql;
+
+ functions_type& fs (sts.functions ());
+ fs.ordered_ = true;
+ container_traits_type::erase (fs);
+ }
+
+ // constraints
+ //
+
+ const char access::object_traits_impl< ::brep::build_package, id_pgsql >::constraints_traits::
+ select_name[] = "select_brep_build_package_constraints";
+
+ const char access::object_traits_impl< ::brep::build_package, id_pgsql >::constraints_traits::
+ insert_name[] = "insert_brep_build_package_constraints";
+
+ const char access::object_traits_impl< ::brep::build_package, id_pgsql >::constraints_traits::
+ delete_name[] = "delete_brep_build_package_constraints";
+
+ const unsigned int access::object_traits_impl< ::brep::build_package, id_pgsql >::constraints_traits::
+ insert_types[] =
+ {
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::int4_oid,
+ pgsql::int8_oid,
+ pgsql::bool_oid,
+ pgsql::text_oid,
+ pgsql::text_oid,
+ pgsql::text_oid
+ };
+
+ const char access::object_traits_impl< ::brep::build_package, id_pgsql >::constraints_traits::
+ select_statement[] =
+ "SELECT "
+ "\"build_package_constraints\".\"index\", "
+ "\"build_package_constraints\".\"exclusion\", "
+ "\"build_package_constraints\".\"config\", "
+ "\"build_package_constraints\".\"target\", "
+ "\"build_package_constraints\".\"comment\" "
+ "FROM \"build_package_constraints\" "
+ "WHERE \"build_package_constraints\".\"tenant\"=$1 AND \"build_package_constraints\".\"name\"=$2::CITEXT AND \"build_package_constraints\".\"version_epoch\"=$3 AND \"build_package_constraints\".\"version_canonical_upstream\"=$4 AND \"build_package_constraints\".\"version_canonical_release\"=$5 AND \"build_package_constraints\".\"version_revision\"=$6 ORDER BY \"build_package_constraints\".\"index\"";
+
+ const char access::object_traits_impl< ::brep::build_package, id_pgsql >::constraints_traits::
+ insert_statement[] =
+ "INSERT INTO \"build_package_constraints\" "
+ "(\"tenant\", "
+ "\"name\", "
+ "\"version_epoch\", "
+ "\"version_canonical_upstream\", "
+ "\"version_canonical_release\", "
+ "\"version_revision\", "
+ "\"index\", "
+ "\"exclusion\", "
+ "\"config\", "
+ "\"target\", "
+ "\"comment\") "
+ "VALUES "
+ "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8, $9, $10, $11)";
+
+ const char access::object_traits_impl< ::brep::build_package, id_pgsql >::constraints_traits::
+ delete_statement[] =
+ "DELETE FROM \"build_package_constraints\" "
+ "WHERE \"tenant\"=$1 AND \"name\"=$2::CITEXT AND \"version_epoch\"=$3 AND \"version_canonical_upstream\"=$4 AND \"version_canonical_release\"=$5 AND \"version_revision\"=$6";
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::constraints_traits::
+ bind (pgsql::bind* b,
+ const pgsql::bind* id,
+ std::size_t id_size,
+ data_image_type& d)
+ {
+ using namespace pgsql;
+
+ statement_kind sk (statement_select);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ size_t n (0);
+
+ // object_id
+ //
+ if (id != 0)
+ std::memcpy (&b[n], id, id_size * sizeof (id[0]));
+ n += id_size;
+
+ // index
+ //
+ b[n].type = pgsql::bind::bigint;
+ b[n].buffer = &d.index_value;
+ b[n].is_null = &d.index_null;
+ n++;
+
+ // value
+ //
+ composite_value_traits< value_type, id_pgsql >::bind (
+ b + n, d.value_value, sk);
+ }
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::constraints_traits::
+ grow (data_image_type& i,
+ bool* t)
+ {
+ bool grew (false);
+
+ // index
+ //
+ t[0UL] = 0;
+
+ // value
+ //
+ if (composite_value_traits< value_type, id_pgsql >::grow (
+ i.value_value, t + 1UL))
+ grew = true;
+
+ if (grew)
+ i.version++;
+ }
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::constraints_traits::
+ init (data_image_type& i,
+ index_type* j,
+ const value_type& v)
+ {
+ using namespace pgsql;
+
+ statement_kind sk (statement_insert);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ bool grew (false);
+
+ // index
+ //
+ if (j != 0)
+ {
+ bool is_null (false);
+ pgsql::value_traits<
+ index_type,
+ pgsql::id_bigint >::set_image (
+ i.index_value, is_null, *j);
+ i.index_null = is_null;
+ }
+
+ // value
+ //
+ {
+ if (composite_value_traits< value_type, id_pgsql >::init (
+ i.value_value,
+ v,
+ sk))
+ grew = true;
+ }
+
+ if (grew)
+ i.version++;
+ }
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::constraints_traits::
+ init (index_type& j,
+ value_type& v,
+ const data_image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // index
+ //
+ {
+ pgsql::value_traits<
+ index_type,
+ pgsql::id_bigint >::set_value (
+ j,
+ i.index_value,
+ i.index_null);
+ }
+
+ // value
+ //
+ {
+ composite_value_traits< value_type, id_pgsql >::init (
+ v,
+ i.value_value,
+ db);
+ }
+ }
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::constraints_traits::
+ insert (index_type i, const value_type& v, void* d)
+ {
+ using namespace pgsql;
+
+ statements_type& sts (*static_cast< statements_type* > (d));
+ data_image_type& di (sts.data_image ());
+
+ init (di, &i, v);
+
+ if (sts.data_binding_test_version ())
+ {
+ const binding& id (sts.id_binding ());
+ bind (sts.data_bind (), id.bind, id.count, di);
+ sts.data_binding_update_version ();
+ }
+
+ if (!sts.insert_statement ().execute ())
+ throw object_already_persistent ();
+ }
+
+ bool access::object_traits_impl< ::brep::build_package, id_pgsql >::constraints_traits::
+ select (index_type& i, value_type& v, void* d)
+ {
+ using namespace pgsql;
+ using pgsql::select_statement;
+
+ statements_type& sts (*static_cast< statements_type* > (d));
+ data_image_type& di (sts.data_image ());
+
+ init (i, v, di, &sts.connection ().database ());
+
+ select_statement& st (sts.select_statement ());
+ select_statement::result r (st.fetch ());
+
+ if (r == select_statement::truncated)
+ {
+ grow (di, sts.select_image_truncated ());
+
+ if (sts.data_binding_test_version ())
+ {
+ bind (sts.data_bind (), 0, sts.id_binding ().count, di);
+ sts.data_binding_update_version ();
+ st.refetch ();
+ }
+ }
+
+ return r != select_statement::no_data;
+ }
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::constraints_traits::
+ delete_ (void* d)
+ {
+ using namespace pgsql;
+
+ statements_type& sts (*static_cast< statements_type* > (d));
+ sts.delete_statement ().execute ();
+ }
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::constraints_traits::
+ persist (const container_type& c,
+ statements_type& sts)
+ {
+ using namespace pgsql;
+
+ functions_type& fs (sts.functions ());
+ fs.ordered_ = true;
+ container_traits_type::persist (c, fs);
+ }
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::constraints_traits::
+ load (container_type& c,
+ statements_type& sts)
+ {
+ using namespace pgsql;
+ using pgsql::select_statement;
+
+ const binding& id (sts.id_binding ());
+
+ if (sts.data_binding_test_version ())
+ {
+ bind (sts.data_bind (), id.bind, id.count, sts.data_image ());
+ sts.data_binding_update_version ();
+ }
+
+ select_statement& st (sts.select_statement ());
+ st.execute ();
+ auto_result ar (st);
+ select_statement::result r (st.fetch ());
+
+ if (r == select_statement::truncated)
+ {
+ data_image_type& di (sts.data_image ());
+ grow (di, sts.select_image_truncated ());
+
+ if (sts.data_binding_test_version ())
+ {
+ bind (sts.data_bind (), 0, id.count, di);
+ sts.data_binding_update_version ();
+ st.refetch ();
+ }
+ }
+
+ bool more (r != select_statement::no_data);
+
+ functions_type& fs (sts.functions ());
+ fs.ordered_ = true;
+ container_traits_type::load (c, more, fs);
+ }
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::constraints_traits::
+ erase (statements_type& sts)
+ {
+ using namespace pgsql;
+
+ functions_type& fs (sts.functions ());
+ fs.ordered_ = true;
+ container_traits_type::erase (fs);
+ }
+
+ access::object_traits_impl< ::brep::build_package, id_pgsql >::id_type
+ access::object_traits_impl< ::brep::build_package, id_pgsql >::
+ id (const image_type& i)
+ {
+ pgsql::database* db (0);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ id_type id;
+ {
+ composite_value_traits< ::brep::package_id, id_pgsql >::init (
+ id,
+ i.id_value,
+ db);
+ }
+
+ return id;
+ }
+
+ bool access::object_traits_impl< ::brep::build_package, id_pgsql >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // id
+ //
+ if (composite_value_traits< ::brep::package_id, id_pgsql >::grow (
+ i.id_value, t + 0UL))
+ grew = true;
+
+ // version
+ //
+ if (composite_value_traits< ::brep::upstream_version, id_pgsql >::grow (
+ i.version_value, t + 6UL))
+ grew = true;
+
+ // internal_repository
+ //
+ if (composite_value_traits< ::brep::repository_id, id_pgsql >::grow (
+ i.internal_repository_value, t + 8UL))
+ grew = true;
+
+ // buildable
+ //
+ t[10UL] = 0;
+
+ return grew;
+ }
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::
+ bind (pgsql::bind* b,
+ image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ assert (sk != statement_update);
+
+ std::size_t n (0);
+
+ // id
+ //
+ composite_value_traits< ::brep::package_id, id_pgsql >::bind (
+ b + n, i.id_value, sk);
+ n += 6UL;
+
+ // version
+ //
+ composite_value_traits< ::brep::upstream_version, id_pgsql >::bind (
+ b + n, i.version_value, sk);
+ n += 2UL;
+
+ // internal_repository
+ //
+ composite_value_traits< ::brep::repository_id, id_pgsql >::bind (
+ b + n, i.internal_repository_value, sk);
+ n += 2UL;
+
+ // buildable
+ //
+ b[n].type = pgsql::bind::boolean_;
+ b[n].buffer = &i.buildable_value;
+ b[n].is_null = &i.buildable_null;
+ n++;
+ }
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::
+ bind (pgsql::bind* b, id_image_type& i)
+ {
+ std::size_t n (0);
+ pgsql::statement_kind sk (pgsql::statement_select);
+ composite_value_traits< ::brep::package_id, id_pgsql >::bind (
+ b + n, i.id_value, sk);
+ }
+
+ bool access::object_traits_impl< ::brep::build_package, id_pgsql >::
+ init (image_type& i,
+ const object_type& o,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ assert (sk != statement_update);
+
+ bool grew (false);
+
+ // id
+ //
+ {
+ ::brep::package_id const& v =
+ o.id;
+
+ if (composite_value_traits< ::brep::package_id, id_pgsql >::init (
+ i.id_value,
+ v,
+ sk))
+ grew = true;
+ }
+
+ // version
+ //
+ {
+ ::brep::upstream_version const& v =
+ o.version;
+
+ if (composite_value_traits< ::brep::upstream_version, id_pgsql >::init (
+ i.version_value,
+ v,
+ sk))
+ grew = true;
+ }
+
+ // internal_repository
+ //
+ {
+ ::odb::lazy_shared_ptr< ::brep::build_repository > const& v =
+ o.internal_repository;
+
+ typedef object_traits< ::brep::build_repository > obj_traits;
+ typedef odb::pointer_traits< ::odb::lazy_shared_ptr< ::brep::build_repository > > ptr_traits;
+
+ bool is_null (ptr_traits::null_ptr (v));
+ if (!is_null)
+ {
+ const obj_traits::id_type& ptr_id (
+ ptr_traits::object_id< ptr_traits::element_type > (v));
+
+ if (composite_value_traits< obj_traits::id_type, id_pgsql >::init (
+ i.internal_repository_value,
+ ptr_id,
+ sk))
+ grew = true;
+ }
+ else
+ composite_value_traits< obj_traits::id_type, id_pgsql >::set_null (i.internal_repository_value, sk);
+ }
+
+ // buildable
+ //
+ {
+ bool const& v =
+ o.buildable;
+
+ bool is_null (false);
+ pgsql::value_traits<
+ bool,
+ pgsql::id_boolean >::set_image (
+ i.buildable_value, is_null, v);
+ i.buildable_null = is_null;
+ }
+
+ return grew;
+ }
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::
+ init (object_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // id
+ //
+ {
+ ::brep::package_id& v =
+ o.id;
+
+ composite_value_traits< ::brep::package_id, id_pgsql >::init (
+ v,
+ i.id_value,
+ db);
+ }
+
+ // version
+ //
+ {
+ // From build-package.hxx:117:32
+ ::brep::upstream_version v;
+
+ composite_value_traits< ::brep::upstream_version, id_pgsql >::init (
+ v,
+ i.version_value,
+ db);
+
+ // From build-package.hxx:117:32
+ o.version.init (o.id.version, (v));
+ }
+
+ // internal_repository
+ //
+ {
+ ::odb::lazy_shared_ptr< ::brep::build_repository >& v =
+ o.internal_repository;
+
+ typedef object_traits< ::brep::build_repository > obj_traits;
+ typedef odb::pointer_traits< ::odb::lazy_shared_ptr< ::brep::build_repository > > ptr_traits;
+
+ if (composite_value_traits< obj_traits::id_type, id_pgsql >::get_null (
+ i.internal_repository_value))
+ v = ptr_traits::pointer_type ();
+ else
+ {
+ obj_traits::id_type ptr_id;
+ composite_value_traits< obj_traits::id_type, id_pgsql >::init (
+ ptr_id,
+ i.internal_repository_value,
+ db);
+
+ v = ptr_traits::pointer_type (
+ *static_cast<pgsql::database*> (db), ptr_id);
+ }
+ }
+
+ // buildable
+ //
+ {
+ bool& v =
+ o.buildable;
+
+ pgsql::value_traits<
+ bool,
+ pgsql::id_boolean >::set_value (
+ v,
+ i.buildable_value,
+ i.buildable_null);
+ }
+ }
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::
+ init (id_image_type& i, const id_type& id)
+ {
+ bool grew (false);
+ pgsql::statement_kind sk (pgsql::statement_select);
+ {
+ if (composite_value_traits< ::brep::package_id, id_pgsql >::init (
+ i.id_value,
+ id,
+ sk))
+ grew = true;
+ }
+
+ if (grew)
+ i.version++;
+ }
+
+ const char access::object_traits_impl< ::brep::build_package, id_pgsql >::persist_statement[] =
+ "INSERT INTO \"build_package\" "
+ "(\"tenant\", "
+ "\"name\", "
+ "\"version_epoch\", "
+ "\"version_canonical_upstream\", "
+ "\"version_canonical_release\", "
+ "\"version_revision\", "
+ "\"version_upstream\", "
+ "\"version_release\", "
+ "\"internal_repository_tenant\", "
+ "\"internal_repository_canonical_name\", "
+ "\"buildable\") "
+ "VALUES "
+ "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8, $9, $10, $11)";
+
+ const char access::object_traits_impl< ::brep::build_package, id_pgsql >::find_statement[] =
+ "SELECT "
+ "\"build_package\".\"tenant\", "
+ "\"build_package\".\"name\"::TEXT, "
+ "\"build_package\".\"version_epoch\", "
+ "\"build_package\".\"version_canonical_upstream\", "
+ "\"build_package\".\"version_canonical_release\", "
+ "\"build_package\".\"version_revision\", "
+ "\"build_package\".\"version_upstream\", "
+ "\"build_package\".\"version_release\", "
+ "\"build_package\".\"internal_repository_tenant\", "
+ "\"build_package\".\"internal_repository_canonical_name\", "
+ "\"build_package\".\"buildable\" "
+ "FROM \"build_package\" "
+ "WHERE \"build_package\".\"tenant\"=$1 AND \"build_package\".\"name\"=$2::CITEXT AND \"build_package\".\"version_epoch\"=$3 AND \"build_package\".\"version_canonical_upstream\"=$4 AND \"build_package\".\"version_canonical_release\"=$5 AND \"build_package\".\"version_revision\"=$6";
+
+ const char access::object_traits_impl< ::brep::build_package, id_pgsql >::erase_statement[] =
+ "DELETE FROM \"build_package\" "
+ "WHERE \"tenant\"=$1 AND \"name\"=$2::CITEXT AND \"version_epoch\"=$3 AND \"version_canonical_upstream\"=$4 AND \"version_canonical_release\"=$5 AND \"version_revision\"=$6";
+
+ const char access::object_traits_impl< ::brep::build_package, id_pgsql >::query_statement[] =
+ "SELECT\n"
+ "\"build_package\".\"tenant\",\n"
+ "\"build_package\".\"name\"::TEXT,\n"
+ "\"build_package\".\"version_epoch\",\n"
+ "\"build_package\".\"version_canonical_upstream\",\n"
+ "\"build_package\".\"version_canonical_release\",\n"
+ "\"build_package\".\"version_revision\",\n"
+ "\"build_package\".\"version_upstream\",\n"
+ "\"build_package\".\"version_release\",\n"
+ "\"build_package\".\"internal_repository_tenant\",\n"
+ "\"build_package\".\"internal_repository_canonical_name\",\n"
+ "\"build_package\".\"buildable\"\n"
+ "FROM \"build_package\"\n"
+ "LEFT JOIN \"build_repository\" AS \"internal_repository\" ON \"internal_repository\".\"tenant\"=\"build_package\".\"internal_repository_tenant\" AND \"internal_repository\".\"canonical_name\"=\"build_package\".\"internal_repository_canonical_name\"";
+
+ const char access::object_traits_impl< ::brep::build_package, id_pgsql >::erase_query_statement[] =
+ "DELETE FROM \"build_package\"";
+
+ const char access::object_traits_impl< ::brep::build_package, id_pgsql >::table_name[] =
+ "\"build_package\"";
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::
+ persist (database& db, const object_type& obj)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+
+ using namespace pgsql;
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ callback (db,
+ obj,
+ callback_event::pre_persist);
+
+ image_type& im (sts.image ());
+ binding& imb (sts.insert_image_binding ());
+
+ if (init (im, obj, statement_insert))
+ im.version++;
+
+ if (im.version != sts.insert_image_version () ||
+ imb.version == 0)
+ {
+ bind (imb.bind, im, statement_insert);
+ sts.insert_image_version (im.version);
+ imb.version++;
+ }
+
+ insert_statement& st (sts.persist_statement ());
+ if (!st.execute ())
+ throw object_already_persistent ();
+
+ id_image_type& i (sts.id_image ());
+ init (i, id (obj));
+
+ binding& idb (sts.id_image_binding ());
+ if (i.version != sts.id_image_version () || idb.version == 0)
+ {
+ bind (idb.bind, i);
+ sts.id_image_version (i.version);
+ idb.version++;
+ }
+
+ extra_statement_cache_type& esc (sts.extra_statement_cache ());
+
+ // tests
+ //
+ {
+ ::butl::small_vector< ::brep::build_test_dependency, 1 > const& v =
+ obj.tests;
+
+ tests_traits::persist (
+ v,
+ esc.tests);
+ }
+
+ // builds
+ //
+ {
+ ::brep::build_class_exprs const& v =
+ obj.builds;
+
+ builds_traits::persist (
+ v,
+ esc.builds);
+ }
+
+ // constraints
+ //
+ {
+ ::brep::build_constraints const& v =
+ obj.constraints;
+
+ constraints_traits::persist (
+ v,
+ esc.constraints);
+ }
+
+ callback (db,
+ obj,
+ callback_event::post_persist);
+ }
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::
+ erase (database& db, const id_type& id)
+ {
+ using namespace pgsql;
+
+ ODB_POTENTIALLY_UNUSED (db);
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ id_image_type& i (sts.id_image ());
+ init (i, id);
+
+ binding& idb (sts.id_image_binding ());
+ if (i.version != sts.id_image_version () || idb.version == 0)
+ {
+ bind (idb.bind, i);
+ sts.id_image_version (i.version);
+ idb.version++;
+ }
+
+ extra_statement_cache_type& esc (sts.extra_statement_cache ());
+
+ // tests
+ //
+ {
+ tests_traits::erase (
+ esc.tests);
+ }
+
+ // builds
+ //
+ {
+ builds_traits::erase (
+ esc.builds);
+ }
+
+ // constraints
+ //
+ {
+ constraints_traits::erase (
+ esc.constraints);
+ }
+
+ if (sts.erase_statement ().execute () != 1)
+ throw object_not_persistent ();
+
+ pointer_cache_traits::erase (db, id);
+ }
+
+ access::object_traits_impl< ::brep::build_package, id_pgsql >::pointer_type
+ access::object_traits_impl< ::brep::build_package, id_pgsql >::
+ find (database& db, const id_type& id)
+ {
+ using namespace pgsql;
+
+ {
+ pointer_type p (pointer_cache_traits::find (db, id));
+
+ if (!pointer_traits::null_ptr (p))
+ return p;
+ }
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ statements_type::auto_lock l (sts);
+
+ if (l.locked ())
+ {
+ if (!find_ (sts, &id))
+ return pointer_type ();
+ }
+
+ pointer_type p (
+ access::object_factory<object_type, pointer_type>::create ());
+ pointer_traits::guard pg (p);
+
+ pointer_cache_traits::insert_guard ig (
+ pointer_cache_traits::insert (db, id, p));
+
+ object_type& obj (pointer_traits::get_ref (p));
+
+ if (l.locked ())
+ {
+ select_statement& st (sts.find_statement ());
+ ODB_POTENTIALLY_UNUSED (st);
+
+ callback (db, obj, callback_event::pre_load);
+ init (obj, sts.image (), &db);
+ load_ (sts, obj, false);
+ sts.load_delayed (0);
+ l.unlock ();
+ callback (db, obj, callback_event::post_load);
+ pointer_cache_traits::load (ig.position ());
+ }
+ else
+ sts.delay_load (id, obj, ig.position ());
+
+ ig.release ();
+ pg.release ();
+ return p;
+ }
+
+ bool access::object_traits_impl< ::brep::build_package, id_pgsql >::
+ find (database& db, const id_type& id, object_type& obj)
+ {
+ using namespace pgsql;
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ statements_type::auto_lock l (sts);
+ assert (l.locked ()) /* Must be a top-level call. */;
+
+ if (!find_ (sts, &id))
+ return false;
+
+ select_statement& st (sts.find_statement ());
+ ODB_POTENTIALLY_UNUSED (st);
+
+ reference_cache_traits::position_type pos (
+ reference_cache_traits::insert (db, id, obj));
+ reference_cache_traits::insert_guard ig (pos);
+
+ callback (db, obj, callback_event::pre_load);
+ init (obj, sts.image (), &db);
+ load_ (sts, obj, false);
+ sts.load_delayed (0);
+ l.unlock ();
+ callback (db, obj, callback_event::post_load);
+ reference_cache_traits::load (pos);
+ ig.release ();
+ return true;
+ }
+
+ bool access::object_traits_impl< ::brep::build_package, id_pgsql >::
+ reload (database& db, object_type& obj)
+ {
+ using namespace pgsql;
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ statements_type::auto_lock l (sts);
+ assert (l.locked ()) /* Must be a top-level call. */;
+
+ const id_type& id (object_traits_impl::id (obj));
+ if (!find_ (sts, &id))
+ return false;
+
+ select_statement& st (sts.find_statement ());
+ ODB_POTENTIALLY_UNUSED (st);
+
+ callback (db, obj, callback_event::pre_load);
+ init (obj, sts.image (), &db);
+ load_ (sts, obj, true);
+ sts.load_delayed (0);
+ l.unlock ();
+ callback (db, obj, callback_event::post_load);
+ return true;
+ }
+
+ bool access::object_traits_impl< ::brep::build_package, id_pgsql >::
+ find_ (statements_type& sts,
+ const id_type* id)
+ {
+ using namespace pgsql;
+
+ id_image_type& i (sts.id_image ());
+ init (i, *id);
+
+ binding& idb (sts.id_image_binding ());
+ if (i.version != sts.id_image_version () || idb.version == 0)
+ {
+ bind (idb.bind, i);
+ sts.id_image_version (i.version);
+ idb.version++;
+ }
+
+ image_type& im (sts.image ());
+ binding& imb (sts.select_image_binding ());
+
+ if (im.version != sts.select_image_version () ||
+ imb.version == 0)
+ {
+ bind (imb.bind, im, statement_select);
+ sts.select_image_version (im.version);
+ imb.version++;
+ }
+
+ select_statement& st (sts.find_statement ());
+
+ st.execute ();
+ auto_result ar (st);
+ select_statement::result r (st.fetch ());
+
+ if (r == select_statement::truncated)
+ {
+ if (grow (im, sts.select_image_truncated ()))
+ im.version++;
+
+ if (im.version != sts.select_image_version ())
+ {
+ bind (imb.bind, im, statement_select);
+ sts.select_image_version (im.version);
+ imb.version++;
+ st.refetch ();
+ }
+ }
+
+ return r != select_statement::no_data;
+ }
+
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::
+ load_ (statements_type& sts,
+ object_type& obj,
+ bool reload)
+ {
+ ODB_POTENTIALLY_UNUSED (reload);
+
+ extra_statement_cache_type& esc (sts.extra_statement_cache ());
+
+ // tests
+ //
+ {
+ ::butl::small_vector< ::brep::build_test_dependency, 1 >& v =
+ obj.tests;
+
+ tests_traits::load (
+ v,
+ esc.tests);
+ }
+
+ // builds
+ //
+ {
+ ::brep::build_class_exprs& v =
+ obj.builds;
+
+ builds_traits::load (
+ v,
+ esc.builds);
+ }
+
+ // constraints
+ //
+ {
+ ::brep::build_constraints& v =
+ obj.constraints;
+
+ constraints_traits::load (
+ v,
+ esc.constraints);
+ }
+ }
+
+ result< access::object_traits_impl< ::brep::build_package, id_pgsql >::object_type >
+ access::object_traits_impl< ::brep::build_package, id_pgsql >::
+ query (database&, const query_base_type& q)
+ {
+ using namespace pgsql;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.select_image_binding ());
+
+ if (im.version != sts.select_image_version () ||
+ imb.version == 0)
+ {
+ bind (imb.bind, im, statement_select);
+ sts.select_image_version (im.version);
+ imb.version++;
+ }
+
+ std::string text (query_statement);
+ if (!q.empty ())
+ {
+ text += "\n";
+ text += q.clause ();
+ }
+
+ q.init_parameters ();
+ shared_ptr<select_statement> st (
+ new (shared) select_statement (
+ sts.connection (),
+ query_statement_name,
+ text,
+ true,
+ true,
+ q.parameter_types (),
+ q.parameter_count (),
+ q.parameters_binding (),
+ imb));
+
+ st->execute ();
+ st->deallocate ();
+
+ shared_ptr< odb::object_result_impl<object_type> > r (
+ new (shared) pgsql::object_result_impl<object_type> (
+ q, st, sts, 0));
+
+ return result<object_type> (r);
+ }
+
+ unsigned long long access::object_traits_impl< ::brep::build_package, id_pgsql >::
+ erase_query (database&, const query_base_type& q)
+ {
+ using namespace pgsql;
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+
+ std::string text (erase_query_statement);
+ if (!q.empty ())
+ {
+ text += ' ';
+ text += q.clause ();
+ }
+
+ q.init_parameters ();
+ delete_statement st (
+ conn,
+ erase_query_statement_name,
+ text,
+ q.parameter_types (),
+ q.parameter_count (),
+ q.parameters_binding ());
+
+ return st.execute ();
+ }
+
+ odb::details::shared_ptr<prepared_query_impl>
+ access::object_traits_impl< ::brep::build_package, id_pgsql >::
+ prepare_query (connection& c, const char* n, const query_base_type& q)
+ {
+ using namespace pgsql;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ pgsql::connection& conn (
+ static_cast<pgsql::connection&> (c));
+
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.select_image_binding ());
+
+ if (im.version != sts.select_image_version () ||
+ imb.version == 0)
+ {
+ bind (imb.bind, im, statement_select);
+ sts.select_image_version (im.version);
+ imb.version++;
+ }
+
+ std::string text (query_statement);
+ if (!q.empty ())
+ {
+ text += "\n";
+ text += q.clause ();
+ }
+
+ shared_ptr<pgsql::prepared_query_impl> r (
+ new (shared) pgsql::prepared_query_impl (conn));
+ r->name = n;
+ r->execute = &execute_query;
+ r->query = q;
+ r->stmt.reset (
+ new (shared) select_statement (
+ sts.connection (),
+ n,
+ text,
+ true,
+ true,
+ r->query.parameter_types (),
+ r->query.parameter_count (),
+ r->query.parameters_binding (),
+ imb));
+
+ return r;
+ }
+
+ odb::details::shared_ptr<result_impl>
+ access::object_traits_impl< ::brep::build_package, id_pgsql >::
+ execute_query (prepared_query_impl& q)
+ {
+ using namespace pgsql;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ pgsql::prepared_query_impl& pq (
+ static_cast<pgsql::prepared_query_impl&> (q));
+ shared_ptr<select_statement> st (
+ odb::details::inc_ref (
+ static_cast<select_statement*> (pq.stmt.get ())));
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+
+ // The connection used by the current transaction and the
+ // one used to prepare this statement must be the same.
+ //
+ assert (&conn == &st->connection ());
+
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.select_image_binding ());
+
+ if (im.version != sts.select_image_version () ||
+ imb.version == 0)
+ {
+ bind (imb.bind, im, statement_select);
+ sts.select_image_version (im.version);
+ imb.version++;
+ }
+
+ pq.query.init_parameters ();
+ st->execute ();
+
+ return shared_ptr<result_impl> (
+ new (shared) pgsql::object_result_impl<object_type> (
+ pq.query, st, sts, 0));
+ }
+
+ // buildable_package
+ //
+
+ const char access::view_traits_impl< ::brep::buildable_package, id_pgsql >::
+ query_statement_name[] = "query_brep_buildable_package";
+
+ bool access::view_traits_impl< ::brep::buildable_package, id_pgsql >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // id
+ //
+ if (composite_value_traits< ::brep::package_id, id_pgsql >::grow (
+ i.id_value, t + 0UL))
+ grew = true;
+
+ // version
+ //
+ if (composite_value_traits< ::brep::upstream_version, id_pgsql >::grow (
+ i.version_value, t + 6UL))
+ grew = true;
+
+ // archived
+ //
+ t[8UL] = 0;
+
+ return grew;
+ }
+
+ void access::view_traits_impl< ::brep::buildable_package, id_pgsql >::
+ bind (pgsql::bind* b,
+ image_type& i)
+ {
+ using namespace pgsql;
+
+ pgsql::statement_kind sk (statement_select);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ std::size_t n (0);
+
+ // id
+ //
+ composite_value_traits< ::brep::package_id, id_pgsql >::bind (
+ b + n, i.id_value, sk);
+ n += 6UL;
+
+ // version
+ //
+ composite_value_traits< ::brep::upstream_version, id_pgsql >::bind (
+ b + n, i.version_value, sk);
+ n += 2UL;
+
+ // archived
+ //
+ b[n].type = pgsql::bind::boolean_;
+ b[n].buffer = &i.archived_value;
+ b[n].is_null = &i.archived_null;
+ n++;
+ }
+
+ void access::view_traits_impl< ::brep::buildable_package, id_pgsql >::
+ init (view_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // id
+ //
+ {
+ ::brep::package_id& v =
+ o.id;
+
+ composite_value_traits< ::brep::package_id, id_pgsql >::init (
+ v,
+ i.id_value,
+ db);
+ }
+
+ // version
+ //
+ {
+ // From build-package.hxx:148:32
+ ::brep::upstream_version v;
+
+ composite_value_traits< ::brep::upstream_version, id_pgsql >::init (
+ v,
+ i.version_value,
+ db);
+
+ // From build-package.hxx:148:32
+ o.version.init (o.id.version, (v));
+ }
+
+ // archived
+ //
+ {
+ bool& v =
+ o.archived;
+
+ pgsql::value_traits<
+ bool,
+ pgsql::id_boolean >::set_value (
+ v,
+ i.archived_value,
+ i.archived_null);
+ }
+ }
+
+ access::view_traits_impl< ::brep::buildable_package, id_pgsql >::query_base_type
+ access::view_traits_impl< ::brep::buildable_package, id_pgsql >::
+ query_statement (const query_base_type& q)
+ {
+ query_base_type r (
+ "SELECT "
+ "\"build_package\".\"tenant\", "
+ "\"build_package\".\"name\"::TEXT, "
+ "\"build_package\".\"version_epoch\", "
+ "\"build_package\".\"version_canonical_upstream\", "
+ "\"build_package\".\"version_canonical_release\", "
+ "\"build_package\".\"version_revision\", "
+ "\"build_package\".\"version_upstream\", "
+ "\"build_package\".\"version_release\", "
+ "\"build_tenant\".\"archived\" ");
+
+ r += "FROM \"build_package\"";
+
+ r += " INNER JOIN \"build_repository\" ON";
+ // From build-package.hxx:134:5
+ r += query_columns::build_package::buildable && brep::operator == (query_columns::build_package::internal_repository, query_columns::build_repository::id);
+
+ r += " LEFT JOIN \"build_tenant\" ON";
+ // From build-package.hxx:138:5
+ r += query_columns::build_package::id.tenant == query_columns::build_tenant::id;
+
+ if (!q.empty ())
+ {
+ r += " ";
+ r += q.clause_prefix ();
+ r += q;
+ }
+
+ return r;
+ }
+
+ result< access::view_traits_impl< ::brep::buildable_package, id_pgsql >::view_type >
+ access::view_traits_impl< ::brep::buildable_package, id_pgsql >::
+ query (database&, const query_base_type& q)
+ {
+ using namespace pgsql;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+ statements_type& sts (
+ conn.statement_cache ().find_view<view_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.image_binding ());
+
+ if (im.version != sts.image_version () || imb.version == 0)
+ {
+ bind (imb.bind, im);
+ sts.image_version (im.version);
+ imb.version++;
+ }
+
+ const query_base_type& qs (query_statement (q));
+ qs.init_parameters ();
+ shared_ptr<select_statement> st (
+ new (shared) select_statement (
+ sts.connection (),
+ query_statement_name,
+ qs.clause (),
+ false,
+ true,
+ qs.parameter_types (),
+ qs.parameter_count (),
+ qs.parameters_binding (),
+ imb));
+
+ st->execute ();
+ st->deallocate ();
+
+ shared_ptr< odb::view_result_impl<view_type> > r (
+ new (shared) pgsql::view_result_impl<view_type> (
+ qs, st, sts, 0));
+
+ return result<view_type> (r);
+ }
+
+ odb::details::shared_ptr<prepared_query_impl>
+ access::view_traits_impl< ::brep::buildable_package, id_pgsql >::
+ prepare_query (connection& c, const char* n, const query_base_type& q)
+ {
+ using namespace pgsql;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ pgsql::connection& conn (
+ static_cast<pgsql::connection&> (c));
+ statements_type& sts (
+ conn.statement_cache ().find_view<view_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.image_binding ());
+
+ if (im.version != sts.image_version () || imb.version == 0)
+ {
+ bind (imb.bind, im);
+ sts.image_version (im.version);
+ imb.version++;
+ }
+
+ shared_ptr<pgsql::prepared_query_impl> r (
+ new (shared) pgsql::prepared_query_impl (conn));
+ r->name = n;
+ r->execute = &execute_query;
+ r->query = query_statement (q);
+ r->stmt.reset (
+ new (shared) select_statement (
+ sts.connection (),
+ n,
+ r->query.clause (),
+ false,
+ true,
+ r->query.parameter_types (),
+ r->query.parameter_count (),
+ r->query.parameters_binding (),
+ imb));
+
+ return r;
+ }
+
+ odb::details::shared_ptr<result_impl>
+ access::view_traits_impl< ::brep::buildable_package, id_pgsql >::
+ execute_query (prepared_query_impl& q)
+ {
+ using namespace pgsql;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ pgsql::prepared_query_impl& pq (
+ static_cast<pgsql::prepared_query_impl&> (q));
+ shared_ptr<select_statement> st (
+ odb::details::inc_ref (
+ static_cast<select_statement*> (pq.stmt.get ())));
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+
+ // The connection used by the current transaction and the
+ // one used to prepare this statement must be the same.
+ //
+ assert (&conn == &st->connection ());
+
+ statements_type& sts (
+ conn.statement_cache ().find_view<view_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.image_binding ());
+
+ if (im.version != sts.image_version () || imb.version == 0)
+ {
+ bind (imb.bind, im);
+ sts.image_version (im.version);
+ imb.version++;
+ }
+
+ pq.query.init_parameters ();
+ st->execute ();
+
+ return shared_ptr<result_impl> (
+ new (shared) pgsql::view_result_impl<view_type> (
+ pq.query, st, sts, 0));
+ }
+
+ // buildable_package_count
+ //
+
+ const char access::view_traits_impl< ::brep::buildable_package_count, id_pgsql >::
+ query_statement_name[] = "query_brep_buildable_package_count";
+
+ bool access::view_traits_impl< ::brep::buildable_package_count, id_pgsql >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // result
+ //
+ t[0UL] = 0;
+
+ return grew;
+ }
+
+ void access::view_traits_impl< ::brep::buildable_package_count, id_pgsql >::
+ bind (pgsql::bind* b,
+ image_type& i)
+ {
+ using namespace pgsql;
+
+ pgsql::statement_kind sk (statement_select);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ std::size_t n (0);
+
+ // result
+ //
+ b[n].type = pgsql::bind::bigint;
+ b[n].buffer = &i.result_value;
+ b[n].is_null = &i.result_null;
+ n++;
+ }
+
+ void access::view_traits_impl< ::brep::buildable_package_count, id_pgsql >::
+ init (view_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // result
+ //
+ {
+ ::std::size_t& v =
+ o.result;
+
+ pgsql::value_traits<
+ ::std::size_t,
+ pgsql::id_bigint >::set_value (
+ v,
+ i.result_value,
+ i.result_null);
+ }
+ }
+
+ access::view_traits_impl< ::brep::buildable_package_count, id_pgsql >::query_base_type
+ access::view_traits_impl< ::brep::buildable_package_count, id_pgsql >::
+ query_statement (const query_base_type& q)
+ {
+ query_base_type r (
+ "SELECT "
+ "count(\"build_package\".\"name\") ");
+
+ r += "FROM \"build_package\"";
+
+ r += " INNER JOIN \"build_repository\" ON";
+ // From build-package.hxx:153:5
+ r += query_columns::build_package::buildable && brep::operator == (query_columns::build_package::internal_repository, query_columns::build_repository::id);
+
+ r += " LEFT JOIN \"build_tenant\" ON";
+ // From build-package.hxx:157:5
+ r += query_columns::build_package::id.tenant == query_columns::build_tenant::id;
+
+ if (!q.empty ())
+ {
+ r += " ";
+ r += q.clause_prefix ();
+ r += q;
+ }
+
+ return r;
+ }
+
+ result< access::view_traits_impl< ::brep::buildable_package_count, id_pgsql >::view_type >
+ access::view_traits_impl< ::brep::buildable_package_count, id_pgsql >::
+ query (database&, const query_base_type& q)
+ {
+ using namespace pgsql;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+ statements_type& sts (
+ conn.statement_cache ().find_view<view_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.image_binding ());
+
+ if (im.version != sts.image_version () || imb.version == 0)
+ {
+ bind (imb.bind, im);
+ sts.image_version (im.version);
+ imb.version++;
+ }
+
+ const query_base_type& qs (query_statement (q));
+ qs.init_parameters ();
+ shared_ptr<select_statement> st (
+ new (shared) select_statement (
+ sts.connection (),
+ query_statement_name,
+ qs.clause (),
+ false,
+ true,
+ qs.parameter_types (),
+ qs.parameter_count (),
+ qs.parameters_binding (),
+ imb));
+
+ st->execute ();
+ st->deallocate ();
+
+ shared_ptr< odb::view_result_impl<view_type> > r (
+ new (shared) pgsql::view_result_impl<view_type> (
+ qs, st, sts, 0));
+
+ return result<view_type> (r);
+ }
+
+ odb::details::shared_ptr<prepared_query_impl>
+ access::view_traits_impl< ::brep::buildable_package_count, id_pgsql >::
+ prepare_query (connection& c, const char* n, const query_base_type& q)
+ {
+ using namespace pgsql;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ pgsql::connection& conn (
+ static_cast<pgsql::connection&> (c));
+ statements_type& sts (
+ conn.statement_cache ().find_view<view_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.image_binding ());
+
+ if (im.version != sts.image_version () || imb.version == 0)
+ {
+ bind (imb.bind, im);
+ sts.image_version (im.version);
+ imb.version++;
+ }
+
+ shared_ptr<pgsql::prepared_query_impl> r (
+ new (shared) pgsql::prepared_query_impl (conn));
+ r->name = n;
+ r->execute = &execute_query;
+ r->query = query_statement (q);
+ r->stmt.reset (
+ new (shared) select_statement (
+ sts.connection (),
+ n,
+ r->query.clause (),
+ false,
+ true,
+ r->query.parameter_types (),
+ r->query.parameter_count (),
+ r->query.parameters_binding (),
+ imb));
+
+ return r;
+ }
+
+ odb::details::shared_ptr<result_impl>
+ access::view_traits_impl< ::brep::buildable_package_count, id_pgsql >::
+ execute_query (prepared_query_impl& q)
+ {
+ using namespace pgsql;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ pgsql::prepared_query_impl& pq (
+ static_cast<pgsql::prepared_query_impl&> (q));
+ shared_ptr<select_statement> st (
+ odb::details::inc_ref (
+ static_cast<select_statement*> (pq.stmt.get ())));
+
+ pgsql::connection& conn (
+ pgsql::transaction::current ().connection ());
+
+ // The connection used by the current transaction and the
+ // one used to prepare this statement must be the same.
+ //
+ assert (&conn == &st->connection ());
+
+ statements_type& sts (
+ conn.statement_cache ().find_view<view_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.image_binding ());
+
+ if (im.version != sts.image_version () || imb.version == 0)
+ {
+ bind (imb.bind, im);
+ sts.image_version (im.version);
+ imb.version++;
+ }
+
+ pq.query.init_parameters ();
+ st->execute ();
+
+ return shared_ptr<result_impl> (
+ new (shared) pgsql::view_result_impl<view_type> (
+ pq.query, st, sts, 0));
+ }
+}
+
+#include <odb/post.hxx>
diff --git a/libbrep/build-package-odb.hxx b/libbrep/build-package-odb.hxx
new file mode 100644
index 0000000..a0694e1
--- /dev/null
+++ b/libbrep/build-package-odb.hxx
@@ -0,0 +1,1877 @@
+// -*- C++ -*-
+//
+// This file was generated by ODB, object-relational mapping (ORM)
+// compiler for C++.
+//
+
+#ifndef LIBBREP_BUILD_PACKAGE_ODB_HXX
+#define LIBBREP_BUILD_PACKAGE_ODB_HXX
+
+#include <odb/version.hxx>
+
+#if (ODB_VERSION != 20470UL)
+#error ODB runtime version mismatch
+#endif
+
+#include <odb/pre.hxx>
+
+#include <libbrep/build-package.hxx>
+
+#include <libbrep/common-odb.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/prepared-query.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
+{
+ // build_tenant
+ //
+ template <>
+ struct class_traits< ::brep::build_tenant >
+ {
+ static const class_kind kind = class_object;
+ };
+
+ template <>
+ class access::object_traits< ::brep::build_tenant >
+ {
+ public:
+ typedef ::brep::build_tenant object_type;
+ typedef ::std::shared_ptr< ::brep::build_tenant > pointer_type;
+ typedef odb::pointer_traits<pointer_type> pointer_traits;
+
+ static const bool polymorphic = false;
+
+ typedef ::std::string id_type;
+
+ static const bool auto_id = false;
+
+ static const bool abstract = false;
+
+ static id_type
+ id (const object_type&);
+
+ typedef
+ no_op_pointer_cache_traits<pointer_type>
+ pointer_cache_traits;
+
+ typedef
+ no_op_reference_cache_traits<object_type>
+ reference_cache_traits;
+
+ static void
+ callback (database&, object_type&, callback_event);
+
+ static void
+ callback (database&, const object_type&, callback_event);
+ };
+
+ // build_repository
+ //
+ template <>
+ struct class_traits< ::brep::build_repository >
+ {
+ static const class_kind kind = class_object;
+ };
+
+ template <>
+ class access::object_traits< ::brep::build_repository >
+ {
+ public:
+ typedef ::brep::build_repository object_type;
+ typedef ::std::shared_ptr< ::brep::build_repository > pointer_type;
+ typedef odb::pointer_traits<pointer_type> pointer_traits;
+
+ static const bool polymorphic = false;
+
+ typedef ::brep::repository_id id_type;
+
+ static const bool auto_id = false;
+
+ static const bool abstract = false;
+
+ static id_type
+ id (const object_type&);
+
+ typedef
+ no_op_pointer_cache_traits<pointer_type>
+ pointer_cache_traits;
+
+ typedef
+ no_op_reference_cache_traits<object_type>
+ reference_cache_traits;
+
+ static void
+ callback (database&, object_type&, callback_event);
+
+ static void
+ callback (database&, const object_type&, callback_event);
+ };
+
+ // build_package
+ //
+ template <>
+ struct class_traits< ::brep::build_package >
+ {
+ static const class_kind kind = class_object;
+ };
+
+ template <>
+ class access::object_traits< ::brep::build_package >
+ {
+ public:
+ typedef ::brep::build_package object_type;
+ typedef ::std::shared_ptr< ::brep::build_package > pointer_type;
+ typedef odb::pointer_traits<pointer_type> pointer_traits;
+
+ static const bool polymorphic = false;
+
+ typedef ::brep::package_id id_type;
+
+ static const bool auto_id = false;
+
+ 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);
+ };
+
+ // buildable_package
+ //
+ template <>
+ struct class_traits< ::brep::buildable_package >
+ {
+ static const class_kind kind = class_view;
+ };
+
+ template <>
+ class access::view_traits< ::brep::buildable_package >
+ {
+ public:
+ typedef ::brep::buildable_package view_type;
+ typedef ::brep::buildable_package* pointer_type;
+
+ static void
+ callback (database&, view_type&, callback_event);
+ };
+
+ // buildable_package_count
+ //
+ template <>
+ struct class_traits< ::brep::buildable_package_count >
+ {
+ static const class_kind kind = class_view;
+ };
+
+ template <>
+ class access::view_traits< ::brep::buildable_package_count >
+ {
+ public:
+ typedef ::brep::buildable_package_count view_type;
+ typedef ::brep::buildable_package_count* pointer_type;
+
+ static void
+ callback (database&, view_type&, callback_event);
+ };
+}
+
+#include <odb/details/buffer.hxx>
+
+#include <odb/pgsql/version.hxx>
+#include <odb/pgsql/forward.hxx>
+#include <odb/pgsql/binding.hxx>
+#include <odb/pgsql/pgsql-types.hxx>
+#include <odb/pgsql/query.hxx>
+
+namespace odb
+{
+ // build_tenant
+ //
+ template <typename A>
+ struct query_columns< ::brep::build_tenant, id_pgsql, A >
+ {
+ // id
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ id_type_;
+
+ static const id_type_ id;
+
+ // archived
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ bool,
+ pgsql::id_boolean >::query_type,
+ pgsql::id_boolean >
+ archived_type_;
+
+ static const archived_type_ archived;
+ };
+
+ template <typename A>
+ const typename query_columns< ::brep::build_tenant, id_pgsql, A >::id_type_
+ query_columns< ::brep::build_tenant, id_pgsql, A >::
+ id (A::table_name, "\"id\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build_tenant, id_pgsql, A >::archived_type_
+ query_columns< ::brep::build_tenant, id_pgsql, A >::
+ archived (A::table_name, "\"archived\"", 0);
+
+ template <typename A>
+ struct pointer_query_columns< ::brep::build_tenant, id_pgsql, A >:
+ query_columns< ::brep::build_tenant, id_pgsql, A >
+ {
+ };
+
+ template <>
+ class access::object_traits_impl< ::brep::build_tenant, id_pgsql >:
+ public access::object_traits< ::brep::build_tenant >
+ {
+ public:
+ struct id_image_type
+ {
+ details::buffer id_value;
+ std::size_t id_size;
+ bool id_null;
+
+ std::size_t version;
+ };
+
+ struct image_type
+ {
+ // id
+ //
+ details::buffer id_value;
+ std::size_t id_size;
+ bool id_null;
+
+ // archived
+ //
+ bool archived_value;
+ bool archived_null;
+
+ std::size_t version;
+ };
+
+ struct extra_statement_cache_type;
+
+ using object_traits<object_type>::id;
+
+ static id_type
+ id (const image_type&);
+
+ static bool
+ grow (image_type&,
+ bool*);
+
+ static void
+ bind (pgsql::bind*,
+ image_type&,
+ pgsql::statement_kind);
+
+ static void
+ bind (pgsql::bind*, id_image_type&);
+
+ static bool
+ init (image_type&,
+ const object_type&,
+ pgsql::statement_kind);
+
+ static void
+ init (object_type&,
+ const image_type&,
+ database*);
+
+ static void
+ init (id_image_type&, const id_type&);
+
+ typedef pgsql::object_statements<object_type> statements_type;
+
+ typedef pgsql::query_base query_base_type;
+
+ static const std::size_t column_count = 2UL;
+ 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 = 1UL;
+ 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 erase_statement[];
+ static const char query_statement[];
+ static const char erase_query_statement[];
+
+ static const char table_name[];
+
+ static void
+ persist (database&, const 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
+ 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&);
+
+ static odb::details::shared_ptr<prepared_query_impl>
+ prepare_query (connection&, const char*, const query_base_type&);
+
+ static odb::details::shared_ptr<result_impl>
+ execute_query (prepared_query_impl&);
+
+ static const char persist_statement_name[];
+ static const char find_statement_name[];
+ static const char erase_statement_name[];
+ static const char query_statement_name[];
+ static const char erase_query_statement_name[];
+
+ static const unsigned int persist_statement_types[];
+ static const unsigned int find_statement_types[];
+
+ public:
+ static bool
+ find_ (statements_type&,
+ const id_type*);
+
+ static void
+ load_ (statements_type&,
+ object_type&,
+ bool reload);
+ };
+
+ template <>
+ class access::object_traits_impl< ::brep::build_tenant, id_common >:
+ public access::object_traits_impl< ::brep::build_tenant, id_pgsql >
+ {
+ };
+
+ // build_repository
+ //
+ template <typename A>
+ struct query_columns< ::brep::build_repository, id_pgsql, A >
+ {
+ // id
+ //
+ struct id_class_
+ {
+ id_class_ ()
+ {
+ }
+
+ // tenant
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ tenant_type_;
+
+ static const tenant_type_ tenant;
+
+ // canonical_name
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ canonical_name_type_;
+
+ static const canonical_name_type_ canonical_name;
+ };
+
+ static const id_class_ id;
+
+ // location
+ //
+ struct location_class_
+ {
+ location_class_ ()
+ {
+ }
+
+ // url
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ url_type_;
+
+ static const url_type_ url;
+
+ // type
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ type_type_;
+
+ static const type_type_ type;
+ };
+
+ static const location_class_ location;
+
+ // certificate_fingerprint
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::basic_string< char >,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ certificate_fingerprint_type_;
+
+ static const certificate_fingerprint_type_ certificate_fingerprint;
+ };
+
+ template <typename A>
+ const typename query_columns< ::brep::build_repository, id_pgsql, A >::id_class_::tenant_type_
+ query_columns< ::brep::build_repository, id_pgsql, A >::id_class_::
+ tenant (A::table_name, "\"tenant\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build_repository, id_pgsql, A >::id_class_::canonical_name_type_
+ query_columns< ::brep::build_repository, id_pgsql, A >::id_class_::
+ canonical_name (A::table_name, "\"canonical_name\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build_repository, id_pgsql, A >::id_class_
+ query_columns< ::brep::build_repository, id_pgsql, A >::id;
+
+ template <typename A>
+ const typename query_columns< ::brep::build_repository, id_pgsql, A >::location_class_::url_type_
+ query_columns< ::brep::build_repository, id_pgsql, A >::location_class_::
+ url (A::table_name, "\"location_url\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build_repository, id_pgsql, A >::location_class_::type_type_
+ query_columns< ::brep::build_repository, id_pgsql, A >::location_class_::
+ type (A::table_name, "\"location_type\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build_repository, id_pgsql, A >::location_class_
+ query_columns< ::brep::build_repository, id_pgsql, A >::location;
+
+ template <typename A>
+ const typename query_columns< ::brep::build_repository, id_pgsql, A >::certificate_fingerprint_type_
+ query_columns< ::brep::build_repository, id_pgsql, A >::
+ certificate_fingerprint (A::table_name, "\"certificate_fingerprint\"", 0);
+
+ template <typename A>
+ struct pointer_query_columns< ::brep::build_repository, id_pgsql, A >:
+ query_columns< ::brep::build_repository, id_pgsql, A >
+ {
+ };
+
+ template <>
+ class access::object_traits_impl< ::brep::build_repository, id_pgsql >:
+ public access::object_traits< ::brep::build_repository >
+ {
+ public:
+ struct id_image_type
+ {
+ composite_value_traits< ::brep::repository_id, id_pgsql >::image_type id_value;
+
+ std::size_t version;
+ };
+
+ struct image_type
+ {
+ // id
+ //
+ composite_value_traits< ::brep::repository_id, id_pgsql >::image_type id_value;
+
+ // location
+ //
+ composite_value_traits< ::brep::_repository_location, id_pgsql >::image_type location_value;
+
+ // certificate_fingerprint
+ //
+ details::buffer certificate_fingerprint_value;
+ std::size_t certificate_fingerprint_size;
+ bool certificate_fingerprint_null;
+
+ std::size_t version;
+ };
+
+ struct extra_statement_cache_type;
+
+ using object_traits<object_type>::id;
+
+ static id_type
+ id (const image_type&);
+
+ static bool
+ grow (image_type&,
+ bool*);
+
+ static void
+ bind (pgsql::bind*,
+ image_type&,
+ pgsql::statement_kind);
+
+ static void
+ bind (pgsql::bind*, id_image_type&);
+
+ static bool
+ init (image_type&,
+ const object_type&,
+ pgsql::statement_kind);
+
+ static void
+ init (object_type&,
+ const image_type&,
+ database*);
+
+ static void
+ init (id_image_type&, const id_type&);
+
+ typedef pgsql::object_statements<object_type> statements_type;
+
+ typedef pgsql::query_base query_base_type;
+
+ static const std::size_t column_count = 5UL;
+ static const std::size_t id_column_count = 2UL;
+ static const std::size_t inverse_column_count = 0UL;
+ static const std::size_t readonly_column_count = 3UL;
+ 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 erase_statement[];
+ static const char query_statement[];
+ static const char erase_query_statement[];
+
+ static const char table_name[];
+
+ static void
+ persist (database&, const 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
+ 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&);
+
+ static odb::details::shared_ptr<prepared_query_impl>
+ prepare_query (connection&, const char*, const query_base_type&);
+
+ static odb::details::shared_ptr<result_impl>
+ execute_query (prepared_query_impl&);
+
+ static const char persist_statement_name[];
+ static const char find_statement_name[];
+ static const char erase_statement_name[];
+ static const char query_statement_name[];
+ static const char erase_query_statement_name[];
+
+ static const unsigned int persist_statement_types[];
+ static const unsigned int find_statement_types[];
+
+ public:
+ static bool
+ find_ (statements_type&,
+ const id_type*);
+
+ static void
+ load_ (statements_type&,
+ object_type&,
+ bool reload);
+ };
+
+ template <>
+ class access::object_traits_impl< ::brep::build_repository, id_common >:
+ public access::object_traits_impl< ::brep::build_repository, id_pgsql >
+ {
+ };
+
+ // build_test_dependency
+ //
+ template <>
+ class access::composite_value_traits< ::brep::build_test_dependency, id_pgsql >
+ {
+ public:
+ typedef ::brep::build_test_dependency value_type;
+
+ struct image_type
+ {
+ // name
+ //
+ details::buffer name_value;
+ std::size_t name_size;
+ bool name_null;
+
+ // package
+ //
+ composite_value_traits< ::brep::package_id, id_pgsql >::image_type package_value;
+ };
+
+ static bool
+ grow (image_type&,
+ bool*);
+
+ static void
+ bind (pgsql::bind*,
+ image_type&,
+ pgsql::statement_kind);
+
+ static bool
+ init (image_type&,
+ const value_type&,
+ pgsql::statement_kind);
+
+ static void
+ init (value_type&,
+ const image_type&,
+ database*);
+
+ static bool
+ get_null (const image_type&);
+
+ static void
+ set_null (image_type&,
+ pgsql::statement_kind);
+
+ static const std::size_t column_count = 7UL;
+ };
+
+ // build_package
+ //
+ template <typename A>
+ struct pointer_query_columns< ::brep::build_package, id_pgsql, A >
+ {
+ // id
+ //
+ struct id_class_
+ {
+ id_class_ ()
+ {
+ }
+
+ // tenant
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ tenant_type_;
+
+ static const tenant_type_ tenant;
+
+ // name
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::bpkg::package_name,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ name_type_;
+
+ static const name_type_ name;
+
+ // version
+ //
+ struct version_class_1_
+ {
+ version_class_1_ ()
+ {
+ }
+
+ // epoch
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::uint16_t,
+ pgsql::id_integer >::query_type,
+ pgsql::id_integer >
+ epoch_type_;
+
+ static const epoch_type_ epoch;
+
+ // canonical_upstream
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ canonical_upstream_type_;
+
+ static const canonical_upstream_type_ canonical_upstream;
+
+ // canonical_release
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ canonical_release_type_;
+
+ static const canonical_release_type_ canonical_release;
+
+ // revision
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::uint16_t,
+ pgsql::id_integer >::query_type,
+ pgsql::id_integer >
+ revision_type_;
+
+ static const revision_type_ revision;
+ };
+
+ static const version_class_1_ version;
+ };
+
+ static const id_class_ id;
+
+ // version
+ //
+ struct version_class_
+ {
+ version_class_ ()
+ {
+ }
+
+ // upstream
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ upstream_type_;
+
+ static const upstream_type_ upstream;
+
+ // release
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::basic_string< char >,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ release_type_;
+
+ static const release_type_ release;
+ };
+
+ static const version_class_ version;
+
+ // internal_repository
+ //
+ struct internal_repository_class_
+ {
+ internal_repository_class_ ()
+ {
+ }
+
+ // tenant
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ tenant_type_;
+
+ static const tenant_type_ tenant;
+
+ // canonical_name
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ canonical_name_type_;
+
+ static const canonical_name_type_ canonical_name;
+ };
+
+ static const internal_repository_class_ internal_repository;
+
+ // buildable
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ bool,
+ pgsql::id_boolean >::query_type,
+ pgsql::id_boolean >
+ buildable_type_;
+
+ static const buildable_type_ buildable;
+ };
+
+ template <typename A>
+ const typename pointer_query_columns< ::brep::build_package, id_pgsql, A >::id_class_::tenant_type_
+ pointer_query_columns< ::brep::build_package, id_pgsql, A >::id_class_::
+ tenant (A::table_name, "\"tenant\"", 0);
+
+ template <typename A>
+ const typename pointer_query_columns< ::brep::build_package, id_pgsql, A >::id_class_::name_type_
+ pointer_query_columns< ::brep::build_package, id_pgsql, A >::id_class_::
+ name (A::table_name, "\"name\"", "(?)::CITEXT");
+
+ template <typename A>
+ const typename pointer_query_columns< ::brep::build_package, id_pgsql, A >::id_class_::version_class_1_::epoch_type_
+ pointer_query_columns< ::brep::build_package, id_pgsql, A >::id_class_::version_class_1_::
+ epoch (A::table_name, "\"version_epoch\"", 0);
+
+ template <typename A>
+ const typename pointer_query_columns< ::brep::build_package, id_pgsql, A >::id_class_::version_class_1_::canonical_upstream_type_
+ pointer_query_columns< ::brep::build_package, id_pgsql, A >::id_class_::version_class_1_::
+ canonical_upstream (A::table_name, "\"version_canonical_upstream\"", 0);
+
+ template <typename A>
+ const typename pointer_query_columns< ::brep::build_package, id_pgsql, A >::id_class_::version_class_1_::canonical_release_type_
+ pointer_query_columns< ::brep::build_package, id_pgsql, A >::id_class_::version_class_1_::
+ canonical_release (A::table_name, "\"version_canonical_release\"", 0);
+
+ template <typename A>
+ const typename pointer_query_columns< ::brep::build_package, id_pgsql, A >::id_class_::version_class_1_::revision_type_
+ pointer_query_columns< ::brep::build_package, id_pgsql, A >::id_class_::version_class_1_::
+ revision (A::table_name, "\"version_revision\"", 0);
+
+ template <typename A>
+ const typename pointer_query_columns< ::brep::build_package, id_pgsql, A >::id_class_::version_class_1_
+ pointer_query_columns< ::brep::build_package, id_pgsql, A >::id_class_::version;
+
+ template <typename A>
+ const typename pointer_query_columns< ::brep::build_package, id_pgsql, A >::id_class_
+ pointer_query_columns< ::brep::build_package, id_pgsql, A >::id;
+
+ template <typename A>
+ const typename pointer_query_columns< ::brep::build_package, id_pgsql, A >::version_class_::upstream_type_
+ pointer_query_columns< ::brep::build_package, id_pgsql, A >::version_class_::
+ upstream (A::table_name, "\"version_upstream\"", 0);
+
+ template <typename A>
+ const typename pointer_query_columns< ::brep::build_package, id_pgsql, A >::version_class_::release_type_
+ pointer_query_columns< ::brep::build_package, id_pgsql, A >::version_class_::
+ release (A::table_name, "\"version_release\"", 0);
+
+ template <typename A>
+ const typename pointer_query_columns< ::brep::build_package, id_pgsql, A >::version_class_
+ pointer_query_columns< ::brep::build_package, id_pgsql, A >::version;
+
+ template <typename A>
+ const typename pointer_query_columns< ::brep::build_package, id_pgsql, A >::internal_repository_class_::tenant_type_
+ pointer_query_columns< ::brep::build_package, id_pgsql, A >::internal_repository_class_::
+ tenant (A::table_name, "\"internal_repository_tenant\"", 0);
+
+ template <typename A>
+ const typename pointer_query_columns< ::brep::build_package, id_pgsql, A >::internal_repository_class_::canonical_name_type_
+ pointer_query_columns< ::brep::build_package, id_pgsql, A >::internal_repository_class_::
+ canonical_name (A::table_name, "\"internal_repository_canonical_name\"", 0);
+
+ template <typename A>
+ const typename pointer_query_columns< ::brep::build_package, id_pgsql, A >::internal_repository_class_
+ pointer_query_columns< ::brep::build_package, id_pgsql, A >::internal_repository;
+
+ template <typename A>
+ const typename pointer_query_columns< ::brep::build_package, id_pgsql, A >::buildable_type_
+ pointer_query_columns< ::brep::build_package, id_pgsql, A >::
+ buildable (A::table_name, "\"buildable\"", 0);
+
+ template <>
+ class access::object_traits_impl< ::brep::build_package, id_pgsql >:
+ public access::object_traits< ::brep::build_package >
+ {
+ public:
+ struct id_image_type
+ {
+ composite_value_traits< ::brep::package_id, id_pgsql >::image_type id_value;
+
+ std::size_t version;
+ };
+
+ struct image_type
+ {
+ // id
+ //
+ composite_value_traits< ::brep::package_id, id_pgsql >::image_type id_value;
+
+ // version
+ //
+ composite_value_traits< ::brep::upstream_version, id_pgsql >::image_type version_value;
+
+ // internal_repository
+ //
+ composite_value_traits< ::brep::repository_id, id_pgsql >::image_type internal_repository_value;
+
+ // buildable
+ //
+ bool buildable_value;
+ bool buildable_null;
+
+ std::size_t version;
+ };
+
+ struct extra_statement_cache_type;
+
+ // tests
+ //
+ struct tests_traits
+ {
+ static const char select_name[];
+ static const char insert_name[];
+ static const char delete_name[];
+
+ static const unsigned int insert_types[];
+
+ static const std::size_t id_column_count = 6UL;
+ static const std::size_t data_column_count = 14UL;
+
+ static const bool versioned = false;
+
+ static const char insert_statement[];
+ static const char select_statement[];
+ static const char delete_statement[];
+
+ typedef ::butl::small_vector< ::brep::build_test_dependency, 1 > 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 pgsql::container_statements< tests_traits > statements_type;
+
+ struct data_image_type
+ {
+ // index
+ //
+ long long index_value;
+ bool index_null;
+
+ // value
+ //
+ composite_value_traits< value_type, id_pgsql >::image_type value_value;
+
+ std::size_t version;
+ };
+
+ static void
+ bind (pgsql::bind*,
+ const pgsql::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
+ erase (statements_type&);
+ };
+
+ // builds
+ //
+ struct builds_traits
+ {
+ static const char select_name[];
+ static const char insert_name[];
+ static const char delete_name[];
+
+ static const unsigned int insert_types[];
+
+ static const std::size_t id_column_count = 6UL;
+ static const std::size_t data_column_count = 9UL;
+
+ static const bool versioned = false;
+
+ static const char insert_statement[];
+ static const char select_statement[];
+ static const char delete_statement[];
+
+ typedef ::brep::build_class_exprs 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 pgsql::container_statements< builds_traits > statements_type;
+
+ struct data_image_type
+ {
+ // index
+ //
+ long long index_value;
+ bool index_null;
+
+ // value
+ //
+ composite_value_traits< value_type, id_pgsql >::image_type value_value;
+
+ std::size_t version;
+ };
+
+ static void
+ bind (pgsql::bind*,
+ const pgsql::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
+ erase (statements_type&);
+ };
+
+ // constraints
+ //
+ struct constraints_traits
+ {
+ static const char select_name[];
+ static const char insert_name[];
+ static const char delete_name[];
+
+ static const unsigned int insert_types[];
+
+ static const std::size_t id_column_count = 6UL;
+ static const std::size_t data_column_count = 11UL;
+
+ static const bool versioned = false;
+
+ static const char insert_statement[];
+ static const char select_statement[];
+ static const char delete_statement[];
+
+ typedef ::brep::build_constraints 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 pgsql::container_statements< constraints_traits > statements_type;
+
+ struct data_image_type
+ {
+ // index
+ //
+ long long index_value;
+ bool index_null;
+
+ // value
+ //
+ composite_value_traits< value_type, id_pgsql >::image_type value_value;
+
+ std::size_t version;
+ };
+
+ static void
+ bind (pgsql::bind*,
+ const pgsql::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
+ erase (statements_type&);
+ };
+
+ struct internal_repository_tag;
+
+ using object_traits<object_type>::id;
+
+ static id_type
+ id (const image_type&);
+
+ static bool
+ grow (image_type&,
+ bool*);
+
+ static void
+ bind (pgsql::bind*,
+ image_type&,
+ pgsql::statement_kind);
+
+ static void
+ bind (pgsql::bind*, id_image_type&);
+
+ static bool
+ init (image_type&,
+ const object_type&,
+ pgsql::statement_kind);
+
+ static void
+ init (object_type&,
+ const image_type&,
+ database*);
+
+ static void
+ init (id_image_type&, const id_type&);
+
+ typedef pgsql::object_statements<object_type> statements_type;
+
+ typedef pgsql::query_base query_base_type;
+
+ static const std::size_t column_count = 11UL;
+ static const std::size_t id_column_count = 6UL;
+ static const std::size_t inverse_column_count = 0UL;
+ static const std::size_t readonly_column_count = 5UL;
+ 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 erase_statement[];
+ static const char query_statement[];
+ static const char erase_query_statement[];
+
+ static const char table_name[];
+
+ static void
+ persist (database&, const 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
+ 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&);
+
+ static odb::details::shared_ptr<prepared_query_impl>
+ prepare_query (connection&, const char*, const query_base_type&);
+
+ static odb::details::shared_ptr<result_impl>
+ execute_query (prepared_query_impl&);
+
+ static const char persist_statement_name[];
+ static const char find_statement_name[];
+ static const char erase_statement_name[];
+ static const char query_statement_name[];
+ static const char erase_query_statement_name[];
+
+ static const unsigned int persist_statement_types[];
+ static const unsigned int find_statement_types[];
+
+ public:
+ static bool
+ find_ (statements_type&,
+ const id_type*);
+
+ static void
+ load_ (statements_type&,
+ object_type&,
+ bool reload);
+ };
+
+ template <>
+ class access::object_traits_impl< ::brep::build_package, id_common >:
+ public access::object_traits_impl< ::brep::build_package, id_pgsql >
+ {
+ };
+
+ // buildable_package
+ //
+ template <>
+ class access::view_traits_impl< ::brep::buildable_package, id_pgsql >:
+ public access::view_traits< ::brep::buildable_package >
+ {
+ public:
+ struct image_type
+ {
+ // id
+ //
+ composite_value_traits< ::brep::package_id, id_pgsql >::image_type id_value;
+
+ // version
+ //
+ composite_value_traits< ::brep::upstream_version, id_pgsql >::image_type version_value;
+
+ // archived
+ //
+ bool archived_value;
+ bool archived_null;
+
+ std::size_t version;
+ };
+
+ typedef pgsql::view_statements<view_type> statements_type;
+
+ typedef pgsql::query_base query_base_type;
+ struct query_columns;
+
+ static const bool versioned = false;
+
+ static bool
+ grow (image_type&,
+ bool*);
+
+ static void
+ bind (pgsql::bind*,
+ image_type&);
+
+ static void
+ init (view_type&,
+ const image_type&,
+ database*);
+
+ static const std::size_t column_count = 9UL;
+
+ static query_base_type
+ query_statement (const query_base_type&);
+
+ static result<view_type>
+ query (database&, const query_base_type&);
+
+ static odb::details::shared_ptr<prepared_query_impl>
+ prepare_query (connection&, const char*, const query_base_type&);
+
+ static odb::details::shared_ptr<result_impl>
+ execute_query (prepared_query_impl&);
+
+ static const char query_statement_name[];
+ };
+
+ template <>
+ class access::view_traits_impl< ::brep::buildable_package, id_common >:
+ public access::view_traits_impl< ::brep::buildable_package, id_pgsql >
+ {
+ };
+
+ // buildable_package_count
+ //
+ template <>
+ class access::view_traits_impl< ::brep::buildable_package_count, id_pgsql >:
+ public access::view_traits< ::brep::buildable_package_count >
+ {
+ public:
+ struct image_type
+ {
+ // result
+ //
+ long long result_value;
+ bool result_null;
+
+ std::size_t version;
+ };
+
+ typedef pgsql::view_statements<view_type> statements_type;
+
+ typedef pgsql::query_base query_base_type;
+ struct query_columns;
+
+ static const bool versioned = false;
+
+ static bool
+ grow (image_type&,
+ bool*);
+
+ static void
+ bind (pgsql::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&);
+
+ static odb::details::shared_ptr<prepared_query_impl>
+ prepare_query (connection&, const char*, const query_base_type&);
+
+ static odb::details::shared_ptr<result_impl>
+ execute_query (prepared_query_impl&);
+
+ static const char query_statement_name[];
+ };
+
+ template <>
+ class access::view_traits_impl< ::brep::buildable_package_count, id_common >:
+ public access::view_traits_impl< ::brep::buildable_package_count, id_pgsql >
+ {
+ };
+
+ // build_tenant
+ //
+ // build_repository
+ //
+ // build_package
+ //
+ template <>
+ struct alias_traits<
+ ::brep::build_repository,
+ id_pgsql,
+ access::object_traits_impl< ::brep::build_package, id_pgsql >::internal_repository_tag>
+ {
+ static const char table_name[];
+ };
+
+ template <>
+ struct query_columns_base< ::brep::build_package, id_pgsql >
+ {
+ // internal_repository
+ //
+ typedef
+ odb::alias_traits<
+ ::brep::build_repository,
+ id_pgsql,
+ access::object_traits_impl< ::brep::build_package, id_pgsql >::internal_repository_tag>
+ internal_repository_alias_;
+ };
+
+ template <typename A>
+ struct query_columns< ::brep::build_package, id_pgsql, A >:
+ query_columns_base< ::brep::build_package, id_pgsql >
+ {
+ // id
+ //
+ struct id_class_
+ {
+ id_class_ ()
+ {
+ }
+
+ // tenant
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ tenant_type_;
+
+ static const tenant_type_ tenant;
+
+ // name
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::bpkg::package_name,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ name_type_;
+
+ static const name_type_ name;
+
+ // version
+ //
+ struct version_class_1_
+ {
+ version_class_1_ ()
+ {
+ }
+
+ // epoch
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::uint16_t,
+ pgsql::id_integer >::query_type,
+ pgsql::id_integer >
+ epoch_type_;
+
+ static const epoch_type_ epoch;
+
+ // canonical_upstream
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ canonical_upstream_type_;
+
+ static const canonical_upstream_type_ canonical_upstream;
+
+ // canonical_release
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ canonical_release_type_;
+
+ static const canonical_release_type_ canonical_release;
+
+ // revision
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::uint16_t,
+ pgsql::id_integer >::query_type,
+ pgsql::id_integer >
+ revision_type_;
+
+ static const revision_type_ revision;
+ };
+
+ static const version_class_1_ version;
+ };
+
+ static const id_class_ id;
+
+ // version
+ //
+ struct version_class_
+ {
+ version_class_ ()
+ {
+ }
+
+ // upstream
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ upstream_type_;
+
+ static const upstream_type_ upstream;
+
+ // release
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::basic_string< char >,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ release_type_;
+
+ static const release_type_ release;
+ };
+
+ static const version_class_ version;
+
+ // internal_repository
+ //
+ struct internal_repository_column_class_
+ {
+ internal_repository_column_class_ ()
+ {
+ }
+
+ // tenant
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ tenant_type_;
+
+ static const tenant_type_ tenant;
+
+ // canonical_name
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::query_type,
+ pgsql::id_string >
+ canonical_name_type_;
+
+ static const canonical_name_type_ canonical_name;
+ };
+
+ typedef
+ odb::query_pointer<
+ odb::pointer_query_columns<
+ ::brep::build_repository,
+ id_pgsql,
+ internal_repository_alias_ > >
+ internal_repository_pointer_type_;
+
+ struct internal_repository_type_: internal_repository_pointer_type_, internal_repository_column_class_
+ {
+ internal_repository_type_ ()
+ {
+ }
+ };
+
+ static const internal_repository_type_ internal_repository;
+
+ // buildable
+ //
+ typedef
+ pgsql::query_column<
+ pgsql::value_traits<
+ bool,
+ pgsql::id_boolean >::query_type,
+ pgsql::id_boolean >
+ buildable_type_;
+
+ static const buildable_type_ buildable;
+ };
+
+ template <typename A>
+ const typename query_columns< ::brep::build_package, id_pgsql, A >::id_class_::tenant_type_
+ query_columns< ::brep::build_package, id_pgsql, A >::id_class_::
+ tenant (A::table_name, "\"tenant\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build_package, id_pgsql, A >::id_class_::name_type_
+ query_columns< ::brep::build_package, id_pgsql, A >::id_class_::
+ name (A::table_name, "\"name\"", "(?)::CITEXT");
+
+ template <typename A>
+ const typename query_columns< ::brep::build_package, id_pgsql, A >::id_class_::version_class_1_::epoch_type_
+ query_columns< ::brep::build_package, id_pgsql, A >::id_class_::version_class_1_::
+ epoch (A::table_name, "\"version_epoch\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build_package, id_pgsql, A >::id_class_::version_class_1_::canonical_upstream_type_
+ query_columns< ::brep::build_package, id_pgsql, A >::id_class_::version_class_1_::
+ canonical_upstream (A::table_name, "\"version_canonical_upstream\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build_package, id_pgsql, A >::id_class_::version_class_1_::canonical_release_type_
+ query_columns< ::brep::build_package, id_pgsql, A >::id_class_::version_class_1_::
+ canonical_release (A::table_name, "\"version_canonical_release\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build_package, id_pgsql, A >::id_class_::version_class_1_::revision_type_
+ query_columns< ::brep::build_package, id_pgsql, A >::id_class_::version_class_1_::
+ revision (A::table_name, "\"version_revision\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build_package, id_pgsql, A >::id_class_::version_class_1_
+ query_columns< ::brep::build_package, id_pgsql, A >::id_class_::version;
+
+ template <typename A>
+ const typename query_columns< ::brep::build_package, id_pgsql, A >::id_class_
+ query_columns< ::brep::build_package, id_pgsql, A >::id;
+
+ template <typename A>
+ const typename query_columns< ::brep::build_package, id_pgsql, A >::version_class_::upstream_type_
+ query_columns< ::brep::build_package, id_pgsql, A >::version_class_::
+ upstream (A::table_name, "\"version_upstream\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build_package, id_pgsql, A >::version_class_::release_type_
+ query_columns< ::brep::build_package, id_pgsql, A >::version_class_::
+ release (A::table_name, "\"version_release\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build_package, id_pgsql, A >::version_class_
+ query_columns< ::brep::build_package, id_pgsql, A >::version;
+
+ template <typename A>
+ const typename query_columns< ::brep::build_package, id_pgsql, A >::internal_repository_column_class_::tenant_type_
+ query_columns< ::brep::build_package, id_pgsql, A >::internal_repository_column_class_::
+ tenant (A::table_name, "\"internal_repository_tenant\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build_package, id_pgsql, A >::internal_repository_column_class_::canonical_name_type_
+ query_columns< ::brep::build_package, id_pgsql, A >::internal_repository_column_class_::
+ canonical_name (A::table_name, "\"internal_repository_canonical_name\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::brep::build_package, id_pgsql, A >::internal_repository_type_
+ query_columns< ::brep::build_package, id_pgsql, A >::internal_repository;
+
+ template <typename A>
+ const typename query_columns< ::brep::build_package, id_pgsql, A >::buildable_type_
+ query_columns< ::brep::build_package, id_pgsql, A >::
+ buildable (A::table_name, "\"buildable\"", 0);
+
+ // buildable_package
+ //
+ struct access::view_traits_impl< ::brep::buildable_package, id_pgsql >::query_columns
+ {
+ // build_package
+ //
+ typedef
+ odb::pointer_query_columns<
+ ::brep::build_package,
+ id_pgsql,
+ odb::access::object_traits_impl< ::brep::build_package, id_pgsql > >
+ build_package;
+
+ // build_repository
+ //
+ typedef
+ odb::pointer_query_columns<
+ ::brep::build_repository,
+ id_pgsql,
+ odb::access::object_traits_impl< ::brep::build_repository, id_pgsql > >
+ build_repository;
+
+ // build_tenant
+ //
+ typedef
+ odb::pointer_query_columns<
+ ::brep::build_tenant,
+ id_pgsql,
+ odb::access::object_traits_impl< ::brep::build_tenant, id_pgsql > >
+ build_tenant;
+ };
+
+ // buildable_package_count
+ //
+ struct access::view_traits_impl< ::brep::buildable_package_count, id_pgsql >::query_columns
+ {
+ // build_package
+ //
+ typedef
+ odb::pointer_query_columns<
+ ::brep::build_package,
+ id_pgsql,
+ odb::access::object_traits_impl< ::brep::build_package, id_pgsql > >
+ build_package;
+
+ // build_repository
+ //
+ typedef
+ odb::pointer_query_columns<
+ ::brep::build_repository,
+ id_pgsql,
+ odb::access::object_traits_impl< ::brep::build_repository, id_pgsql > >
+ build_repository;
+
+ // build_tenant
+ //
+ typedef
+ odb::pointer_query_columns<
+ ::brep::build_tenant,
+ id_pgsql,
+ odb::access::object_traits_impl< ::brep::build_tenant, id_pgsql > >
+ build_tenant;
+ };
+}
+
+#include <libbrep/build-package-odb.ixx>
+
+#include <odb/post.hxx>
+
+#endif // LIBBREP_BUILD_PACKAGE_ODB_HXX
diff --git a/libbrep/build-package-odb.ixx b/libbrep/build-package-odb.ixx
new file mode 100644
index 0000000..b2c2f40
--- /dev/null
+++ b/libbrep/build-package-odb.ixx
@@ -0,0 +1,211 @@
+// -*- C++ -*-
+//
+// This file was generated by ODB, object-relational mapping (ORM)
+// compiler for C++.
+//
+
+namespace odb
+{
+ // build_tenant
+ //
+
+ inline
+ access::object_traits< ::brep::build_tenant >::id_type
+ access::object_traits< ::brep::build_tenant >::
+ id (const object_type& o)
+ {
+ return o.id;
+ }
+
+ inline
+ void access::object_traits< ::brep::build_tenant >::
+ callback (database& db, object_type& x, callback_event e)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+ ODB_POTENTIALLY_UNUSED (x);
+ ODB_POTENTIALLY_UNUSED (e);
+ }
+
+ inline
+ void access::object_traits< ::brep::build_tenant >::
+ callback (database& db, const object_type& x, callback_event e)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+ ODB_POTENTIALLY_UNUSED (x);
+ ODB_POTENTIALLY_UNUSED (e);
+ }
+
+ // build_repository
+ //
+
+ inline
+ access::object_traits< ::brep::build_repository >::id_type
+ access::object_traits< ::brep::build_repository >::
+ id (const object_type& o)
+ {
+ return o.id;
+ }
+
+ inline
+ void access::object_traits< ::brep::build_repository >::
+ callback (database& db, object_type& x, callback_event e)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+ ODB_POTENTIALLY_UNUSED (x);
+ ODB_POTENTIALLY_UNUSED (e);
+ }
+
+ inline
+ void access::object_traits< ::brep::build_repository >::
+ callback (database& db, const object_type& x, callback_event e)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+ ODB_POTENTIALLY_UNUSED (x);
+ ODB_POTENTIALLY_UNUSED (e);
+ }
+
+ // build_package
+ //
+
+ inline
+ access::object_traits< ::brep::build_package >::id_type
+ access::object_traits< ::brep::build_package >::
+ id (const object_type& o)
+ {
+ return o.id;
+ }
+
+ inline
+ void access::object_traits< ::brep::build_package >::
+ callback (database& db, object_type& x, callback_event e)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+ ODB_POTENTIALLY_UNUSED (x);
+ ODB_POTENTIALLY_UNUSED (e);
+ }
+
+ inline
+ void access::object_traits< ::brep::build_package >::
+ callback (database& db, const object_type& x, callback_event e)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+ ODB_POTENTIALLY_UNUSED (x);
+ ODB_POTENTIALLY_UNUSED (e);
+ }
+
+ // buildable_package
+ //
+
+ inline
+ void access::view_traits< ::brep::buildable_package >::
+ callback (database& db, view_type& x, callback_event e)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+ ODB_POTENTIALLY_UNUSED (x);
+ ODB_POTENTIALLY_UNUSED (e);
+ }
+
+ // buildable_package_count
+ //
+
+ inline
+ void access::view_traits< ::brep::buildable_package_count >::
+ callback (database& db, view_type& x, callback_event e)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+ ODB_POTENTIALLY_UNUSED (x);
+ ODB_POTENTIALLY_UNUSED (e);
+ }
+}
+
+namespace odb
+{
+ // build_tenant
+ //
+
+ inline
+ void access::object_traits_impl< ::brep::build_tenant, id_pgsql >::
+ erase (database& db, const object_type& obj)
+ {
+ callback (db, obj, callback_event::pre_erase);
+ erase (db, id (obj));
+ callback (db, obj, callback_event::post_erase);
+ }
+
+ inline
+ void access::object_traits_impl< ::brep::build_tenant, id_pgsql >::
+ load_ (statements_type& sts,
+ object_type& obj,
+ bool)
+ {
+ ODB_POTENTIALLY_UNUSED (sts);
+ ODB_POTENTIALLY_UNUSED (obj);
+ }
+
+ // build_repository
+ //
+
+ inline
+ void access::object_traits_impl< ::brep::build_repository, id_pgsql >::
+ erase (database& db, const object_type& obj)
+ {
+ callback (db, obj, callback_event::pre_erase);
+ erase (db, id (obj));
+ callback (db, obj, callback_event::post_erase);
+ }
+
+ inline
+ void access::object_traits_impl< ::brep::build_repository, id_pgsql >::
+ load_ (statements_type& sts,
+ object_type& obj,
+ bool)
+ {
+ ODB_POTENTIALLY_UNUSED (sts);
+ ODB_POTENTIALLY_UNUSED (obj);
+ }
+
+ // build_test_dependency
+ //
+
+ inline
+ bool access::composite_value_traits< ::brep::build_test_dependency, id_pgsql >::
+ get_null (const image_type& i)
+ {
+ bool r (true);
+ r = r && i.name_null;
+ r = r && composite_value_traits< ::brep::package_id, id_pgsql >::get_null (i.package_value);
+ return r;
+ }
+
+ inline
+ void access::composite_value_traits< ::brep::build_test_dependency, id_pgsql >::
+ set_null (image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ i.name_null = true;
+ composite_value_traits< ::brep::package_id, id_pgsql >::set_null (i.package_value, sk);
+ }
+
+ // build_package
+ //
+
+ inline
+ void access::object_traits_impl< ::brep::build_package, id_pgsql >::
+ erase (database& db, const object_type& obj)
+ {
+ callback (db, obj, callback_event::pre_erase);
+ erase (db, id (obj));
+ callback (db, obj, callback_event::post_erase);
+ }
+
+ // buildable_package
+ //
+
+ // buildable_package_count
+ //
+}
+
diff --git a/libbrep/build.sql b/libbrep/build.sql
new file mode 100644
index 0000000..2d62823
--- /dev/null
+++ b/libbrep/build.sql
@@ -0,0 +1,158 @@
+/* This file was generated by ODB, object-relational mapping (ORM)
+ * compiler for C++.
+ */
+
+DROP TABLE IF EXISTS "build_delay" CASCADE;
+
+DROP TABLE IF EXISTS "build_results" CASCADE;
+
+DROP TABLE IF EXISTS "build" CASCADE;
+
+DROP TABLE IF EXISTS "schema_version";
+
+CREATE TABLE "build" (
+ "package_tenant" TEXT NOT NULL,
+ "package_name" CITEXT NOT NULL,
+ "package_version_epoch" INTEGER NOT NULL,
+ "package_version_canonical_upstream" TEXT NOT NULL,
+ "package_version_canonical_release" TEXT NOT NULL COLLATE "C",
+ "package_version_revision" INTEGER NOT NULL,
+ "configuration" TEXT NOT NULL,
+ "toolchain_name" TEXT NOT NULL,
+ "toolchain_version_epoch" INTEGER NOT NULL,
+ "toolchain_version_canonical_upstream" TEXT NOT NULL,
+ "toolchain_version_canonical_release" TEXT NOT NULL COLLATE "C",
+ "toolchain_version_revision" INTEGER NOT NULL,
+ "package_version_upstream" TEXT NOT NULL,
+ "package_version_release" TEXT NULL,
+ "toolchain_version_upstream" TEXT NOT NULL,
+ "toolchain_version_release" TEXT NULL,
+ "state" TEXT NOT NULL,
+ "timestamp" BIGINT NOT NULL,
+ "force" TEXT NOT NULL,
+ "status" TEXT NULL,
+ "completion_timestamp" BIGINT NOT NULL DEFAULT 0,
+ "agent_fingerprint" TEXT NULL,
+ "agent_challenge" TEXT NULL,
+ "machine" TEXT NOT NULL,
+ "machine_summary" TEXT NOT NULL,
+ "target" TEXT NOT NULL,
+ PRIMARY KEY ("package_tenant",
+ "package_name",
+ "package_version_epoch",
+ "package_version_canonical_upstream",
+ "package_version_canonical_release",
+ "package_version_revision",
+ "configuration",
+ "toolchain_name",
+ "toolchain_version_epoch",
+ "toolchain_version_canonical_upstream",
+ "toolchain_version_canonical_release",
+ "toolchain_version_revision"));
+
+CREATE INDEX "build_timestamp_i"
+ ON "build" ("timestamp");
+
+CREATE TABLE "build_results" (
+ "package_tenant" TEXT NOT NULL,
+ "package_name" CITEXT NOT NULL,
+ "package_version_epoch" INTEGER NOT NULL,
+ "package_version_canonical_upstream" TEXT NOT NULL,
+ "package_version_canonical_release" TEXT NOT NULL COLLATE "C",
+ "package_version_revision" INTEGER NOT NULL,
+ "configuration" TEXT NOT NULL,
+ "toolchain_name" TEXT NOT NULL,
+ "toolchain_version_epoch" INTEGER NOT NULL,
+ "toolchain_version_canonical_upstream" TEXT NOT NULL,
+ "toolchain_version_canonical_release" TEXT NOT NULL COLLATE "C",
+ "toolchain_version_revision" INTEGER NOT NULL,
+ "index" BIGINT NOT NULL,
+ "operation" TEXT NOT NULL,
+ "status" TEXT NOT NULL,
+ "log" TEXT NOT NULL,
+ CONSTRAINT "object_id_fk"
+ FOREIGN KEY ("package_tenant",
+ "package_name",
+ "package_version_epoch",
+ "package_version_canonical_upstream",
+ "package_version_canonical_release",
+ "package_version_revision",
+ "configuration",
+ "toolchain_name",
+ "toolchain_version_epoch",
+ "toolchain_version_canonical_upstream",
+ "toolchain_version_canonical_release",
+ "toolchain_version_revision")
+ REFERENCES "build" ("package_tenant",
+ "package_name",
+ "package_version_epoch",
+ "package_version_canonical_upstream",
+ "package_version_canonical_release",
+ "package_version_revision",
+ "configuration",
+ "toolchain_name",
+ "toolchain_version_epoch",
+ "toolchain_version_canonical_upstream",
+ "toolchain_version_canonical_release",
+ "toolchain_version_revision")
+ ON DELETE CASCADE);
+
+CREATE INDEX "build_results_object_id_i"
+ ON "build_results" (
+ "package_tenant",
+ "package_name",
+ "package_version_epoch",
+ "package_version_canonical_upstream",
+ "package_version_canonical_release",
+ "package_version_revision",
+ "configuration",
+ "toolchain_name",
+ "toolchain_version_epoch",
+ "toolchain_version_canonical_upstream",
+ "toolchain_version_canonical_release",
+ "toolchain_version_revision");
+
+CREATE INDEX "build_results_index_i"
+ ON "build_results" ("index");
+
+CREATE TABLE "build_delay" (
+ "package_tenant" TEXT NOT NULL,
+ "package_name" CITEXT NOT NULL,
+ "package_version_epoch" INTEGER NOT NULL,
+ "package_version_canonical_upstream" TEXT NOT NULL,
+ "package_version_canonical_release" TEXT NOT NULL COLLATE "C",
+ "package_version_revision" INTEGER NOT NULL,
+ "configuration" TEXT NOT NULL,
+ "toolchain_name" TEXT NOT NULL,
+ "toolchain_version_epoch" INTEGER NOT NULL,
+ "toolchain_version_canonical_upstream" TEXT NOT NULL,
+ "toolchain_version_canonical_release" TEXT NOT NULL COLLATE "C",
+ "toolchain_version_revision" INTEGER NOT NULL,
+ "package_version_upstream" TEXT NOT NULL,
+ "package_version_release" TEXT NULL,
+ "toolchain_version_upstream" TEXT NOT NULL,
+ "toolchain_version_release" TEXT NULL,
+ "report_timestamp" BIGINT NOT NULL,
+ "package_timestamp" BIGINT NOT NULL,
+ PRIMARY KEY ("package_tenant",
+ "package_name",
+ "package_version_epoch",
+ "package_version_canonical_upstream",
+ "package_version_canonical_release",
+ "package_version_revision",
+ "configuration",
+ "toolchain_name",
+ "toolchain_version_epoch",
+ "toolchain_version_canonical_upstream",
+ "toolchain_version_canonical_release",
+ "toolchain_version_revision"));
+
+CREATE TABLE "schema_version" (
+ "name" TEXT NOT NULL PRIMARY KEY,
+ "version" BIGINT NOT NULL,
+ "migration" BOOLEAN NOT NULL);
+
+INSERT INTO "schema_version" (
+ "name", "version", "migration")
+ VALUES ('build', 12, FALSE);
+
diff --git a/libbrep/common-odb.cxx b/libbrep/common-odb.cxx
new file mode 100644
index 0000000..261b29b
--- /dev/null
+++ b/libbrep/common-odb.cxx
@@ -0,0 +1,1744 @@
+// -*- C++ -*-
+//
+// This file was generated by ODB, object-relational mapping (ORM)
+// compiler for C++.
+//
+
+#include <odb/pre.hxx>
+
+#include <libbrep/common-odb.hxx>
+
+#include <cassert>
+#include <cstring> // std::memcpy
+
+
+#include <odb/pgsql/traits.hxx>
+#include <odb/pgsql/database.hxx>
+#include <odb/pgsql/transaction.hxx>
+#include <odb/pgsql/connection.hxx>
+#include <odb/pgsql/statement.hxx>
+#include <odb/pgsql/statement-cache.hxx>
+#include <odb/pgsql/container-statements.hxx>
+#include <odb/pgsql/exceptions.hxx>
+
+namespace odb
+{
+ // _version
+ //
+
+ bool access::composite_value_traits< ::brep::_version, id_pgsql >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // epoch
+ //
+ t[0UL] = 0;
+
+ // canonical_upstream
+ //
+ if (t[1UL])
+ {
+ i.canonical_upstream_value.capacity (i.canonical_upstream_size);
+ grew = true;
+ }
+
+ // canonical_release
+ //
+ if (t[2UL])
+ {
+ i.canonical_release_value.capacity (i.canonical_release_size);
+ grew = true;
+ }
+
+ // revision
+ //
+ t[3UL] = 0;
+
+ // upstream
+ //
+ if (t[4UL])
+ {
+ i.upstream_value.capacity (i.upstream_size);
+ grew = true;
+ }
+
+ // release
+ //
+ if (t[5UL])
+ {
+ i.release_value.capacity (i.release_size);
+ grew = true;
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::brep::_version, id_pgsql >::
+ bind (pgsql::bind* b,
+ image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (b);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ std::size_t n (0);
+ ODB_POTENTIALLY_UNUSED (n);
+
+ // epoch
+ //
+ b[n].type = pgsql::bind::integer;
+ b[n].buffer = &i.epoch_value;
+ b[n].is_null = &i.epoch_null;
+ n++;
+
+ // canonical_upstream
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.canonical_upstream_value.data ();
+ b[n].capacity = i.canonical_upstream_value.capacity ();
+ b[n].size = &i.canonical_upstream_size;
+ b[n].is_null = &i.canonical_upstream_null;
+ n++;
+
+ // canonical_release
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.canonical_release_value.data ();
+ b[n].capacity = i.canonical_release_value.capacity ();
+ b[n].size = &i.canonical_release_size;
+ b[n].is_null = &i.canonical_release_null;
+ n++;
+
+ // revision
+ //
+ b[n].type = pgsql::bind::integer;
+ b[n].buffer = &i.revision_value;
+ b[n].is_null = &i.revision_null;
+ n++;
+
+ // upstream
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.upstream_value.data ();
+ b[n].capacity = i.upstream_value.capacity ();
+ b[n].size = &i.upstream_size;
+ b[n].is_null = &i.upstream_null;
+ n++;
+
+ // release
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.release_value.data ();
+ b[n].capacity = i.release_value.capacity ();
+ b[n].size = &i.release_size;
+ b[n].is_null = &i.release_null;
+ n++;
+ }
+
+ bool access::composite_value_traits< ::brep::_version, id_pgsql >::
+ init (image_type& i,
+ const value_type& o,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ bool grew (false);
+
+ // epoch
+ //
+ {
+ ::uint16_t const& v =
+ o.epoch;
+
+ bool is_null (false);
+ pgsql::value_traits<
+ ::uint16_t,
+ pgsql::id_integer >::set_image (
+ i.epoch_value, is_null, v);
+ i.epoch_null = is_null;
+ }
+
+ // canonical_upstream
+ //
+ {
+ ::std::string const& v =
+ o.canonical_upstream;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.canonical_upstream_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.canonical_upstream_value,
+ size,
+ is_null,
+ v);
+ i.canonical_upstream_null = is_null;
+ i.canonical_upstream_size = size;
+ grew = grew || (cap != i.canonical_upstream_value.capacity ());
+ }
+
+ // canonical_release
+ //
+ {
+ ::std::string const& v =
+ o.canonical_release;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.canonical_release_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.canonical_release_value,
+ size,
+ is_null,
+ v);
+ i.canonical_release_null = is_null;
+ i.canonical_release_size = size;
+ grew = grew || (cap != i.canonical_release_value.capacity ());
+ }
+
+ // revision
+ //
+ {
+ ::butl::optional< short unsigned int > const& v =
+ o.revision;
+
+ bool is_null (true);
+ pgsql::value_traits<
+ ::butl::optional< short unsigned int >,
+ pgsql::id_integer >::set_image (
+ i.revision_value, is_null, v);
+ i.revision_null = is_null;
+ }
+
+ // upstream
+ //
+ {
+ ::std::string const& v =
+ o.upstream;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.upstream_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.upstream_value,
+ size,
+ is_null,
+ v);
+ i.upstream_null = is_null;
+ i.upstream_size = size;
+ grew = grew || (cap != i.upstream_value.capacity ());
+ }
+
+ // release
+ //
+ {
+ ::butl::optional< ::std::basic_string< char > > const& v =
+ o.release;
+
+ bool is_null (true);
+ std::size_t size (0);
+ std::size_t cap (i.release_value.capacity ());
+ pgsql::value_traits<
+ ::butl::optional< ::std::basic_string< char > >,
+ pgsql::id_string >::set_image (
+ i.release_value,
+ size,
+ is_null,
+ v);
+ i.release_null = is_null;
+ i.release_size = size;
+ grew = grew || (cap != i.release_value.capacity ());
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::brep::_version, id_pgsql >::
+ init (value_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // epoch
+ //
+ {
+ ::uint16_t& v =
+ o.epoch;
+
+ pgsql::value_traits<
+ ::uint16_t,
+ pgsql::id_integer >::set_value (
+ v,
+ i.epoch_value,
+ i.epoch_null);
+ }
+
+ // canonical_upstream
+ //
+ {
+ ::std::string& v =
+ o.canonical_upstream;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.canonical_upstream_value,
+ i.canonical_upstream_size,
+ i.canonical_upstream_null);
+ }
+
+ // canonical_release
+ //
+ {
+ ::std::string& v =
+ o.canonical_release;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.canonical_release_value,
+ i.canonical_release_size,
+ i.canonical_release_null);
+ }
+
+ // revision
+ //
+ {
+ ::butl::optional< short unsigned int >& v =
+ o.revision;
+
+ pgsql::value_traits<
+ ::butl::optional< short unsigned int >,
+ pgsql::id_integer >::set_value (
+ v,
+ i.revision_value,
+ i.revision_null);
+ }
+
+ // upstream
+ //
+ {
+ ::std::string& v =
+ o.upstream;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.upstream_value,
+ i.upstream_size,
+ i.upstream_null);
+ }
+
+ // release
+ //
+ {
+ ::butl::optional< ::std::basic_string< char > >& v =
+ o.release;
+
+ pgsql::value_traits<
+ ::butl::optional< ::std::basic_string< char > >,
+ pgsql::id_string >::set_value (
+ v,
+ i.release_value,
+ i.release_size,
+ i.release_null);
+ }
+ }
+
+ // build_constraint
+ //
+
+ bool access::composite_value_traits< ::bpkg::build_constraint, id_pgsql >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // exclusion
+ //
+ t[0UL] = 0;
+
+ // config
+ //
+ if (t[1UL])
+ {
+ i.config_value.capacity (i.config_size);
+ grew = true;
+ }
+
+ // target
+ //
+ if (t[2UL])
+ {
+ i.target_value.capacity (i.target_size);
+ grew = true;
+ }
+
+ // comment
+ //
+ if (t[3UL])
+ {
+ i.comment_value.capacity (i.comment_size);
+ grew = true;
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::bpkg::build_constraint, id_pgsql >::
+ bind (pgsql::bind* b,
+ image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (b);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ std::size_t n (0);
+ ODB_POTENTIALLY_UNUSED (n);
+
+ // exclusion
+ //
+ b[n].type = pgsql::bind::boolean_;
+ b[n].buffer = &i.exclusion_value;
+ b[n].is_null = &i.exclusion_null;
+ n++;
+
+ // config
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.config_value.data ();
+ b[n].capacity = i.config_value.capacity ();
+ b[n].size = &i.config_size;
+ b[n].is_null = &i.config_null;
+ n++;
+
+ // target
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.target_value.data ();
+ b[n].capacity = i.target_value.capacity ();
+ b[n].size = &i.target_size;
+ b[n].is_null = &i.target_null;
+ n++;
+
+ // comment
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.comment_value.data ();
+ b[n].capacity = i.comment_value.capacity ();
+ b[n].size = &i.comment_size;
+ b[n].is_null = &i.comment_null;
+ n++;
+ }
+
+ bool access::composite_value_traits< ::bpkg::build_constraint, id_pgsql >::
+ init (image_type& i,
+ const value_type& o,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ bool grew (false);
+
+ // exclusion
+ //
+ {
+ bool const& v =
+ o.exclusion;
+
+ bool is_null (false);
+ pgsql::value_traits<
+ bool,
+ pgsql::id_boolean >::set_image (
+ i.exclusion_value, is_null, v);
+ i.exclusion_null = is_null;
+ }
+
+ // config
+ //
+ {
+ ::std::string const& v =
+ o.config;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.config_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.config_value,
+ size,
+ is_null,
+ v);
+ i.config_null = is_null;
+ i.config_size = size;
+ grew = grew || (cap != i.config_value.capacity ());
+ }
+
+ // target
+ //
+ {
+ ::butl::optional< ::std::basic_string< char > > const& v =
+ o.target;
+
+ bool is_null (true);
+ std::size_t size (0);
+ std::size_t cap (i.target_value.capacity ());
+ pgsql::value_traits<
+ ::butl::optional< ::std::basic_string< char > >,
+ pgsql::id_string >::set_image (
+ i.target_value,
+ size,
+ is_null,
+ v);
+ i.target_null = is_null;
+ i.target_size = size;
+ grew = grew || (cap != i.target_value.capacity ());
+ }
+
+ // comment
+ //
+ {
+ ::std::string const& v =
+ o.comment;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.comment_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.comment_value,
+ size,
+ is_null,
+ v);
+ i.comment_null = is_null;
+ i.comment_size = size;
+ grew = grew || (cap != i.comment_value.capacity ());
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::bpkg::build_constraint, id_pgsql >::
+ init (value_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // exclusion
+ //
+ {
+ bool& v =
+ o.exclusion;
+
+ pgsql::value_traits<
+ bool,
+ pgsql::id_boolean >::set_value (
+ v,
+ i.exclusion_value,
+ i.exclusion_null);
+ }
+
+ // config
+ //
+ {
+ ::std::string& v =
+ o.config;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.config_value,
+ i.config_size,
+ i.config_null);
+ }
+
+ // target
+ //
+ {
+ ::butl::optional< ::std::basic_string< char > >& v =
+ o.target;
+
+ pgsql::value_traits<
+ ::butl::optional< ::std::basic_string< char > >,
+ pgsql::id_string >::set_value (
+ v,
+ i.target_value,
+ i.target_size,
+ i.target_null);
+ }
+
+ // comment
+ //
+ {
+ ::std::string& v =
+ o.comment;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.comment_value,
+ i.comment_size,
+ i.comment_null);
+ }
+ }
+
+ // build_class_expr
+ //
+
+ bool access::composite_value_traits< ::bpkg::build_class_expr, id_pgsql >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // expression
+ //
+ if (t[0UL])
+ {
+ i.expression_value.capacity (i.expression_size);
+ grew = true;
+ }
+
+ // comment
+ //
+ if (t[1UL])
+ {
+ i.comment_value.capacity (i.comment_size);
+ grew = true;
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::bpkg::build_class_expr, id_pgsql >::
+ bind (pgsql::bind* b,
+ image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (b);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ std::size_t n (0);
+ ODB_POTENTIALLY_UNUSED (n);
+
+ // expression
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.expression_value.data ();
+ b[n].capacity = i.expression_value.capacity ();
+ b[n].size = &i.expression_size;
+ b[n].is_null = &i.expression_null;
+ n++;
+
+ // comment
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.comment_value.data ();
+ b[n].capacity = i.comment_value.capacity ();
+ b[n].size = &i.comment_size;
+ b[n].is_null = &i.comment_null;
+ n++;
+ }
+
+ bool access::composite_value_traits< ::bpkg::build_class_expr, id_pgsql >::
+ init (image_type& i,
+ const value_type& o,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ bool grew (false);
+
+ // expression
+ //
+ {
+ // From common.hxx:316:5
+ ::std::string const& v =
+ o.string ();
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.expression_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.expression_value,
+ size,
+ is_null,
+ v);
+ i.expression_null = is_null;
+ i.expression_size = size;
+ grew = grew || (cap != i.expression_value.capacity ());
+ }
+
+ // comment
+ //
+ {
+ ::std::string const& v =
+ o.comment;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.comment_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.comment_value,
+ size,
+ is_null,
+ v);
+ i.comment_null = is_null;
+ i.comment_size = size;
+ grew = grew || (cap != i.comment_value.capacity ());
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::bpkg::build_class_expr, id_pgsql >::
+ init (value_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // expression
+ //
+ {
+ // From common.hxx:317:5
+ ::std::string v;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.expression_value,
+ i.expression_size,
+ i.expression_null);
+
+ // From common.hxx:317:5
+ o = brep::build_class_expr ((v), "");
+ }
+
+ // comment
+ //
+ {
+ ::std::string& v =
+ o.comment;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.comment_value,
+ i.comment_size,
+ i.comment_null);
+ }
+ }
+
+ // canonical_version
+ //
+
+ bool access::composite_value_traits< ::brep::canonical_version, id_pgsql >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // epoch
+ //
+ t[0UL] = 0;
+
+ // canonical_upstream
+ //
+ if (t[1UL])
+ {
+ i.canonical_upstream_value.capacity (i.canonical_upstream_size);
+ grew = true;
+ }
+
+ // canonical_release
+ //
+ if (t[2UL])
+ {
+ i.canonical_release_value.capacity (i.canonical_release_size);
+ grew = true;
+ }
+
+ // revision
+ //
+ t[3UL] = 0;
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::brep::canonical_version, id_pgsql >::
+ bind (pgsql::bind* b,
+ image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (b);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ std::size_t n (0);
+ ODB_POTENTIALLY_UNUSED (n);
+
+ // epoch
+ //
+ b[n].type = pgsql::bind::integer;
+ b[n].buffer = &i.epoch_value;
+ b[n].is_null = &i.epoch_null;
+ n++;
+
+ // canonical_upstream
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.canonical_upstream_value.data ();
+ b[n].capacity = i.canonical_upstream_value.capacity ();
+ b[n].size = &i.canonical_upstream_size;
+ b[n].is_null = &i.canonical_upstream_null;
+ n++;
+
+ // canonical_release
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.canonical_release_value.data ();
+ b[n].capacity = i.canonical_release_value.capacity ();
+ b[n].size = &i.canonical_release_size;
+ b[n].is_null = &i.canonical_release_null;
+ n++;
+
+ // revision
+ //
+ b[n].type = pgsql::bind::integer;
+ b[n].buffer = &i.revision_value;
+ b[n].is_null = &i.revision_null;
+ n++;
+ }
+
+ bool access::composite_value_traits< ::brep::canonical_version, id_pgsql >::
+ init (image_type& i,
+ const value_type& o,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ bool grew (false);
+
+ // epoch
+ //
+ {
+ ::uint16_t const& v =
+ o.epoch;
+
+ bool is_null (false);
+ pgsql::value_traits<
+ ::uint16_t,
+ pgsql::id_integer >::set_image (
+ i.epoch_value, is_null, v);
+ i.epoch_null = is_null;
+ }
+
+ // canonical_upstream
+ //
+ {
+ ::std::string const& v =
+ o.canonical_upstream;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.canonical_upstream_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.canonical_upstream_value,
+ size,
+ is_null,
+ v);
+ i.canonical_upstream_null = is_null;
+ i.canonical_upstream_size = size;
+ grew = grew || (cap != i.canonical_upstream_value.capacity ());
+ }
+
+ // canonical_release
+ //
+ {
+ ::std::string const& v =
+ o.canonical_release;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.canonical_release_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.canonical_release_value,
+ size,
+ is_null,
+ v);
+ i.canonical_release_null = is_null;
+ i.canonical_release_size = size;
+ grew = grew || (cap != i.canonical_release_value.capacity ());
+ }
+
+ // revision
+ //
+ {
+ ::uint16_t const& v =
+ o.revision;
+
+ bool is_null (false);
+ pgsql::value_traits<
+ ::uint16_t,
+ pgsql::id_integer >::set_image (
+ i.revision_value, is_null, v);
+ i.revision_null = is_null;
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::brep::canonical_version, id_pgsql >::
+ init (value_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // epoch
+ //
+ {
+ ::uint16_t& v =
+ o.epoch;
+
+ pgsql::value_traits<
+ ::uint16_t,
+ pgsql::id_integer >::set_value (
+ v,
+ i.epoch_value,
+ i.epoch_null);
+ }
+
+ // canonical_upstream
+ //
+ {
+ ::std::string& v =
+ o.canonical_upstream;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.canonical_upstream_value,
+ i.canonical_upstream_size,
+ i.canonical_upstream_null);
+ }
+
+ // canonical_release
+ //
+ {
+ ::std::string& v =
+ o.canonical_release;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.canonical_release_value,
+ i.canonical_release_size,
+ i.canonical_release_null);
+ }
+
+ // revision
+ //
+ {
+ ::uint16_t& v =
+ o.revision;
+
+ pgsql::value_traits<
+ ::uint16_t,
+ pgsql::id_integer >::set_value (
+ v,
+ i.revision_value,
+ i.revision_null);
+ }
+ }
+
+ // upstream_version
+ //
+
+ bool access::composite_value_traits< ::brep::upstream_version, id_pgsql >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // upstream_
+ //
+ if (t[0UL])
+ {
+ i.upstream_value.capacity (i.upstream_size);
+ grew = true;
+ }
+
+ // release_
+ //
+ if (t[1UL])
+ {
+ i.release_value.capacity (i.release_size);
+ grew = true;
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::brep::upstream_version, id_pgsql >::
+ bind (pgsql::bind* b,
+ image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (b);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ std::size_t n (0);
+ ODB_POTENTIALLY_UNUSED (n);
+
+ // upstream_
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.upstream_value.data ();
+ b[n].capacity = i.upstream_value.capacity ();
+ b[n].size = &i.upstream_size;
+ b[n].is_null = &i.upstream_null;
+ n++;
+
+ // release_
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.release_value.data ();
+ b[n].capacity = i.release_value.capacity ();
+ b[n].size = &i.release_size;
+ b[n].is_null = &i.release_null;
+ n++;
+ }
+
+ bool access::composite_value_traits< ::brep::upstream_version, id_pgsql >::
+ init (image_type& i,
+ const value_type& o,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ bool grew (false);
+
+ // upstream_
+ //
+ {
+ // From common.hxx:193:7
+ ::std::string const& v =
+ o.upstream;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.upstream_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.upstream_value,
+ size,
+ is_null,
+ v);
+ i.upstream_null = is_null;
+ i.upstream_size = size;
+ grew = grew || (cap != i.upstream_value.capacity ());
+ }
+
+ // release_
+ //
+ {
+ // From common.hxx:198:7
+ ::brep::optional_string const& v =
+ o.release;
+
+ bool is_null (true);
+ std::size_t size (0);
+ std::size_t cap (i.release_value.capacity ());
+ pgsql::value_traits<
+ ::brep::optional_string,
+ pgsql::id_string >::set_image (
+ i.release_value,
+ size,
+ is_null,
+ v);
+ i.release_null = is_null;
+ i.release_size = size;
+ grew = grew || (cap != i.release_value.capacity ());
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::brep::upstream_version, id_pgsql >::
+ init (value_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // upstream_
+ //
+ {
+ // From common.hxx:194:7
+ ::std::string v;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.upstream_value,
+ i.upstream_size,
+ i.upstream_null);
+
+ // From common.hxx:194:7
+ o = brep::version (0, std::move (v), std::string (), brep::nullopt, 0);
+ }
+
+ // release_
+ //
+ {
+ // From common.hxx:199:7
+ ::brep::optional_string v;
+
+ pgsql::value_traits<
+ ::brep::optional_string,
+ pgsql::id_string >::set_value (
+ v,
+ i.release_value,
+ i.release_size,
+ i.release_null);
+
+ // From common.hxx:199:7
+ o = brep::version (0, std::move (o.upstream), std::move (v), brep::nullopt, 0);
+ }
+ }
+
+ // package_id
+ //
+
+ bool access::composite_value_traits< ::brep::package_id, id_pgsql >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // tenant
+ //
+ if (t[0UL])
+ {
+ i.tenant_value.capacity (i.tenant_size);
+ grew = true;
+ }
+
+ // name
+ //
+ if (t[1UL])
+ {
+ i.name_value.capacity (i.name_size);
+ grew = true;
+ }
+
+ // version
+ //
+ if (composite_value_traits< ::brep::canonical_version, id_pgsql >::grow (
+ i.version_value, t + 2UL))
+ grew = true;
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::brep::package_id, id_pgsql >::
+ bind (pgsql::bind* b,
+ image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (b);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ std::size_t n (0);
+ ODB_POTENTIALLY_UNUSED (n);
+
+ // tenant
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.tenant_value.data ();
+ b[n].capacity = i.tenant_value.capacity ();
+ b[n].size = &i.tenant_size;
+ b[n].is_null = &i.tenant_null;
+ n++;
+
+ // name
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.name_value.data ();
+ b[n].capacity = i.name_value.capacity ();
+ b[n].size = &i.name_size;
+ b[n].is_null = &i.name_null;
+ n++;
+
+ // version
+ //
+ composite_value_traits< ::brep::canonical_version, id_pgsql >::bind (
+ b + n, i.version_value, sk);
+ n += 4UL;
+ }
+
+ bool access::composite_value_traits< ::brep::package_id, id_pgsql >::
+ init (image_type& i,
+ const value_type& o,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ bool grew (false);
+
+ // tenant
+ //
+ {
+ ::std::string const& v =
+ o.tenant;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.tenant_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.tenant_value,
+ size,
+ is_null,
+ v);
+ i.tenant_null = is_null;
+ i.tenant_size = size;
+ grew = grew || (cap != i.tenant_value.capacity ());
+ }
+
+ // name
+ //
+ {
+ ::bpkg::package_name const& v =
+ o.name;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.name_value.capacity ());
+ pgsql::value_traits<
+ ::bpkg::package_name,
+ pgsql::id_string >::set_image (
+ i.name_value,
+ size,
+ is_null,
+ v);
+ i.name_null = is_null;
+ i.name_size = size;
+ grew = grew || (cap != i.name_value.capacity ());
+ }
+
+ // version
+ //
+ {
+ ::brep::canonical_version const& v =
+ o.version;
+
+ if (composite_value_traits< ::brep::canonical_version, id_pgsql >::init (
+ i.version_value,
+ v,
+ sk))
+ grew = true;
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::brep::package_id, id_pgsql >::
+ init (value_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // tenant
+ //
+ {
+ ::std::string& v =
+ o.tenant;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.tenant_value,
+ i.tenant_size,
+ i.tenant_null);
+ }
+
+ // name
+ //
+ {
+ ::bpkg::package_name& v =
+ o.name;
+
+ pgsql::value_traits<
+ ::bpkg::package_name,
+ pgsql::id_string >::set_value (
+ v,
+ i.name_value,
+ i.name_size,
+ i.name_null);
+ }
+
+ // version
+ //
+ {
+ ::brep::canonical_version& v =
+ o.version;
+
+ composite_value_traits< ::brep::canonical_version, id_pgsql >::init (
+ v,
+ i.version_value,
+ db);
+ }
+ }
+
+ // _repository_location
+ //
+
+ bool access::composite_value_traits< ::brep::_repository_location, id_pgsql >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // url
+ //
+ if (t[0UL])
+ {
+ i.url_value.capacity (i.url_size);
+ grew = true;
+ }
+
+ // type
+ //
+ if (t[1UL])
+ {
+ i.type_value.capacity (i.type_size);
+ grew = true;
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::brep::_repository_location, id_pgsql >::
+ bind (pgsql::bind* b,
+ image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (b);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ std::size_t n (0);
+ ODB_POTENTIALLY_UNUSED (n);
+
+ // url
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.url_value.data ();
+ b[n].capacity = i.url_value.capacity ();
+ b[n].size = &i.url_size;
+ b[n].is_null = &i.url_null;
+ n++;
+
+ // type
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.type_value.data ();
+ b[n].capacity = i.type_value.capacity ();
+ b[n].size = &i.type_size;
+ b[n].is_null = &i.type_null;
+ n++;
+ }
+
+ bool access::composite_value_traits< ::brep::_repository_location, id_pgsql >::
+ init (image_type& i,
+ const value_type& o,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ bool grew (false);
+
+ // url
+ //
+ {
+ ::bpkg::repository_url const& v =
+ o.url;
+
+ // From common.hxx:268:14
+ ::std::string const& vt =
+ (v).string ();
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.url_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.url_value,
+ size,
+ is_null,
+ vt);
+ i.url_null = is_null;
+ i.url_size = size;
+ grew = grew || (cap != i.url_value.capacity ());
+ }
+
+ // type
+ //
+ {
+ ::bpkg::repository_type const& v =
+ o.type;
+
+ // From common.hxx:260:14
+ ::std::string const& vt =
+ to_string (v);
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.type_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.type_value,
+ size,
+ is_null,
+ vt);
+ i.type_null = is_null;
+ i.type_size = size;
+ grew = grew || (cap != i.type_value.capacity ());
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::brep::_repository_location, id_pgsql >::
+ init (value_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // url
+ //
+ {
+ ::bpkg::repository_url& v =
+ o.url;
+
+ ::std::string vt;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ vt,
+ i.url_value,
+ i.url_size,
+ i.url_null);
+
+ // From common.hxx:268:14
+ v = (vt).empty () ? brep::repository_url () : brep::repository_url (vt);
+ }
+
+ // type
+ //
+ {
+ ::bpkg::repository_type& v =
+ o.type;
+
+ ::std::string vt;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ vt,
+ i.type_value,
+ i.type_size,
+ i.type_null);
+
+ // From common.hxx:260:14
+ v = brep::to_repository_type (vt);
+ }
+ }
+
+ // repository_id
+ //
+
+ bool access::composite_value_traits< ::brep::repository_id, id_pgsql >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // tenant
+ //
+ if (t[0UL])
+ {
+ i.tenant_value.capacity (i.tenant_size);
+ grew = true;
+ }
+
+ // canonical_name
+ //
+ if (t[1UL])
+ {
+ i.canonical_name_value.capacity (i.canonical_name_size);
+ grew = true;
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::brep::repository_id, id_pgsql >::
+ bind (pgsql::bind* b,
+ image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (b);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ std::size_t n (0);
+ ODB_POTENTIALLY_UNUSED (n);
+
+ // tenant
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.tenant_value.data ();
+ b[n].capacity = i.tenant_value.capacity ();
+ b[n].size = &i.tenant_size;
+ b[n].is_null = &i.tenant_null;
+ n++;
+
+ // canonical_name
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.canonical_name_value.data ();
+ b[n].capacity = i.canonical_name_value.capacity ();
+ b[n].size = &i.canonical_name_size;
+ b[n].is_null = &i.canonical_name_null;
+ n++;
+ }
+
+ bool access::composite_value_traits< ::brep::repository_id, id_pgsql >::
+ init (image_type& i,
+ const value_type& o,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ bool grew (false);
+
+ // tenant
+ //
+ {
+ ::std::string const& v =
+ o.tenant;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.tenant_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.tenant_value,
+ size,
+ is_null,
+ v);
+ i.tenant_null = is_null;
+ i.tenant_size = size;
+ grew = grew || (cap != i.tenant_value.capacity ());
+ }
+
+ // canonical_name
+ //
+ {
+ ::std::string const& v =
+ o.canonical_name;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.canonical_name_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.canonical_name_value,
+ size,
+ is_null,
+ v);
+ i.canonical_name_null = is_null;
+ i.canonical_name_size = size;
+ grew = grew || (cap != i.canonical_name_value.capacity ());
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::brep::repository_id, id_pgsql >::
+ init (value_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // tenant
+ //
+ {
+ ::std::string& v =
+ o.tenant;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.tenant_value,
+ i.tenant_size,
+ i.tenant_null);
+ }
+
+ // canonical_name
+ //
+ {
+ ::std::string& v =
+ o.canonical_name;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.canonical_name_value,
+ i.canonical_name_size,
+ i.canonical_name_null);
+ }
+ }
+}
+
+#include <odb/post.hxx>
diff --git a/libbrep/common-odb.hxx b/libbrep/common-odb.hxx
new file mode 100644
index 0000000..1bf0aaa
--- /dev/null
+++ b/libbrep/common-odb.hxx
@@ -0,0 +1,526 @@
+// -*- C++ -*-
+//
+// This file was generated by ODB, object-relational mapping (ORM)
+// compiler for C++.
+//
+
+#ifndef LIBBREP_COMMON_ODB_HXX
+#define LIBBREP_COMMON_ODB_HXX
+
+// Begin prologue.
+//
+#include <libbutl/small-vector-odb.hxx>
+#include <libbrep/wrapper-traits.hxx>
+#include <libbrep/common-traits.hxx>
+//
+// End prologue.
+
+#include <odb/version.hxx>
+
+#if (ODB_VERSION != 20470UL)
+#error ODB runtime version mismatch
+#endif
+
+#include <odb/pre.hxx>
+
+#include <libbrep/common.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/no-op-cache-traits.hxx>
+#include <odb/result.hxx>
+
+#include <odb/details/unused.hxx>
+#include <odb/details/shared-ptr.hxx>
+
+namespace odb
+{
+}
+
+#include <odb/details/buffer.hxx>
+
+#include <odb/pgsql/version.hxx>
+#include <odb/pgsql/forward.hxx>
+#include <odb/pgsql/binding.hxx>
+#include <odb/pgsql/pgsql-types.hxx>
+#include <odb/pgsql/query.hxx>
+
+namespace odb
+{
+ // _version
+ //
+ template <>
+ class access::composite_value_traits< ::brep::_version, id_pgsql >
+ {
+ public:
+ typedef ::brep::_version value_type;
+
+ struct image_type
+ {
+ // epoch
+ //
+ int epoch_value;
+ bool epoch_null;
+
+ // canonical_upstream
+ //
+ details::buffer canonical_upstream_value;
+ std::size_t canonical_upstream_size;
+ bool canonical_upstream_null;
+
+ // canonical_release
+ //
+ details::buffer canonical_release_value;
+ std::size_t canonical_release_size;
+ bool canonical_release_null;
+
+ // revision
+ //
+ int revision_value;
+ bool revision_null;
+
+ // upstream
+ //
+ details::buffer upstream_value;
+ std::size_t upstream_size;
+ bool upstream_null;
+
+ // release
+ //
+ details::buffer release_value;
+ std::size_t release_size;
+ bool release_null;
+ };
+
+ static bool
+ grow (image_type&,
+ bool*);
+
+ static void
+ bind (pgsql::bind*,
+ image_type&,
+ pgsql::statement_kind);
+
+ static bool
+ init (image_type&,
+ const value_type&,
+ pgsql::statement_kind);
+
+ static void
+ init (value_type&,
+ const image_type&,
+ database*);
+
+ static bool
+ get_null (const image_type&);
+
+ static void
+ set_null (image_type&,
+ pgsql::statement_kind);
+
+ static const std::size_t column_count = 6UL;
+ };
+
+ // build_constraint
+ //
+ template <>
+ class access::composite_value_traits< ::bpkg::build_constraint, id_pgsql >
+ {
+ public:
+ typedef ::bpkg::build_constraint value_type;
+
+ struct image_type
+ {
+ // exclusion
+ //
+ bool exclusion_value;
+ bool exclusion_null;
+
+ // config
+ //
+ details::buffer config_value;
+ std::size_t config_size;
+ bool config_null;
+
+ // target
+ //
+ details::buffer target_value;
+ std::size_t target_size;
+ bool target_null;
+
+ // comment
+ //
+ details::buffer comment_value;
+ std::size_t comment_size;
+ bool comment_null;
+ };
+
+ static bool
+ grow (image_type&,
+ bool*);
+
+ static void
+ bind (pgsql::bind*,
+ image_type&,
+ pgsql::statement_kind);
+
+ static bool
+ init (image_type&,
+ const value_type&,
+ pgsql::statement_kind);
+
+ static void
+ init (value_type&,
+ const image_type&,
+ database*);
+
+ static bool
+ get_null (const image_type&);
+
+ static void
+ set_null (image_type&,
+ pgsql::statement_kind);
+
+ static const std::size_t column_count = 4UL;
+ };
+
+ // build_class_expr
+ //
+ template <>
+ class access::composite_value_traits< ::bpkg::build_class_expr, id_pgsql >
+ {
+ public:
+ typedef ::bpkg::build_class_expr value_type;
+
+ struct image_type
+ {
+ // expression
+ //
+ details::buffer expression_value;
+ std::size_t expression_size;
+ bool expression_null;
+
+ // comment
+ //
+ details::buffer comment_value;
+ std::size_t comment_size;
+ bool comment_null;
+ };
+
+ static bool
+ grow (image_type&,
+ bool*);
+
+ static void
+ bind (pgsql::bind*,
+ image_type&,
+ pgsql::statement_kind);
+
+ static bool
+ init (image_type&,
+ const value_type&,
+ pgsql::statement_kind);
+
+ static void
+ init (value_type&,
+ const image_type&,
+ database*);
+
+ static bool
+ get_null (const image_type&);
+
+ static void
+ set_null (image_type&,
+ pgsql::statement_kind);
+
+ static const std::size_t column_count = 2UL;
+ };
+
+ // canonical_version
+ //
+ template <>
+ class access::composite_value_traits< ::brep::canonical_version, id_pgsql >
+ {
+ public:
+ typedef ::brep::canonical_version value_type;
+
+ struct image_type
+ {
+ // epoch
+ //
+ int epoch_value;
+ bool epoch_null;
+
+ // canonical_upstream
+ //
+ details::buffer canonical_upstream_value;
+ std::size_t canonical_upstream_size;
+ bool canonical_upstream_null;
+
+ // canonical_release
+ //
+ details::buffer canonical_release_value;
+ std::size_t canonical_release_size;
+ bool canonical_release_null;
+
+ // revision
+ //
+ int revision_value;
+ bool revision_null;
+ };
+
+ static bool
+ grow (image_type&,
+ bool*);
+
+ static void
+ bind (pgsql::bind*,
+ image_type&,
+ pgsql::statement_kind);
+
+ static bool
+ init (image_type&,
+ const value_type&,
+ pgsql::statement_kind);
+
+ static void
+ init (value_type&,
+ const image_type&,
+ database*);
+
+ static bool
+ get_null (const image_type&);
+
+ static void
+ set_null (image_type&,
+ pgsql::statement_kind);
+
+ static const std::size_t column_count = 4UL;
+ };
+
+ // upstream_version
+ //
+ template <>
+ class access::composite_value_traits< ::brep::upstream_version, id_pgsql >
+ {
+ public:
+ typedef ::brep::upstream_version value_type;
+
+ struct image_type
+ {
+ // upstream_
+ //
+ details::buffer upstream_value;
+ std::size_t upstream_size;
+ bool upstream_null;
+
+ // release_
+ //
+ details::buffer release_value;
+ std::size_t release_size;
+ bool release_null;
+ };
+
+ static bool
+ grow (image_type&,
+ bool*);
+
+ static void
+ bind (pgsql::bind*,
+ image_type&,
+ pgsql::statement_kind);
+
+ static bool
+ init (image_type&,
+ const value_type&,
+ pgsql::statement_kind);
+
+ static void
+ init (value_type&,
+ const image_type&,
+ database*);
+
+ static bool
+ get_null (const image_type&);
+
+ static void
+ set_null (image_type&,
+ pgsql::statement_kind);
+
+ static const std::size_t column_count = 2UL;
+ };
+
+ // package_id
+ //
+ template <>
+ class access::composite_value_traits< ::brep::package_id, id_pgsql >
+ {
+ public:
+ typedef ::brep::package_id value_type;
+
+ struct image_type
+ {
+ // tenant
+ //
+ details::buffer tenant_value;
+ std::size_t tenant_size;
+ bool tenant_null;
+
+ // name
+ //
+ details::buffer name_value;
+ std::size_t name_size;
+ bool name_null;
+
+ // version
+ //
+ composite_value_traits< ::brep::canonical_version, id_pgsql >::image_type version_value;
+ };
+
+ static bool
+ grow (image_type&,
+ bool*);
+
+ static void
+ bind (pgsql::bind*,
+ image_type&,
+ pgsql::statement_kind);
+
+ static bool
+ init (image_type&,
+ const value_type&,
+ pgsql::statement_kind);
+
+ static void
+ init (value_type&,
+ const image_type&,
+ database*);
+
+ static bool
+ get_null (const image_type&);
+
+ static void
+ set_null (image_type&,
+ pgsql::statement_kind);
+
+ static const std::size_t column_count = 6UL;
+ };
+
+ // _repository_location
+ //
+ template <>
+ class access::composite_value_traits< ::brep::_repository_location, id_pgsql >
+ {
+ public:
+ typedef ::brep::_repository_location value_type;
+
+ struct image_type
+ {
+ // url
+ //
+ details::buffer url_value;
+ std::size_t url_size;
+ bool url_null;
+
+ // type
+ //
+ details::buffer type_value;
+ std::size_t type_size;
+ bool type_null;
+ };
+
+ static bool
+ grow (image_type&,
+ bool*);
+
+ static void
+ bind (pgsql::bind*,
+ image_type&,
+ pgsql::statement_kind);
+
+ static bool
+ init (image_type&,
+ const value_type&,
+ pgsql::statement_kind);
+
+ static void
+ init (value_type&,
+ const image_type&,
+ database*);
+
+ static bool
+ get_null (const image_type&);
+
+ static void
+ set_null (image_type&,
+ pgsql::statement_kind);
+
+ static const std::size_t column_count = 2UL;
+ };
+
+ // repository_id
+ //
+ template <>
+ class access::composite_value_traits< ::brep::repository_id, id_pgsql >
+ {
+ public:
+ typedef ::brep::repository_id value_type;
+
+ struct image_type
+ {
+ // tenant
+ //
+ details::buffer tenant_value;
+ std::size_t tenant_size;
+ bool tenant_null;
+
+ // canonical_name
+ //
+ details::buffer canonical_name_value;
+ std::size_t canonical_name_size;
+ bool canonical_name_null;
+ };
+
+ static bool
+ grow (image_type&,
+ bool*);
+
+ static void
+ bind (pgsql::bind*,
+ image_type&,
+ pgsql::statement_kind);
+
+ static bool
+ init (image_type&,
+ const value_type&,
+ pgsql::statement_kind);
+
+ static void
+ init (value_type&,
+ const image_type&,
+ database*);
+
+ static bool
+ get_null (const image_type&);
+
+ static void
+ set_null (image_type&,
+ pgsql::statement_kind);
+
+ static const std::size_t column_count = 2UL;
+ };
+}
+
+#include <libbrep/common-odb.ixx>
+
+#include <odb/post.hxx>
+
+#endif // LIBBREP_COMMON_ODB_HXX
diff --git a/libbrep/common-odb.ixx b/libbrep/common-odb.ixx
new file mode 100644
index 0000000..b8813df
--- /dev/null
+++ b/libbrep/common-odb.ixx
@@ -0,0 +1,239 @@
+// -*- C++ -*-
+//
+// This file was generated by ODB, object-relational mapping (ORM)
+// compiler for C++.
+//
+
+namespace odb
+{
+}
+
+namespace odb
+{
+ // _version
+ //
+
+ inline
+ bool access::composite_value_traits< ::brep::_version, id_pgsql >::
+ get_null (const image_type& i)
+ {
+ bool r (true);
+ r = r && i.epoch_null;
+ r = r && i.canonical_upstream_null;
+ r = r && i.canonical_release_null;
+ r = r && i.revision_null;
+ r = r && i.upstream_null;
+ r = r && i.release_null;
+ return r;
+ }
+
+ inline
+ void access::composite_value_traits< ::brep::_version, id_pgsql >::
+ set_null (image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ i.epoch_null = true;
+ i.canonical_upstream_null = true;
+ i.canonical_release_null = true;
+ i.revision_null = true;
+ i.upstream_null = true;
+ i.release_null = true;
+ }
+
+ // build_constraint
+ //
+
+ inline
+ bool access::composite_value_traits< ::bpkg::build_constraint, id_pgsql >::
+ get_null (const image_type& i)
+ {
+ bool r (true);
+ r = r && i.exclusion_null;
+ r = r && i.config_null;
+ r = r && i.target_null;
+ r = r && i.comment_null;
+ return r;
+ }
+
+ inline
+ void access::composite_value_traits< ::bpkg::build_constraint, id_pgsql >::
+ set_null (image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ i.exclusion_null = true;
+ i.config_null = true;
+ i.target_null = true;
+ i.comment_null = true;
+ }
+
+ // build_class_expr
+ //
+
+ inline
+ bool access::composite_value_traits< ::bpkg::build_class_expr, id_pgsql >::
+ get_null (const image_type& i)
+ {
+ bool r (true);
+ r = r && i.expression_null;
+ r = r && i.comment_null;
+ return r;
+ }
+
+ inline
+ void access::composite_value_traits< ::bpkg::build_class_expr, id_pgsql >::
+ set_null (image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ i.expression_null = true;
+ i.comment_null = true;
+ }
+
+ // canonical_version
+ //
+
+ inline
+ bool access::composite_value_traits< ::brep::canonical_version, id_pgsql >::
+ get_null (const image_type& i)
+ {
+ bool r (true);
+ r = r && i.epoch_null;
+ r = r && i.canonical_upstream_null;
+ r = r && i.canonical_release_null;
+ r = r && i.revision_null;
+ return r;
+ }
+
+ inline
+ void access::composite_value_traits< ::brep::canonical_version, id_pgsql >::
+ set_null (image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ i.epoch_null = true;
+ i.canonical_upstream_null = true;
+ i.canonical_release_null = true;
+ i.revision_null = true;
+ }
+
+ // upstream_version
+ //
+
+ inline
+ bool access::composite_value_traits< ::brep::upstream_version, id_pgsql >::
+ get_null (const image_type& i)
+ {
+ bool r (true);
+ r = r && i.upstream_null;
+ r = r && i.release_null;
+ return r;
+ }
+
+ inline
+ void access::composite_value_traits< ::brep::upstream_version, id_pgsql >::
+ set_null (image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ i.upstream_null = true;
+ i.release_null = true;
+ }
+
+ // package_id
+ //
+
+ inline
+ bool access::composite_value_traits< ::brep::package_id, id_pgsql >::
+ get_null (const image_type& i)
+ {
+ bool r (true);
+ r = r && i.tenant_null;
+ r = r && i.name_null;
+ r = r && composite_value_traits< ::brep::canonical_version, id_pgsql >::get_null (i.version_value);
+ return r;
+ }
+
+ inline
+ void access::composite_value_traits< ::brep::package_id, id_pgsql >::
+ set_null (image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ i.tenant_null = true;
+ i.name_null = true;
+ composite_value_traits< ::brep::canonical_version, id_pgsql >::set_null (i.version_value, sk);
+ }
+
+ // _repository_location
+ //
+
+ inline
+ bool access::composite_value_traits< ::brep::_repository_location, id_pgsql >::
+ get_null (const image_type& i)
+ {
+ bool r (true);
+ r = r && i.url_null;
+ r = r && i.type_null;
+ return r;
+ }
+
+ inline
+ void access::composite_value_traits< ::brep::_repository_location, id_pgsql >::
+ set_null (image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ i.url_null = true;
+ i.type_null = true;
+ }
+
+ // repository_id
+ //
+
+ inline
+ bool access::composite_value_traits< ::brep::repository_id, id_pgsql >::
+ get_null (const image_type& i)
+ {
+ bool r (true);
+ r = r && i.tenant_null;
+ r = r && i.canonical_name_null;
+ return r;
+ }
+
+ inline
+ void access::composite_value_traits< ::brep::repository_id, id_pgsql >::
+ set_null (image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ i.tenant_null = true;
+ i.canonical_name_null = true;
+ }
+}
+
diff --git a/libbrep/package-extra.hxx b/libbrep/package-extra.hxx
new file mode 100644
index 0000000..698cc75
--- /dev/null
+++ b/libbrep/package-extra.hxx
@@ -0,0 +1,541 @@
+ 0x2d, 0x2d, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x6c, 0x65,
+ 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x62, 0x65, 0x20, 0x70,
+ 0x61, 0x72, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x62, 0x79, 0x20, 0x74,
+ 0x68, 0x65, 0x20, 0x62, 0x72, 0x65, 0x70, 0x2d, 0x6d, 0x69, 0x67, 0x72,
+ 0x61, 0x74, 0x65, 0x20, 0x75, 0x74, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e,
+ 0x20, 0x54, 0x6f, 0x20, 0x64, 0x65, 0x63, 0x72, 0x65, 0x61, 0x73, 0x65,
+ 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2d, 0x2d, 0x20, 0x70, 0x61, 0x72, 0x73,
+ 0x65, 0x72, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x69, 0x74,
+ 0x79, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f,
+ 0x77, 0x69, 0x6e, 0x67, 0x20, 0x72, 0x65, 0x73, 0x74, 0x72, 0x69, 0x63,
+ 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x70, 0x6c,
+ 0x61, 0x63, 0x65, 0x64, 0x3a, 0x0a, 0x2d, 0x2d, 0x0a, 0x2d, 0x2d, 0x20,
+ 0x2a, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x6d,
+ 0x75, 0x73, 0x74, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x20, 0x77, 0x69,
+ 0x74, 0x68, 0x20, 0x2d, 0x2d, 0x20, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65,
+ 0x20, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x6f,
+ 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x28,
+ 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x0a, 0x2d, 0x2d, 0x20,
+ 0x20, 0x20, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x73, 0x70,
+ 0x61, 0x63, 0x65, 0x73, 0x29, 0x0a, 0x2d, 0x2d, 0x20, 0x2a, 0x20, 0x6f,
+ 0x6e, 0x6c, 0x79, 0x20, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x20, 0x61,
+ 0x6e, 0x64, 0x20, 0x44, 0x52, 0x4f, 0x50, 0x20, 0x73, 0x74, 0x61, 0x74,
+ 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x46,
+ 0x55, 0x4e, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x2c, 0x20, 0x54, 0x59, 0x50,
+ 0x45, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x46, 0x4f, 0x52, 0x45, 0x49, 0x47,
+ 0x4e, 0x20, 0x54, 0x41, 0x42, 0x4c, 0x45, 0x0a, 0x2d, 0x2d, 0x20, 0x2a,
+ 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x62, 0x6f,
+ 0x64, 0x69, 0x65, 0x73, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65,
+ 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x20, 0x75, 0x73, 0x69,
+ 0x6e, 0x67, 0x20, 0x24, 0x24, 0x2d, 0x71, 0x75, 0x6f, 0x74, 0x65, 0x64,
+ 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x0a, 0x2d, 0x2d, 0x20,
+ 0x2a, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x20, 0x6f, 0x74,
+ 0x68, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x66, 0x75, 0x6e,
+ 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x62, 0x6f, 0x64, 0x69, 0x65, 0x73,
+ 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x71, 0x75, 0x6f,
+ 0x74, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x27, 0x20, 0x6f,
+ 0x72, 0x20, 0x22, 0x0a, 0x2d, 0x2d, 0x20, 0x2a, 0x20, 0x73, 0x74, 0x61,
+ 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x6d, 0x75, 0x73, 0x74,
+ 0x20, 0x65, 0x6e, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x22, 0x3b,
+ 0x5c, 0x6e, 0x22, 0x0a, 0x2d, 0x2d, 0x0a, 0x2d, 0x2d, 0x20, 0x49, 0x6e,
+ 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20,
+ 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x20, 0x27, 0x70, 0x61,
+ 0x63, 0x6b, 0x61, 0x67, 0x65, 0x27, 0x20, 0x73, 0x63, 0x68, 0x65, 0x6d,
+ 0x61, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x77, 0x68,
+ 0x65, 0x6e, 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x20, 0x74, 0x68,
+ 0x69, 0x73, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x20, 0x4e, 0x6f, 0x74,
+ 0x65, 0x0a, 0x2d, 0x2d, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68,
+ 0x65, 0x20, 0x62, 0x72, 0x65, 0x70, 0x2d, 0x6d, 0x69, 0x67, 0x72, 0x61,
+ 0x74, 0x65, 0x20, 0x75, 0x74, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x20, 0x65,
+ 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20,
+ 0x64, 0x72, 0x6f, 0x70, 0x20, 0x53, 0x51, 0x4c, 0x20, 0x73, 0x74, 0x61,
+ 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x70, 0x72, 0x69, 0x6f,
+ 0x72, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2d, 0x2d, 0x20,
+ 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x20, 0x6d, 0x69, 0x67, 0x72, 0x61,
+ 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65,
+ 0x20, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x20, 0x73, 0x74, 0x61, 0x74,
+ 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x61, 0x66, 0x74, 0x65, 0x72,
+ 0x77, 0x61, 0x72, 0x64, 0x73, 0x2e, 0x20, 0x54, 0x68, 0x61, 0x74, 0x2c,
+ 0x20, 0x69, 0x6e, 0x20, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x75, 0x6c,
+ 0x61, 0x72, 0x2c, 0x0a, 0x2d, 0x2d, 0x20, 0x6d, 0x65, 0x61, 0x6e, 0x73,
+ 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x65, 0x78,
+ 0x74, 0x72, 0x61, 0x73, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x64, 0x65, 0x70,
+ 0x65, 0x6e, 0x64, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74,
+ 0x61, 0x62, 0x6c, 0x65, 0x73, 0x20, 0x62, 0x75, 0x74, 0x20, 0x6e, 0x6f,
+ 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20,
+ 0x77, 0x61, 0x79, 0x0a, 0x2d, 0x2d, 0x20, 0x61, 0x72, 0x6f, 0x75, 0x6e,
+ 0x64, 0x2e, 0x20, 0x4d, 0x61, 0x6b, 0x65, 0x20, 0x73, 0x75, 0x72, 0x65,
+ 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x72,
+ 0x6f, 0x70, 0x20, 0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74,
+ 0x73, 0x20, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x6c, 0x79, 0x20, 0x68,
+ 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x20, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x69,
+ 0x65, 0x73, 0x20, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x0a, 0x2d,
+ 0x2d, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x73, 0x63,
+ 0x68, 0x65, 0x6d, 0x61, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
+ 0x73, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x66,
+ 0x72, 0x6f, 0x6d, 0x20, 0x4c, 0x49, 0x42, 0x42, 0x52, 0x45, 0x50, 0x5f,
+ 0x50, 0x41, 0x43, 0x4b, 0x41, 0x47, 0x45, 0x5f, 0x53, 0x43, 0x48, 0x45,
+ 0x4d, 0x41, 0x5f, 0x56, 0x45, 0x52, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x42,
+ 0x41, 0x53, 0x45, 0x2e, 0x0a, 0x2d, 0x2d, 0x0a, 0x0a, 0x2d, 0x2d, 0x20,
+ 0x54, 0x68, 0x65, 0x72, 0x65, 0x20, 0x69, 0x73, 0x20, 0x6e, 0x6f, 0x20,
+ 0x6e, 0x65, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x64, 0x72, 0x6f, 0x70,
+ 0x20, 0x74, 0x6f, 0x5f, 0x74, 0x73, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72,
+ 0x28, 0x29, 0x20, 0x65, 0x78, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x6c,
+ 0x79, 0x2c, 0x20, 0x61, 0x73, 0x20, 0x77, 0x65, 0x20, 0x63, 0x61, 0x6e,
+ 0x20, 0x72, 0x65, 0x6c, 0x79, 0x20, 0x6f, 0x6e, 0x20, 0x22, 0x44, 0x52,
+ 0x4f, 0x50, 0x0a, 0x2d, 0x2d, 0x20, 0x54, 0x59, 0x50, 0x45, 0x20, 0x49,
+ 0x46, 0x20, 0x45, 0x58, 0x49, 0x53, 0x54, 0x53, 0x20, 0x77, 0x65, 0x69,
+ 0x67, 0x68, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x20, 0x43,
+ 0x41, 0x53, 0x43, 0x41, 0x44, 0x45, 0x22, 0x20, 0x73, 0x74, 0x61, 0x74,
+ 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x62, 0x65, 0x6c, 0x6f, 0x77, 0x2c,
+ 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20,
+ 0x64, 0x72, 0x6f, 0x70, 0x20, 0x61, 0x6c, 0x6c, 0x0a, 0x2d, 0x2d, 0x20,
+ 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x20, 0x74, 0x68, 0x61, 0x74,
+ 0x20, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x20, 0x6f, 0x6e, 0x20, 0x74,
+ 0x68, 0x69, 0x73, 0x20, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x20, 0x4d, 0x6f,
+ 0x72, 0x65, 0x6f, 0x76, 0x65, 0x72, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20,
+ 0x44, 0x52, 0x4f, 0x50, 0x20, 0x46, 0x55, 0x4e, 0x43, 0x54, 0x49, 0x4f,
+ 0x4e, 0x20, 0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x20,
+ 0x77, 0x69, 0x6c, 0x6c, 0x0a, 0x2d, 0x2d, 0x20, 0x66, 0x61, 0x69, 0x6c,
+ 0x20, 0x66, 0x6f, 0x72, 0x20, 0x6f, 0x6c, 0x64, 0x20, 0x76, 0x65, 0x72,
+ 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x50, 0x6f, 0x73,
+ 0x74, 0x67, 0x72, 0x65, 0x53, 0x51, 0x4c, 0x20, 0x28, 0x65, 0x78, 0x70,
+ 0x65, 0x72, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x64, 0x20, 0x66, 0x6f, 0x72,
+ 0x20, 0x39, 0x2e, 0x32, 0x2e, 0x31, 0x34, 0x29, 0x20, 0x77, 0x69, 0x74,
+ 0x68, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x3a, 0x0a, 0x2d, 0x2d, 0x20,
+ 0x74, 0x79, 0x70, 0x65, 0x20, 0x22, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74,
+ 0x65, 0x64, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x22, 0x20, 0x64, 0x6f, 0x65,
+ 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x65, 0x78, 0x69, 0x73, 0x74, 0x2e,
+ 0x0a, 0x2d, 0x2d, 0x0a, 0x2d, 0x2d, 0x20, 0x44, 0x52, 0x4f, 0x50, 0x20,
+ 0x46, 0x55, 0x4e, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x20, 0x49, 0x46, 0x20,
+ 0x45, 0x58, 0x49, 0x53, 0x54, 0x53, 0x20, 0x74, 0x6f, 0x5f, 0x74, 0x73,
+ 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x28, 0x49, 0x4e, 0x20, 0x64, 0x6f,
+ 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x77, 0x65, 0x69, 0x67, 0x68,
+ 0x74, 0x65, 0x64, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x29, 0x3b, 0x0a, 0x2d,
+ 0x2d, 0x0a, 0x44, 0x52, 0x4f, 0x50, 0x20, 0x46, 0x55, 0x4e, 0x43, 0x54,
+ 0x49, 0x4f, 0x4e, 0x20, 0x49, 0x46, 0x20, 0x45, 0x58, 0x49, 0x53, 0x54,
+ 0x53, 0x20, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x5f, 0x70, 0x61, 0x63,
+ 0x6b, 0x61, 0x67, 0x65, 0x73, 0x28, 0x49, 0x4e, 0x20, 0x71, 0x75, 0x65,
+ 0x72, 0x79, 0x20, 0x74, 0x73, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2c, 0x0a,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x49, 0x4e, 0x20, 0x74, 0x65, 0x6e, 0x61, 0x6e,
+ 0x74, 0x20, 0x54, 0x45, 0x58, 0x54, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x49, 0x4e, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x43, 0x49, 0x54, 0x45,
+ 0x58, 0x54, 0x29, 0x3b, 0x0a, 0x0a, 0x44, 0x52, 0x4f, 0x50, 0x20, 0x46,
+ 0x55, 0x4e, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x20, 0x49, 0x46, 0x20, 0x45,
+ 0x58, 0x49, 0x53, 0x54, 0x53, 0x20, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68,
+ 0x5f, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x61, 0x63, 0x6b,
+ 0x61, 0x67, 0x65, 0x73, 0x28, 0x49, 0x4e, 0x20, 0x71, 0x75, 0x65, 0x72,
+ 0x79, 0x20, 0x74, 0x73, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2c, 0x0a, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x49, 0x4e,
+ 0x20, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x20, 0x54, 0x45, 0x58, 0x54,
+ 0x29, 0x3b, 0x0a, 0x0a, 0x44, 0x52, 0x4f, 0x50, 0x20, 0x46, 0x55, 0x4e,
+ 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x20, 0x49, 0x46, 0x20, 0x45, 0x58, 0x49,
+ 0x53, 0x54, 0x53, 0x20, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70,
+ 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x28, 0x49, 0x4e, 0x20, 0x74, 0x65,
+ 0x6e, 0x61, 0x6e, 0x74, 0x20, 0x54, 0x45, 0x58, 0x54, 0x2c, 0x20, 0x49,
+ 0x4e, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x43, 0x49, 0x54, 0x45, 0x58,
+ 0x54, 0x29, 0x3b, 0x0a, 0x44, 0x52, 0x4f, 0x50, 0x20, 0x46, 0x55, 0x4e,
+ 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x20, 0x49, 0x46, 0x20, 0x45, 0x58, 0x49,
+ 0x53, 0x54, 0x53, 0x20, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70,
+ 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x28, 0x49, 0x4e, 0x20, 0x74,
+ 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x20, 0x54, 0x45, 0x58, 0x54, 0x29, 0x3b,
+ 0x0a, 0x0a, 0x44, 0x52, 0x4f, 0x50, 0x20, 0x54, 0x59, 0x50, 0x45, 0x20,
+ 0x49, 0x46, 0x20, 0x45, 0x58, 0x49, 0x53, 0x54, 0x53, 0x20, 0x77, 0x65,
+ 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x20,
+ 0x43, 0x41, 0x53, 0x43, 0x41, 0x44, 0x45, 0x3b, 0x0a, 0x43, 0x52, 0x45,
+ 0x41, 0x54, 0x45, 0x20, 0x54, 0x59, 0x50, 0x45, 0x20, 0x77, 0x65, 0x69,
+ 0x67, 0x68, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x20, 0x41,
+ 0x53, 0x20, 0x28, 0x61, 0x20, 0x54, 0x45, 0x58, 0x54, 0x2c, 0x20, 0x62,
+ 0x20, 0x54, 0x45, 0x58, 0x54, 0x2c, 0x20, 0x63, 0x20, 0x54, 0x45, 0x58,
+ 0x54, 0x2c, 0x20, 0x64, 0x20, 0x54, 0x45, 0x58, 0x54, 0x29, 0x3b, 0x0a,
+ 0x0a, 0x2d, 0x2d, 0x20, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x74,
+ 0x68, 0x65, 0x20, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x20, 0x76, 0x65,
+ 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x6d, 0x61,
+ 0x74, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x20, 0x61, 0x20, 0x74, 0x65, 0x6e,
+ 0x61, 0x6e, 0x74, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c,
+ 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x20, 0x61, 0x73,
+ 0x20, 0x61, 0x20, 0x73, 0x65, 0x74, 0x0a, 0x2d, 0x2d, 0x20, 0x6f, 0x66,
+ 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x72, 0x6f, 0x77,
+ 0x73, 0x2e, 0x20, 0x49, 0x66, 0x20, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74,
+ 0x20, 0x69, 0x73, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x20, 0x74, 0x68,
+ 0x65, 0x6e, 0x20, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x20, 0x61, 0x6c, 0x6c,
+ 0x20, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x73, 0x2e, 0x0a, 0x2d, 0x2d,
+ 0x0a, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x20, 0x46, 0x55, 0x4e, 0x43,
+ 0x54, 0x49, 0x4f, 0x4e, 0x0a, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f,
+ 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x28, 0x49, 0x4e, 0x20,
+ 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x20, 0x54, 0x45, 0x58, 0x54, 0x29,
+ 0x0a, 0x52, 0x45, 0x54, 0x55, 0x52, 0x4e, 0x53, 0x20, 0x53, 0x45, 0x54,
+ 0x4f, 0x46, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x41,
+ 0x53, 0x20, 0x24, 0x24, 0x0a, 0x20, 0x20, 0x53, 0x45, 0x4c, 0x45, 0x43,
+ 0x54, 0x20, 0x70, 0x31, 0x2e, 0x2a, 0x0a, 0x20, 0x20, 0x46, 0x52, 0x4f,
+ 0x4d, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x70, 0x31,
+ 0x20, 0x4c, 0x45, 0x46, 0x54, 0x20, 0x4a, 0x4f, 0x49, 0x4e, 0x20, 0x70,
+ 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x70, 0x32, 0x20, 0x4f, 0x4e,
+ 0x20, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x70, 0x31, 0x2e, 0x69, 0x6e,
+ 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x72, 0x65, 0x70, 0x6f, 0x73,
+ 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x63, 0x61, 0x6e, 0x6f, 0x6e, 0x69,
+ 0x63, 0x61, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x49, 0x53, 0x20,
+ 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x20, 0x41, 0x4e, 0x44,
+ 0x0a, 0x20, 0x20, 0x20, 0x20, 0x70, 0x31, 0x2e, 0x74, 0x65, 0x6e, 0x61,
+ 0x6e, 0x74, 0x20, 0x3d, 0x20, 0x70, 0x32, 0x2e, 0x74, 0x65, 0x6e, 0x61,
+ 0x6e, 0x74, 0x20, 0x41, 0x4e, 0x44, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x70,
+ 0x31, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x70, 0x32, 0x2e,
+ 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x41, 0x4e, 0x44, 0x0a, 0x20, 0x20, 0x20,
+ 0x20, 0x70, 0x32, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c,
+ 0x5f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f,
+ 0x63, 0x61, 0x6e, 0x6f, 0x6e, 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x6e, 0x61,
+ 0x6d, 0x65, 0x20, 0x49, 0x53, 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55,
+ 0x4c, 0x4c, 0x20, 0x41, 0x4e, 0x44, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28,
+ 0x70, 0x31, 0x2e, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x65,
+ 0x70, 0x6f, 0x63, 0x68, 0x20, 0x3c, 0x20, 0x70, 0x32, 0x2e, 0x76, 0x65,
+ 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x20,
+ 0x4f, 0x52, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x31, 0x2e, 0x76,
+ 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68,
+ 0x20, 0x3d, 0x20, 0x70, 0x32, 0x2e, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f,
+ 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x20, 0x41, 0x4e, 0x44, 0x0a,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x28, 0x70, 0x31, 0x2e, 0x76, 0x65, 0x72,
+ 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x61, 0x6e, 0x6f, 0x6e, 0x69, 0x63,
+ 0x61, 0x6c, 0x5f, 0x75, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x20,
+ 0x3c, 0x20, 0x70, 0x32, 0x2e, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
+ 0x5f, 0x63, 0x61, 0x6e, 0x6f, 0x6e, 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x75,
+ 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x20, 0x4f, 0x52, 0x0a, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x31, 0x2e, 0x76, 0x65, 0x72, 0x73,
+ 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x61, 0x6e, 0x6f, 0x6e, 0x69, 0x63, 0x61,
+ 0x6c, 0x5f, 0x75, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x20, 0x3d,
+ 0x20, 0x70, 0x32, 0x2e, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f,
+ 0x63, 0x61, 0x6e, 0x6f, 0x6e, 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x75, 0x70,
+ 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x20, 0x41, 0x4e, 0x44, 0x0a, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x28, 0x70, 0x31, 0x2e, 0x76, 0x65, 0x72,
+ 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x61, 0x6e, 0x6f, 0x6e, 0x69, 0x63,
+ 0x61, 0x6c, 0x5f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x3c,
+ 0x20, 0x70, 0x32, 0x2e, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f,
+ 0x63, 0x61, 0x6e, 0x6f, 0x6e, 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x72, 0x65,
+ 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x4f, 0x52, 0x0a, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x70, 0x31, 0x2e, 0x76, 0x65, 0x72, 0x73, 0x69,
+ 0x6f, 0x6e, 0x5f, 0x63, 0x61, 0x6e, 0x6f, 0x6e, 0x69, 0x63, 0x61, 0x6c,
+ 0x5f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x3d, 0x20, 0x70,
+ 0x32, 0x2e, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x61,
+ 0x6e, 0x6f, 0x6e, 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x72, 0x65, 0x6c, 0x65,
+ 0x61, 0x73, 0x65, 0x20, 0x41, 0x4e, 0x44, 0x0a, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x70, 0x31, 0x2e, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f,
+ 0x6e, 0x5f, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x3c,
+ 0x20, 0x70, 0x32, 0x2e, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f,
+ 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x29, 0x29, 0x29, 0x29,
+ 0x0a, 0x20, 0x20, 0x57, 0x48, 0x45, 0x52, 0x45, 0x0a, 0x20, 0x20, 0x20,
+ 0x20, 0x28, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x61, 0x63,
+ 0x6b, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74,
+ 0x20, 0x49, 0x53, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x20, 0x4f, 0x52, 0x20,
+ 0x70, 0x31, 0x2e, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x20, 0x3d, 0x20,
+ 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61,
+ 0x67, 0x65, 0x73, 0x2e, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x29, 0x20,
+ 0x41, 0x4e, 0x44, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x70, 0x31, 0x2e, 0x69,
+ 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x72, 0x65, 0x70, 0x6f,
+ 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x63, 0x61, 0x6e, 0x6f, 0x6e,
+ 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x49, 0x53,
+ 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x20, 0x41, 0x4e,
+ 0x44, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x70, 0x32, 0x2e, 0x6e, 0x61, 0x6d,
+ 0x65, 0x20, 0x49, 0x53, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x3b, 0x0a, 0x24,
+ 0x24, 0x20, 0x4c, 0x41, 0x4e, 0x47, 0x55, 0x41, 0x47, 0x45, 0x20, 0x53,
+ 0x51, 0x4c, 0x20, 0x53, 0x54, 0x41, 0x42, 0x4c, 0x45, 0x3b, 0x0a, 0x0a,
+ 0x2d, 0x2d, 0x20, 0x46, 0x69, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20,
+ 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69,
+ 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x6e, 0x20, 0x69, 0x6e, 0x74,
+ 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67,
+ 0x65, 0x20, 0x68, 0x61, 0x76, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65,
+ 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x74,
+ 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x0a, 0x2d, 0x2d, 0x20, 0x61, 0x6e, 0x64,
+ 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x2e, 0x20, 0x52, 0x65, 0x74, 0x75, 0x72,
+ 0x6e, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x72,
+ 0x6f, 0x77, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x69, 0x6e,
+ 0x67, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67,
+ 0x65, 0x20, 0x69, 0x64, 0x2c, 0x20, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x20,
+ 0x72, 0x6f, 0x77, 0x20, 0x73, 0x65, 0x74, 0x20, 0x69, 0x66, 0x0a, 0x2d,
+ 0x2d, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67,
+ 0x65, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x2e,
+ 0x0a, 0x2d, 0x2d, 0x0a, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x20, 0x46,
+ 0x55, 0x4e, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x0a, 0x6c, 0x61, 0x74, 0x65,
+ 0x73, 0x74, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x28, 0x49,
+ 0x4e, 0x4f, 0x55, 0x54, 0x20, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x20,
+ 0x54, 0x45, 0x58, 0x54, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x49, 0x4e, 0x4f,
+ 0x55, 0x54, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x43, 0x49, 0x54, 0x45,
+ 0x58, 0x54, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4f, 0x55, 0x54, 0x20, 0x76,
+ 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68,
+ 0x20, 0x49, 0x4e, 0x54, 0x45, 0x47, 0x45, 0x52, 0x2c, 0x0a, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x4f, 0x55, 0x54, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
+ 0x5f, 0x63, 0x61, 0x6e, 0x6f, 0x6e, 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x75,
+ 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x20, 0x54, 0x45, 0x58, 0x54,
+ 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x4f, 0x55, 0x54, 0x20, 0x76, 0x65, 0x72,
+ 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x61, 0x6e, 0x6f, 0x6e, 0x69, 0x63,
+ 0x61, 0x6c, 0x5f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x54,
+ 0x45, 0x58, 0x54, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4f, 0x55, 0x54, 0x20,
+ 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x76, 0x69,
+ 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x49, 0x4e, 0x54, 0x45, 0x47, 0x45, 0x52,
+ 0x29, 0x0a, 0x52, 0x45, 0x54, 0x55, 0x52, 0x4e, 0x53, 0x20, 0x53, 0x45,
+ 0x54, 0x4f, 0x46, 0x20, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x20, 0x41,
+ 0x53, 0x20, 0x24, 0x24, 0x0a, 0x20, 0x20, 0x53, 0x45, 0x4c, 0x45, 0x43,
+ 0x54, 0x20, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x2c, 0x20, 0x6e, 0x61,
+ 0x6d, 0x65, 0x2c, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f,
+ 0x65, 0x70, 0x6f, 0x63, 0x68, 0x2c, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69,
+ 0x6f, 0x6e, 0x5f, 0x63, 0x61, 0x6e, 0x6f, 0x6e, 0x69, 0x63, 0x61, 0x6c,
+ 0x5f, 0x75, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2c, 0x0a, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x65, 0x72, 0x73,
+ 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x61, 0x6e, 0x6f, 0x6e, 0x69, 0x63, 0x61,
+ 0x6c, 0x5f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x2c, 0x20, 0x76,
+ 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x76, 0x69, 0x73,
+ 0x69, 0x6f, 0x6e, 0x0a, 0x20, 0x20, 0x46, 0x52, 0x4f, 0x4d, 0x20, 0x6c,
+ 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67,
+ 0x65, 0x73, 0x28, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x61,
+ 0x63, 0x6b, 0x61, 0x67, 0x65, 0x2e, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74,
+ 0x29, 0x0a, 0x20, 0x20, 0x57, 0x48, 0x45, 0x52, 0x45, 0x20, 0x6e, 0x61,
+ 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f,
+ 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x2e, 0x6e, 0x61, 0x6d, 0x65,
+ 0x3b, 0x0a, 0x24, 0x24, 0x20, 0x4c, 0x41, 0x4e, 0x47, 0x55, 0x41, 0x47,
+ 0x45, 0x20, 0x53, 0x51, 0x4c, 0x20, 0x53, 0x54, 0x41, 0x42, 0x4c, 0x45,
+ 0x3b, 0x0a, 0x0a, 0x2d, 0x2d, 0x20, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68,
+ 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c, 0x61, 0x74,
+ 0x65, 0x73, 0x74, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20,
+ 0x6f, 0x66, 0x20, 0x61, 0x6e, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e,
+ 0x61, 0x6c, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x20,
+ 0x6d, 0x61, 0x74, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65,
+ 0x0a, 0x2d, 0x2d, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65,
+ 0x64, 0x20, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x20, 0x71, 0x75, 0x65,
+ 0x72, 0x79, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x65, 0x6e, 0x61, 0x6e,
+ 0x74, 0x2e, 0x20, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x61, 0x20,
+ 0x73, 0x65, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x72, 0x6f, 0x77, 0x73, 0x20,
+ 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x74,
+ 0x68, 0x65, 0x0a, 0x2d, 0x2d, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67,
+ 0x65, 0x20, 0x69, 0x64, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x73, 0x65, 0x61,
+ 0x72, 0x63, 0x68, 0x20, 0x72, 0x61, 0x6e, 0x6b, 0x2e, 0x20, 0x49, 0x66,
+ 0x20, 0x71, 0x75, 0x65, 0x72, 0x79, 0x20, 0x69, 0x73, 0x20, 0x4e, 0x55,
+ 0x4c, 0x4c, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x6d, 0x61, 0x74,
+ 0x63, 0x68, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61,
+ 0x67, 0x65, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x0a, 0x2d, 0x2d, 0x20, 0x72,
+ 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x30, 0x20, 0x72, 0x61, 0x6e, 0x6b,
+ 0x20, 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x72, 0x6f, 0x77,
+ 0x73, 0x2e, 0x20, 0x49, 0x66, 0x20, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74,
+ 0x20, 0x69, 0x73, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x20, 0x74, 0x68,
+ 0x65, 0x6e, 0x20, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x20, 0x61, 0x6c, 0x6c,
+ 0x20, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x73, 0x2e, 0x0a, 0x2d, 0x2d,
+ 0x0a, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x20, 0x46, 0x55, 0x4e, 0x43,
+ 0x54, 0x49, 0x4f, 0x4e, 0x0a, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x5f,
+ 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61,
+ 0x67, 0x65, 0x73, 0x28, 0x49, 0x4e, 0x20, 0x71, 0x75, 0x65, 0x72, 0x79,
+ 0x20, 0x74, 0x73, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2c, 0x0a, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x49, 0x4e, 0x4f,
+ 0x55, 0x54, 0x20, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x20, 0x54, 0x45,
+ 0x58, 0x54, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x4f, 0x55, 0x54, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20,
+ 0x43, 0x49, 0x54, 0x45, 0x58, 0x54, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4f, 0x55, 0x54, 0x20, 0x76,
+ 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68,
+ 0x20, 0x49, 0x4e, 0x54, 0x45, 0x47, 0x45, 0x52, 0x2c, 0x0a, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4f, 0x55, 0x54,
+ 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x61, 0x6e,
+ 0x6f, 0x6e, 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x75, 0x70, 0x73, 0x74, 0x72,
+ 0x65, 0x61, 0x6d, 0x20, 0x54, 0x45, 0x58, 0x54, 0x2c, 0x0a, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4f, 0x55, 0x54,
+ 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x61, 0x6e,
+ 0x6f, 0x6e, 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x72, 0x65, 0x6c, 0x65, 0x61,
+ 0x73, 0x65, 0x20, 0x54, 0x45, 0x58, 0x54, 0x2c, 0x0a, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4f, 0x55, 0x54, 0x20,
+ 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x76, 0x69,
+ 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x49, 0x4e, 0x54, 0x45, 0x47, 0x45, 0x52,
+ 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x4f, 0x55, 0x54, 0x20, 0x72, 0x61, 0x6e, 0x6b, 0x20, 0x72, 0x65,
+ 0x61, 0x6c, 0x29, 0x0a, 0x52, 0x45, 0x54, 0x55, 0x52, 0x4e, 0x53, 0x20,
+ 0x53, 0x45, 0x54, 0x4f, 0x46, 0x20, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64,
+ 0x20, 0x41, 0x53, 0x20, 0x24, 0x24, 0x0a, 0x20, 0x20, 0x53, 0x45, 0x4c,
+ 0x45, 0x43, 0x54, 0x20, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x2c, 0x20,
+ 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f,
+ 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x2c, 0x20, 0x76, 0x65, 0x72,
+ 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x61, 0x6e, 0x6f, 0x6e, 0x69, 0x63,
+ 0x61, 0x6c, 0x5f, 0x75, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2c,
+ 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x65,
+ 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x61, 0x6e, 0x6f, 0x6e, 0x69,
+ 0x63, 0x61, 0x6c, 0x5f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x2c,
+ 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x76,
+ 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x43, 0x41, 0x53, 0x45, 0x0a, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x57, 0x48, 0x45, 0x4e,
+ 0x20, 0x71, 0x75, 0x65, 0x72, 0x79, 0x20, 0x49, 0x53, 0x20, 0x4e, 0x55,
+ 0x4c, 0x4c, 0x20, 0x54, 0x48, 0x45, 0x4e, 0x20, 0x30, 0x0a, 0x2d, 0x2d,
+ 0x20, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x20, 0x6d, 0x61, 0x70, 0x70,
+ 0x69, 0x6e, 0x67, 0x3a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x44, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43, 0x20, 0x20,
+ 0x20, 0x20, 0x42, 0x20, 0x20, 0x20, 0x20, 0x41, 0x0a, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x45, 0x4c, 0x53, 0x45,
+ 0x20, 0x74, 0x73, 0x5f, 0x72, 0x61, 0x6e, 0x6b, 0x5f, 0x63, 0x64, 0x28,
+ 0x27, 0x7b, 0x30, 0x2e, 0x30, 0x35, 0x2c, 0x20, 0x30, 0x2e, 0x32, 0x2c,
+ 0x20, 0x30, 0x2e, 0x39, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x7d, 0x27, 0x2c,
+ 0x20, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x5f, 0x69, 0x6e, 0x64, 0x65,
+ 0x78, 0x2c, 0x20, 0x71, 0x75, 0x65, 0x72, 0x79, 0x29, 0x0a, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x45, 0x4e, 0x44, 0x20, 0x41,
+ 0x53, 0x20, 0x72, 0x61, 0x6e, 0x6b, 0x0a, 0x20, 0x20, 0x46, 0x52, 0x4f,
+ 0x4d, 0x20, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x61, 0x63,
+ 0x6b, 0x61, 0x67, 0x65, 0x73, 0x28, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68,
+ 0x5f, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x61, 0x63, 0x6b,
+ 0x61, 0x67, 0x65, 0x73, 0x2e, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x29,
+ 0x0a, 0x20, 0x20, 0x57, 0x48, 0x45, 0x52, 0x45, 0x20, 0x71, 0x75, 0x65,
+ 0x72, 0x79, 0x20, 0x49, 0x53, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x20, 0x4f,
+ 0x52, 0x20, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x5f, 0x69, 0x6e, 0x64,
+ 0x65, 0x78, 0x20, 0x40, 0x40, 0x20, 0x71, 0x75, 0x65, 0x72, 0x79, 0x3b,
+ 0x0a, 0x24, 0x24, 0x20, 0x4c, 0x41, 0x4e, 0x47, 0x55, 0x41, 0x47, 0x45,
+ 0x20, 0x53, 0x51, 0x4c, 0x20, 0x53, 0x54, 0x41, 0x42, 0x4c, 0x45, 0x3b,
+ 0x0a, 0x0a, 0x2d, 0x2d, 0x20, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x20,
+ 0x66, 0x6f, 0x72, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73,
+ 0x20, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68,
+ 0x65, 0x20, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x20, 0x71, 0x75, 0x65,
+ 0x72, 0x79, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x65, 0x6e, 0x61, 0x6e,
+ 0x74, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x68, 0x61, 0x76, 0x69, 0x6e, 0x67,
+ 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2d, 0x2d, 0x20, 0x73, 0x70, 0x65, 0x63,
+ 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x2e,
+ 0x20, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x61, 0x20, 0x73, 0x65,
+ 0x74, 0x20, 0x6f, 0x66, 0x20, 0x72, 0x6f, 0x77, 0x73, 0x20, 0x63, 0x6f,
+ 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65,
+ 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x69, 0x64, 0x20,
+ 0x61, 0x6e, 0x64, 0x20, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x0a, 0x2d,
+ 0x2d, 0x20, 0x72, 0x61, 0x6e, 0x6b, 0x2e, 0x20, 0x49, 0x66, 0x20, 0x71,
+ 0x75, 0x65, 0x72, 0x79, 0x20, 0x69, 0x73, 0x20, 0x4e, 0x55, 0x4c, 0x4c,
+ 0x2c, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x6d, 0x61, 0x74, 0x63, 0x68,
+ 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65,
+ 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e,
+ 0x20, 0x30, 0x20, 0x72, 0x61, 0x6e, 0x6b, 0x20, 0x66, 0x6f, 0x72, 0x20,
+ 0x61, 0x6c, 0x6c, 0x0a, 0x2d, 0x2d, 0x20, 0x72, 0x6f, 0x77, 0x73, 0x2e,
+ 0x20, 0x49, 0x66, 0x20, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x20, 0x69,
+ 0x73, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x6e,
+ 0x20, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x74,
+ 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x73, 0x2e, 0x0a, 0x2d, 0x2d, 0x0a, 0x43,
+ 0x52, 0x45, 0x41, 0x54, 0x45, 0x20, 0x46, 0x55, 0x4e, 0x43, 0x54, 0x49,
+ 0x4f, 0x4e, 0x0a, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x5f, 0x70, 0x61,
+ 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x28, 0x49, 0x4e, 0x20, 0x71, 0x75,
+ 0x65, 0x72, 0x79, 0x20, 0x74, 0x73, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2c,
+ 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x49, 0x4e, 0x4f, 0x55, 0x54, 0x20, 0x74,
+ 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x20, 0x54, 0x45, 0x58, 0x54, 0x2c, 0x0a,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x49, 0x4e, 0x4f, 0x55, 0x54, 0x20, 0x6e, 0x61,
+ 0x6d, 0x65, 0x20, 0x43, 0x49, 0x54, 0x45, 0x58, 0x54, 0x2c, 0x0a, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x4f, 0x55, 0x54, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69,
+ 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x20, 0x49, 0x4e, 0x54,
+ 0x45, 0x47, 0x45, 0x52, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4f, 0x55,
+ 0x54, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x61,
+ 0x6e, 0x6f, 0x6e, 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x75, 0x70, 0x73, 0x74,
+ 0x72, 0x65, 0x61, 0x6d, 0x20, 0x54, 0x45, 0x58, 0x54, 0x2c, 0x0a, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x4f, 0x55, 0x54, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69,
+ 0x6f, 0x6e, 0x5f, 0x63, 0x61, 0x6e, 0x6f, 0x6e, 0x69, 0x63, 0x61, 0x6c,
+ 0x5f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x54, 0x45, 0x58,
+ 0x54, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4f, 0x55, 0x54, 0x20, 0x76,
+ 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x76, 0x69, 0x73,
+ 0x69, 0x6f, 0x6e, 0x20, 0x49, 0x4e, 0x54, 0x45, 0x47, 0x45, 0x52, 0x2c,
+ 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x4f, 0x55, 0x54, 0x20, 0x72, 0x61, 0x6e,
+ 0x6b, 0x20, 0x72, 0x65, 0x61, 0x6c, 0x29, 0x0a, 0x52, 0x45, 0x54, 0x55,
+ 0x52, 0x4e, 0x53, 0x20, 0x53, 0x45, 0x54, 0x4f, 0x46, 0x20, 0x72, 0x65,
+ 0x63, 0x6f, 0x72, 0x64, 0x20, 0x41, 0x53, 0x20, 0x24, 0x24, 0x0a, 0x20,
+ 0x20, 0x53, 0x45, 0x4c, 0x45, 0x43, 0x54, 0x20, 0x74, 0x65, 0x6e, 0x61,
+ 0x6e, 0x74, 0x2c, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x20, 0x76, 0x65,
+ 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x2c,
+ 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x61, 0x6e,
+ 0x6f, 0x6e, 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x75, 0x70, 0x73, 0x74, 0x72,
+ 0x65, 0x61, 0x6d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x61,
+ 0x6e, 0x6f, 0x6e, 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x72, 0x65, 0x6c, 0x65,
+ 0x61, 0x73, 0x65, 0x2c, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
+ 0x5f, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2c, 0x0a, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43, 0x41, 0x53, 0x45,
+ 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x57, 0x48, 0x45, 0x4e, 0x20, 0x71, 0x75, 0x65, 0x72, 0x79, 0x20, 0x49,
+ 0x53, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x20, 0x54, 0x48, 0x45, 0x4e, 0x20,
+ 0x30, 0x0a, 0x2d, 0x2d, 0x20, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x20,
+ 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x3a, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x44, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x43, 0x20, 0x20, 0x20, 0x20, 0x42, 0x20, 0x20, 0x20, 0x20, 0x41,
+ 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x45, 0x4c, 0x53, 0x45, 0x20, 0x74, 0x73, 0x5f, 0x72, 0x61, 0x6e, 0x6b,
+ 0x5f, 0x63, 0x64, 0x28, 0x27, 0x7b, 0x30, 0x2e, 0x30, 0x35, 0x2c, 0x20,
+ 0x30, 0x2e, 0x32, 0x2c, 0x20, 0x30, 0x2e, 0x39, 0x2c, 0x20, 0x31, 0x2e,
+ 0x30, 0x7d, 0x27, 0x2c, 0x20, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x5f,
+ 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2c, 0x20, 0x71, 0x75, 0x65, 0x72, 0x79,
+ 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x45,
+ 0x4e, 0x44, 0x20, 0x41, 0x53, 0x20, 0x72, 0x61, 0x6e, 0x6b, 0x0a, 0x20,
+ 0x20, 0x46, 0x52, 0x4f, 0x4d, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67,
+ 0x65, 0x0a, 0x20, 0x20, 0x57, 0x48, 0x45, 0x52, 0x45, 0x0a, 0x20, 0x20,
+ 0x28, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x5f, 0x70, 0x61, 0x63, 0x6b,
+ 0x61, 0x67, 0x65, 0x73, 0x2e, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x20,
+ 0x49, 0x53, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x20, 0x4f, 0x52, 0x20, 0x74,
+ 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x20, 0x3d, 0x20, 0x73, 0x65, 0x61, 0x72,
+ 0x63, 0x68, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x2e,
+ 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x29, 0x20, 0x41, 0x4e, 0x44, 0x0a,
+ 0x20, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x73, 0x65, 0x61,
+ 0x72, 0x63, 0x68, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73,
+ 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x41, 0x4e, 0x44, 0x0a, 0x20, 0x20,
+ 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x72, 0x65, 0x70,
+ 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x63, 0x61, 0x6e, 0x6f,
+ 0x6e, 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x49,
+ 0x53, 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x20, 0x41,
+ 0x4e, 0x44, 0x0a, 0x20, 0x20, 0x28, 0x71, 0x75, 0x65, 0x72, 0x79, 0x20,
+ 0x49, 0x53, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x20, 0x4f, 0x52, 0x20, 0x73,
+ 0x65, 0x61, 0x72, 0x63, 0x68, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20,
+ 0x40, 0x40, 0x20, 0x71, 0x75, 0x65, 0x72, 0x79, 0x29, 0x3b, 0x0a, 0x24,
+ 0x24, 0x20, 0x4c, 0x41, 0x4e, 0x47, 0x55, 0x41, 0x47, 0x45, 0x20, 0x53,
+ 0x51, 0x4c, 0x20, 0x53, 0x54, 0x41, 0x42, 0x4c, 0x45, 0x3b, 0x0a, 0x0a,
+ 0x2d, 0x2d, 0x20, 0x50, 0x61, 0x72, 0x73, 0x65, 0x20, 0x77, 0x65, 0x69,
+ 0x67, 0x68, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x20, 0x74,
+ 0x6f, 0x20, 0x74, 0x73, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x2e, 0x0a,
+ 0x2d, 0x2d, 0x0a, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x20, 0x46, 0x55,
+ 0x4e, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x0a, 0x74, 0x6f, 0x5f, 0x74, 0x73,
+ 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x28, 0x49, 0x4e, 0x20, 0x64, 0x6f,
+ 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x77, 0x65, 0x69, 0x67, 0x68,
+ 0x74, 0x65, 0x64, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x29, 0x0a, 0x52, 0x45,
+ 0x54, 0x55, 0x52, 0x4e, 0x53, 0x20, 0x74, 0x73, 0x76, 0x65, 0x63, 0x74,
+ 0x6f, 0x72, 0x20, 0x41, 0x53, 0x20, 0x24, 0x24, 0x0a, 0x20, 0x20, 0x53,
+ 0x45, 0x4c, 0x45, 0x43, 0x54, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x43, 0x41,
+ 0x53, 0x45, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x57, 0x48, 0x45,
+ 0x4e, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x49,
+ 0x53, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x20, 0x54, 0x48, 0x45, 0x4e, 0x20,
+ 0x4e, 0x55, 0x4c, 0x4c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x45,
+ 0x4c, 0x53, 0x45, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x73, 0x65, 0x74, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x28, 0x74, 0x6f,
+ 0x5f, 0x74, 0x73, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x28, 0x64, 0x6f,
+ 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x61, 0x29, 0x2c, 0x20, 0x27,
+ 0x41, 0x27, 0x29, 0x20, 0x7c, 0x7c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x73, 0x65, 0x74, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74,
+ 0x28, 0x74, 0x6f, 0x5f, 0x74, 0x73, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72,
+ 0x28, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x62, 0x29,
+ 0x2c, 0x20, 0x27, 0x42, 0x27, 0x29, 0x20, 0x7c, 0x7c, 0x0a, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x65, 0x74, 0x77, 0x65, 0x69,
+ 0x67, 0x68, 0x74, 0x28, 0x74, 0x6f, 0x5f, 0x74, 0x73, 0x76, 0x65, 0x63,
+ 0x74, 0x6f, 0x72, 0x28, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74,
+ 0x2e, 0x63, 0x29, 0x2c, 0x20, 0x27, 0x43, 0x27, 0x29, 0x20, 0x7c, 0x7c,
+ 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x65, 0x74,
+ 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x28, 0x74, 0x6f, 0x5f, 0x74, 0x73,
+ 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x28, 0x64, 0x6f, 0x63, 0x75, 0x6d,
+ 0x65, 0x6e, 0x74, 0x2e, 0x64, 0x29, 0x2c, 0x20, 0x27, 0x44, 0x27, 0x29,
+ 0x0a, 0x20, 0x20, 0x20, 0x20, 0x45, 0x4e, 0x44, 0x0a, 0x24, 0x24, 0x20,
+ 0x4c, 0x41, 0x4e, 0x47, 0x55, 0x41, 0x47, 0x45, 0x20, 0x53, 0x51, 0x4c,
+ 0x20, 0x49, 0x4d, 0x4d, 0x55, 0x54, 0x41, 0x42, 0x4c, 0x45, 0x3b, 0x0a
diff --git a/libbrep/package-odb.cxx b/libbrep/package-odb.cxx
new file mode 100644
index 0000000..a75d5af
--- /dev/null
+++ b/libbrep/package-odb.cxx
@@ -0,0 +1,14202 @@
+// -*- C++ -*-
+//
+// This file was generated by ODB, object-relational mapping (ORM)
+// compiler for C++.
+//
+
+#include <odb/pre.hxx>
+
+#include <libbrep/package-odb.hxx>
+
+#include <cassert>
+#include <cstring> // std::memcpy
+
+#include <odb/schema-catalog-impl.hxx>
+
+#include <odb/pgsql/traits.hxx>
+#include <odb/pgsql/database.hxx>
+#include <odb/pgsql/transaction.hxx>
+#include <odb/pgsql/connection.hxx>
+#include <odb/pgsql/statement.hxx>
+#include <odb/pgsql/statement-cache.hxx>
+#include <odb/pgsql/simple-object-statements.hxx>
+#include <odb/pgsql/view-statements.hxx>
+#include <odb/pgsql/section-statements.hxx>
+#include <odb/pgsql/container-statements.hxx>
+#include <odb/pgsql/exceptions.hxx>
+#include <odb/pgsql/prepared-query.hxx>
+#include <odb/pgsql/simple-object-result.hxx>
+#include <odb/pgsql/view-result.hxx>
+
+namespace odb
+{
+ // priority
+ //
+
+ bool access::composite_value_traits< ::bpkg::priority, id_pgsql >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // value
+ //
+ t[0UL] = 0;
+
+ // comment
+ //
+ if (t[1UL])
+ {
+ i.comment_value.capacity (i.comment_size);
+ grew = true;
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::bpkg::priority, id_pgsql >::
+ bind (pgsql::bind* b,
+ image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (b);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ std::size_t n (0);
+ ODB_POTENTIALLY_UNUSED (n);
+
+ // value
+ //
+ b[n].type = pgsql::bind::integer;
+ b[n].buffer = &i.value_value;
+ b[n].is_null = &i.value_null;
+ n++;
+
+ // comment
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.comment_value.data ();
+ b[n].capacity = i.comment_value.capacity ();
+ b[n].size = &i.comment_size;
+ b[n].is_null = &i.comment_null;
+ n++;
+ }
+
+ bool access::composite_value_traits< ::bpkg::priority, id_pgsql >::
+ init (image_type& i,
+ const value_type& o,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ bool grew (false);
+
+ // value
+ //
+ {
+ ::bpkg::priority::value_type const& v =
+ o.value;
+
+ bool is_null (false);
+ pgsql::value_traits<
+ ::bpkg::priority::value_type,
+ pgsql::id_integer >::set_image (
+ i.value_value, is_null, v);
+ i.value_null = is_null;
+ }
+
+ // comment
+ //
+ {
+ ::std::string const& v =
+ o.comment;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.comment_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.comment_value,
+ size,
+ is_null,
+ v);
+ i.comment_null = is_null;
+ i.comment_size = size;
+ grew = grew || (cap != i.comment_value.capacity ());
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::bpkg::priority, id_pgsql >::
+ init (value_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // value
+ //
+ {
+ ::bpkg::priority::value_type& v =
+ o.value;
+
+ pgsql::value_traits<
+ ::bpkg::priority::value_type,
+ pgsql::id_integer >::set_value (
+ v,
+ i.value_value,
+ i.value_null);
+ }
+
+ // comment
+ //
+ {
+ ::std::string& v =
+ o.comment;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.comment_value,
+ i.comment_size,
+ i.comment_null);
+ }
+ }
+
+ // licenses
+ //
+
+ bool access::composite_value_traits< ::bpkg::licenses, id_pgsql >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // comment
+ //
+ if (t[0UL])
+ {
+ i.comment_value.capacity (i.comment_size);
+ grew = true;
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::bpkg::licenses, id_pgsql >::
+ bind (pgsql::bind* b,
+ image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (b);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ std::size_t n (0);
+ ODB_POTENTIALLY_UNUSED (n);
+
+ // comment
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.comment_value.data ();
+ b[n].capacity = i.comment_value.capacity ();
+ b[n].size = &i.comment_size;
+ b[n].is_null = &i.comment_null;
+ n++;
+ }
+
+ bool access::composite_value_traits< ::bpkg::licenses, id_pgsql >::
+ init (image_type& i,
+ const value_type& o,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ bool grew (false);
+
+ // comment
+ //
+ {
+ ::std::string const& v =
+ o.comment;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.comment_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.comment_value,
+ size,
+ is_null,
+ v);
+ i.comment_null = is_null;
+ i.comment_size = size;
+ grew = grew || (cap != i.comment_value.capacity ());
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::bpkg::licenses, id_pgsql >::
+ init (value_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // comment
+ //
+ {
+ ::std::string& v =
+ o.comment;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.comment_value,
+ i.comment_size,
+ i.comment_null);
+ }
+ }
+
+ // manifest_url
+ //
+
+ bool access::composite_value_traits< ::bpkg::manifest_url, id_pgsql >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // value
+ //
+ if (t[0UL])
+ {
+ i.value_value.capacity (i.value_size);
+ grew = true;
+ }
+
+ // comment
+ //
+ if (t[1UL])
+ {
+ i.comment_value.capacity (i.comment_size);
+ grew = true;
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::bpkg::manifest_url, id_pgsql >::
+ bind (pgsql::bind* b,
+ image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (b);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ std::size_t n (0);
+ ODB_POTENTIALLY_UNUSED (n);
+
+ // value
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.value_value.data ();
+ b[n].capacity = i.value_value.capacity ();
+ b[n].size = &i.value_size;
+ b[n].is_null = &i.value_null;
+ n++;
+
+ // comment
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.comment_value.data ();
+ b[n].capacity = i.comment_value.capacity ();
+ b[n].size = &i.comment_size;
+ b[n].is_null = &i.comment_null;
+ n++;
+ }
+
+ bool access::composite_value_traits< ::bpkg::manifest_url, id_pgsql >::
+ init (image_type& i,
+ const value_type& o,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ bool grew (false);
+
+ // value
+ //
+ {
+ // From package.hxx:68:5
+ ::std::string const& v =
+ o.string ();
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.value_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.value_value,
+ size,
+ is_null,
+ v);
+ i.value_null = is_null;
+ i.value_size = size;
+ grew = grew || (cap != i.value_value.capacity ());
+ }
+
+ // comment
+ //
+ {
+ ::std::string const& v =
+ o.comment;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.comment_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.comment_value,
+ size,
+ is_null,
+ v);
+ i.comment_null = is_null;
+ i.comment_size = size;
+ grew = grew || (cap != i.comment_value.capacity ());
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::bpkg::manifest_url, id_pgsql >::
+ init (value_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // value
+ //
+ {
+ // From package.hxx:69:5
+ ::std::string v;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.value_value,
+ i.value_size,
+ i.value_null);
+
+ // From package.hxx:69:5
+ o = brep::manifest_url ((v), "");
+ }
+
+ // comment
+ //
+ {
+ ::std::string& v =
+ o.comment;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.comment_value,
+ i.comment_size,
+ i.comment_null);
+ }
+ }
+
+ // email
+ //
+
+ bool access::composite_value_traits< ::bpkg::email, id_pgsql >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // value
+ //
+ if (t[0UL])
+ {
+ i.value_value.capacity (i.value_size);
+ grew = true;
+ }
+
+ // comment
+ //
+ if (t[1UL])
+ {
+ i.comment_value.capacity (i.comment_size);
+ grew = true;
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::bpkg::email, id_pgsql >::
+ bind (pgsql::bind* b,
+ image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (b);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ std::size_t n (0);
+ ODB_POTENTIALLY_UNUSED (n);
+
+ // value
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.value_value.data ();
+ b[n].capacity = i.value_value.capacity ();
+ b[n].size = &i.value_size;
+ b[n].is_null = &i.value_null;
+ n++;
+
+ // comment
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.comment_value.data ();
+ b[n].capacity = i.comment_value.capacity ();
+ b[n].size = &i.comment_size;
+ b[n].is_null = &i.comment_null;
+ n++;
+ }
+
+ bool access::composite_value_traits< ::bpkg::email, id_pgsql >::
+ init (image_type& i,
+ const value_type& o,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ bool grew (false);
+
+ // value
+ //
+ {
+ // From package.hxx:77:58
+ ::std::string const& v =
+ o;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.value_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.value_value,
+ size,
+ is_null,
+ v);
+ i.value_null = is_null;
+ i.value_size = size;
+ grew = grew || (cap != i.value_value.capacity ());
+ }
+
+ // comment
+ //
+ {
+ ::std::string const& v =
+ o.comment;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.comment_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.comment_value,
+ size,
+ is_null,
+ v);
+ i.comment_null = is_null;
+ i.comment_size = size;
+ grew = grew || (cap != i.comment_value.capacity ());
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::bpkg::email, id_pgsql >::
+ init (value_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // value
+ //
+ {
+ // From package.hxx:77:58
+ ::std::string& v =
+ o;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.value_value,
+ i.value_size,
+ i.value_null);
+ }
+
+ // comment
+ //
+ {
+ ::std::string& v =
+ o.comment;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.comment_value,
+ i.comment_size,
+ i.comment_null);
+ }
+ }
+
+ // version_constraint
+ //
+
+ bool access::composite_value_traits< ::bpkg::version_constraint, id_pgsql >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // min_version
+ //
+ if (composite_value_traits< ::brep::_version, id_pgsql >::grow (
+ i.min_version_value, t + 0UL))
+ grew = true;
+
+ // max_version
+ //
+ if (composite_value_traits< ::brep::_version, id_pgsql >::grow (
+ i.max_version_value, t + 6UL))
+ grew = true;
+
+ // min_open
+ //
+ t[12UL] = 0;
+
+ // max_open
+ //
+ t[13UL] = 0;
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::bpkg::version_constraint, id_pgsql >::
+ bind (pgsql::bind* b,
+ image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (b);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ std::size_t n (0);
+ ODB_POTENTIALLY_UNUSED (n);
+
+ // min_version
+ //
+ composite_value_traits< ::brep::_version, id_pgsql >::bind (
+ b + n, i.min_version_value, sk);
+ n += 6UL;
+
+ // max_version
+ //
+ composite_value_traits< ::brep::_version, id_pgsql >::bind (
+ b + n, i.max_version_value, sk);
+ n += 6UL;
+
+ // min_open
+ //
+ b[n].type = pgsql::bind::boolean_;
+ b[n].buffer = &i.min_open_value;
+ b[n].is_null = &i.min_open_null;
+ n++;
+
+ // max_open
+ //
+ b[n].type = pgsql::bind::boolean_;
+ b[n].buffer = &i.max_open_value;
+ b[n].is_null = &i.max_open_null;
+ n++;
+ }
+
+ bool access::composite_value_traits< ::bpkg::version_constraint, id_pgsql >::
+ init (image_type& i,
+ const value_type& o,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ bool grew (false);
+
+ // min_version
+ //
+ {
+ ::butl::optional< ::bpkg::version > const& v =
+ o.min_version;
+
+ // From common.hxx:75:12
+ ::brep::_optional_version const& vt =
+ (v) ? brep::_version
+ {
+ (v)->epoch, (v)->canonical_upstream, (v)->canonical_release, (v)->revision, (v)->upstream, (v)->release
+ } : brep::_optional_version ();
+
+ if (wrapper_traits< ::brep::_optional_version >::get_null (vt))
+ composite_value_traits< ::brep::_version, id_pgsql >::set_null (
+ i.min_version_value, sk);
+ else
+ {
+ const::brep::_version& vw =
+ wrapper_traits< ::brep::_optional_version >::get_ref (vt);
+
+ if (composite_value_traits< ::brep::_version, id_pgsql >::init (
+ i.min_version_value,
+ vw,
+ sk))
+ grew = true;
+ }
+ }
+
+ // max_version
+ //
+ {
+ ::butl::optional< ::bpkg::version > const& v =
+ o.max_version;
+
+ // From common.hxx:75:12
+ ::brep::_optional_version const& vt =
+ (v) ? brep::_version
+ {
+ (v)->epoch, (v)->canonical_upstream, (v)->canonical_release, (v)->revision, (v)->upstream, (v)->release
+ } : brep::_optional_version ();
+
+ if (wrapper_traits< ::brep::_optional_version >::get_null (vt))
+ composite_value_traits< ::brep::_version, id_pgsql >::set_null (
+ i.max_version_value, sk);
+ else
+ {
+ const::brep::_version& vw =
+ wrapper_traits< ::brep::_optional_version >::get_ref (vt);
+
+ if (composite_value_traits< ::brep::_version, id_pgsql >::init (
+ i.max_version_value,
+ vw,
+ sk))
+ grew = true;
+ }
+ }
+
+ // min_open
+ //
+ {
+ bool const& v =
+ o.min_open;
+
+ bool is_null (false);
+ pgsql::value_traits<
+ bool,
+ pgsql::id_boolean >::set_image (
+ i.min_open_value, is_null, v);
+ i.min_open_null = is_null;
+ }
+
+ // max_open
+ //
+ {
+ bool const& v =
+ o.max_open;
+
+ bool is_null (false);
+ pgsql::value_traits<
+ bool,
+ pgsql::id_boolean >::set_image (
+ i.max_open_value, is_null, v);
+ i.max_open_null = is_null;
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::bpkg::version_constraint, id_pgsql >::
+ init (value_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // min_version
+ //
+ {
+ ::butl::optional< ::bpkg::version >& v =
+ o.min_version;
+
+ ::brep::_optional_version vt;
+
+ if (composite_value_traits< ::brep::_version, id_pgsql >::get_null (
+ i.min_version_value))
+ wrapper_traits< ::brep::_optional_version >::set_null (vt);
+ else
+ {
+ ::brep::_version& vw =
+ wrapper_traits< ::brep::_optional_version >::set_ref (vt);
+
+ composite_value_traits< ::brep::_version, id_pgsql >::init (
+ vw,
+ i.min_version_value,
+ db);
+ }
+
+ // From common.hxx:75:12
+ v = (vt) ? bpkg::version ((vt)->epoch, std::move ((vt)->upstream), std::move ((vt)->release), (vt)->revision, 0) : brep::optional_version ();
+ }
+
+ // max_version
+ //
+ {
+ ::butl::optional< ::bpkg::version >& v =
+ o.max_version;
+
+ ::brep::_optional_version vt;
+
+ if (composite_value_traits< ::brep::_version, id_pgsql >::get_null (
+ i.max_version_value))
+ wrapper_traits< ::brep::_optional_version >::set_null (vt);
+ else
+ {
+ ::brep::_version& vw =
+ wrapper_traits< ::brep::_optional_version >::set_ref (vt);
+
+ composite_value_traits< ::brep::_version, id_pgsql >::init (
+ vw,
+ i.max_version_value,
+ db);
+ }
+
+ // From common.hxx:75:12
+ v = (vt) ? bpkg::version ((vt)->epoch, std::move ((vt)->upstream), std::move ((vt)->release), (vt)->revision, 0) : brep::optional_version ();
+ }
+
+ // min_open
+ //
+ {
+ bool& v =
+ o.min_open;
+
+ pgsql::value_traits<
+ bool,
+ pgsql::id_boolean >::set_value (
+ v,
+ i.min_open_value,
+ i.min_open_null);
+ }
+
+ // max_open
+ //
+ {
+ bool& v =
+ o.max_open;
+
+ pgsql::value_traits<
+ bool,
+ pgsql::id_boolean >::set_value (
+ v,
+ i.max_open_value,
+ i.max_open_null);
+ }
+ }
+
+ // requirement_alternatives
+ //
+
+ bool access::composite_value_traits< ::bpkg::requirement_alternatives, id_pgsql >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // conditional
+ //
+ t[0UL] = 0;
+
+ // buildtime
+ //
+ t[1UL] = 0;
+
+ // comment
+ //
+ if (t[2UL])
+ {
+ i.comment_value.capacity (i.comment_size);
+ grew = true;
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::bpkg::requirement_alternatives, id_pgsql >::
+ bind (pgsql::bind* b,
+ image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (b);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ std::size_t n (0);
+ ODB_POTENTIALLY_UNUSED (n);
+
+ // conditional
+ //
+ b[n].type = pgsql::bind::boolean_;
+ b[n].buffer = &i.conditional_value;
+ b[n].is_null = &i.conditional_null;
+ n++;
+
+ // buildtime
+ //
+ b[n].type = pgsql::bind::boolean_;
+ b[n].buffer = &i.buildtime_value;
+ b[n].is_null = &i.buildtime_null;
+ n++;
+
+ // comment
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.comment_value.data ();
+ b[n].capacity = i.comment_value.capacity ();
+ b[n].size = &i.comment_size;
+ b[n].is_null = &i.comment_null;
+ n++;
+ }
+
+ bool access::composite_value_traits< ::bpkg::requirement_alternatives, id_pgsql >::
+ init (image_type& i,
+ const value_type& o,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ bool grew (false);
+
+ // conditional
+ //
+ {
+ bool const& v =
+ o.conditional;
+
+ bool is_null (false);
+ pgsql::value_traits<
+ bool,
+ pgsql::id_boolean >::set_image (
+ i.conditional_value, is_null, v);
+ i.conditional_null = is_null;
+ }
+
+ // buildtime
+ //
+ {
+ bool const& v =
+ o.buildtime;
+
+ bool is_null (false);
+ pgsql::value_traits<
+ bool,
+ pgsql::id_boolean >::set_image (
+ i.buildtime_value, is_null, v);
+ i.buildtime_null = is_null;
+ }
+
+ // comment
+ //
+ {
+ ::std::string const& v =
+ o.comment;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.comment_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.comment_value,
+ size,
+ is_null,
+ v);
+ i.comment_null = is_null;
+ i.comment_size = size;
+ grew = grew || (cap != i.comment_value.capacity ());
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::bpkg::requirement_alternatives, id_pgsql >::
+ init (value_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // conditional
+ //
+ {
+ bool& v =
+ o.conditional;
+
+ pgsql::value_traits<
+ bool,
+ pgsql::id_boolean >::set_value (
+ v,
+ i.conditional_value,
+ i.conditional_null);
+ }
+
+ // buildtime
+ //
+ {
+ bool& v =
+ o.buildtime;
+
+ pgsql::value_traits<
+ bool,
+ pgsql::id_boolean >::set_value (
+ v,
+ i.buildtime_value,
+ i.buildtime_null);
+ }
+
+ // comment
+ //
+ {
+ ::std::string& v =
+ o.comment;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.comment_value,
+ i.comment_size,
+ i.comment_null);
+ }
+ }
+
+ // dependency
+ //
+
+ bool access::composite_value_traits< ::brep::dependency, id_pgsql >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // name
+ //
+ if (t[0UL])
+ {
+ i.name_value.capacity (i.name_size);
+ grew = true;
+ }
+
+ // constraint
+ //
+ if (composite_value_traits< ::bpkg::version_constraint, id_pgsql >::grow (
+ i.constraint_value, t + 1UL))
+ grew = true;
+
+ // package
+ //
+ if (composite_value_traits< ::brep::package_id, id_pgsql >::grow (
+ i.package_value, t + 15UL))
+ grew = true;
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::brep::dependency, id_pgsql >::
+ bind (pgsql::bind* b,
+ image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (b);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ std::size_t n (0);
+ ODB_POTENTIALLY_UNUSED (n);
+
+ // name
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.name_value.data ();
+ b[n].capacity = i.name_value.capacity ();
+ b[n].size = &i.name_size;
+ b[n].is_null = &i.name_null;
+ n++;
+
+ // constraint
+ //
+ composite_value_traits< ::bpkg::version_constraint, id_pgsql >::bind (
+ b + n, i.constraint_value, sk);
+ n += 14UL;
+
+ // package
+ //
+ composite_value_traits< ::brep::package_id, id_pgsql >::bind (
+ b + n, i.package_value, sk);
+ n += 6UL;
+ }
+
+ bool access::composite_value_traits< ::brep::dependency, id_pgsql >::
+ init (image_type& i,
+ const value_type& o,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ bool grew (false);
+
+ // name
+ //
+ {
+ ::bpkg::package_name const& v =
+ o.name;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.name_value.capacity ());
+ pgsql::value_traits<
+ ::bpkg::package_name,
+ pgsql::id_string >::set_image (
+ i.name_value,
+ size,
+ is_null,
+ v);
+ i.name_null = is_null;
+ i.name_size = size;
+ grew = grew || (cap != i.name_value.capacity ());
+ }
+
+ // constraint
+ //
+ {
+ ::butl::optional< ::bpkg::version_constraint > const& v =
+ o.constraint;
+
+ if (wrapper_traits< ::butl::optional< ::bpkg::version_constraint > >::get_null (v))
+ composite_value_traits< ::bpkg::version_constraint, id_pgsql >::set_null (
+ i.constraint_value, sk);
+ else
+ {
+ const::bpkg::version_constraint& vw =
+ wrapper_traits< ::butl::optional< ::bpkg::version_constraint > >::get_ref (v);
+
+ if (composite_value_traits< ::bpkg::version_constraint, id_pgsql >::init (
+ i.constraint_value,
+ vw,
+ sk))
+ grew = true;
+ }
+ }
+
+ // package
+ //
+ {
+ ::odb::lazy_shared_ptr< ::brep::package > const& v =
+ o.package;
+
+ typedef object_traits< ::brep::package > obj_traits;
+ typedef odb::pointer_traits< ::odb::lazy_shared_ptr< ::brep::package > > ptr_traits;
+
+ bool is_null (ptr_traits::null_ptr (v));
+ if (!is_null)
+ {
+ const obj_traits::id_type& ptr_id (
+ ptr_traits::object_id< ptr_traits::element_type > (v));
+
+ if (composite_value_traits< obj_traits::id_type, id_pgsql >::init (
+ i.package_value,
+ ptr_id,
+ sk))
+ grew = true;
+ }
+ else
+ composite_value_traits< obj_traits::id_type, id_pgsql >::set_null (i.package_value, sk);
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::brep::dependency, id_pgsql >::
+ init (value_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // name
+ //
+ {
+ ::bpkg::package_name& v =
+ o.name;
+
+ pgsql::value_traits<
+ ::bpkg::package_name,
+ pgsql::id_string >::set_value (
+ v,
+ i.name_value,
+ i.name_size,
+ i.name_null);
+ }
+
+ // constraint
+ //
+ {
+ ::butl::optional< ::bpkg::version_constraint >& v =
+ o.constraint;
+
+ if (composite_value_traits< ::bpkg::version_constraint, id_pgsql >::get_null (
+ i.constraint_value))
+ wrapper_traits< ::butl::optional< ::bpkg::version_constraint > >::set_null (v);
+ else
+ {
+ ::bpkg::version_constraint& vw =
+ wrapper_traits< ::butl::optional< ::bpkg::version_constraint > >::set_ref (v);
+
+ composite_value_traits< ::bpkg::version_constraint, id_pgsql >::init (
+ vw,
+ i.constraint_value,
+ db);
+ }
+ }
+
+ // package
+ //
+ {
+ ::odb::lazy_shared_ptr< ::brep::package >& v =
+ o.package;
+
+ typedef object_traits< ::brep::package > obj_traits;
+ typedef odb::pointer_traits< ::odb::lazy_shared_ptr< ::brep::package > > ptr_traits;
+
+ if (composite_value_traits< obj_traits::id_type, id_pgsql >::get_null (
+ i.package_value))
+ v = ptr_traits::pointer_type ();
+ else
+ {
+ obj_traits::id_type ptr_id;
+ composite_value_traits< obj_traits::id_type, id_pgsql >::init (
+ ptr_id,
+ i.package_value,
+ db);
+
+ v = ptr_traits::pointer_type (
+ *static_cast<pgsql::database*> (db), ptr_id);
+ }
+ }
+ }
+
+ // dependency_alternatives
+ //
+
+ bool access::composite_value_traits< ::brep::dependency_alternatives, id_pgsql >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // conditional
+ //
+ t[0UL] = 0;
+
+ // buildtime
+ //
+ t[1UL] = 0;
+
+ // comment
+ //
+ if (t[2UL])
+ {
+ i.comment_value.capacity (i.comment_size);
+ grew = true;
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::brep::dependency_alternatives, id_pgsql >::
+ bind (pgsql::bind* b,
+ image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (b);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ std::size_t n (0);
+ ODB_POTENTIALLY_UNUSED (n);
+
+ // conditional
+ //
+ b[n].type = pgsql::bind::boolean_;
+ b[n].buffer = &i.conditional_value;
+ b[n].is_null = &i.conditional_null;
+ n++;
+
+ // buildtime
+ //
+ b[n].type = pgsql::bind::boolean_;
+ b[n].buffer = &i.buildtime_value;
+ b[n].is_null = &i.buildtime_null;
+ n++;
+
+ // comment
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.comment_value.data ();
+ b[n].capacity = i.comment_value.capacity ();
+ b[n].size = &i.comment_size;
+ b[n].is_null = &i.comment_null;
+ n++;
+ }
+
+ bool access::composite_value_traits< ::brep::dependency_alternatives, id_pgsql >::
+ init (image_type& i,
+ const value_type& o,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ bool grew (false);
+
+ // conditional
+ //
+ {
+ bool const& v =
+ o.conditional;
+
+ bool is_null (false);
+ pgsql::value_traits<
+ bool,
+ pgsql::id_boolean >::set_image (
+ i.conditional_value, is_null, v);
+ i.conditional_null = is_null;
+ }
+
+ // buildtime
+ //
+ {
+ bool const& v =
+ o.buildtime;
+
+ bool is_null (false);
+ pgsql::value_traits<
+ bool,
+ pgsql::id_boolean >::set_image (
+ i.buildtime_value, is_null, v);
+ i.buildtime_null = is_null;
+ }
+
+ // comment
+ //
+ {
+ ::std::string const& v =
+ o.comment;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.comment_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.comment_value,
+ size,
+ is_null,
+ v);
+ i.comment_null = is_null;
+ i.comment_size = size;
+ grew = grew || (cap != i.comment_value.capacity ());
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::brep::dependency_alternatives, id_pgsql >::
+ init (value_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // conditional
+ //
+ {
+ bool& v =
+ o.conditional;
+
+ pgsql::value_traits<
+ bool,
+ pgsql::id_boolean >::set_value (
+ v,
+ i.conditional_value,
+ i.conditional_null);
+ }
+
+ // buildtime
+ //
+ {
+ bool& v =
+ o.buildtime;
+
+ pgsql::value_traits<
+ bool,
+ pgsql::id_boolean >::set_value (
+ v,
+ i.buildtime_value,
+ i.buildtime_null);
+ }
+
+ // comment
+ //
+ {
+ ::std::string& v =
+ o.comment;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.comment_value,
+ i.comment_size,
+ i.comment_null);
+ }
+ }
+
+ // test_dependency
+ //
+
+ bool access::composite_value_traits< ::brep::test_dependency, id_pgsql >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // dependency base
+ //
+ if (composite_value_traits< ::brep::dependency, id_pgsql >::grow (
+ i, t + 0UL))
+ grew = true;
+
+ // type
+ //
+ if (t[21UL])
+ {
+ i.type_value.capacity (i.type_size);
+ grew = true;
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::brep::test_dependency, id_pgsql >::
+ bind (pgsql::bind* b,
+ image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (b);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ std::size_t n (0);
+ ODB_POTENTIALLY_UNUSED (n);
+
+ // dependency base
+ //
+ composite_value_traits< ::brep::dependency, id_pgsql >::bind (b + n, i, sk);
+ n += 21UL;
+
+ // type
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.type_value.data ();
+ b[n].capacity = i.type_value.capacity ();
+ b[n].size = &i.type_size;
+ b[n].is_null = &i.type_null;
+ n++;
+ }
+
+ bool access::composite_value_traits< ::brep::test_dependency, id_pgsql >::
+ init (image_type& i,
+ const value_type& o,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ bool grew (false);
+
+ // dependency base
+ //
+ if (composite_value_traits< ::brep::dependency, id_pgsql >::init (i, o, sk))
+ grew = true;
+
+ // type
+ //
+ {
+ ::bpkg::test_dependency_type const& v =
+ o.type;
+
+ // From package.hxx:189:14
+ ::std::string const& vt =
+ to_string (v);
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.type_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.type_value,
+ size,
+ is_null,
+ vt);
+ i.type_null = is_null;
+ i.type_size = size;
+ grew = grew || (cap != i.type_value.capacity ());
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::brep::test_dependency, id_pgsql >::
+ init (value_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // dependency base
+ //
+ composite_value_traits< ::brep::dependency, id_pgsql >::init (o, i, db);
+
+ // type
+ //
+ {
+ ::bpkg::test_dependency_type& v =
+ o.type;
+
+ ::std::string vt;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ vt,
+ i.type_value,
+ i.type_size,
+ i.type_null);
+
+ // From package.hxx:189:14
+ v = brep::to_test_dependency_type (vt);
+ }
+ }
+
+ // certificate
+ //
+
+ bool access::composite_value_traits< ::brep::certificate, id_pgsql >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // fingerprint
+ //
+ if (t[0UL])
+ {
+ i.fingerprint_value.capacity (i.fingerprint_size);
+ grew = true;
+ }
+
+ // name
+ //
+ if (t[1UL])
+ {
+ i.name_value.capacity (i.name_size);
+ grew = true;
+ }
+
+ // organization
+ //
+ if (t[2UL])
+ {
+ i.organization_value.capacity (i.organization_size);
+ grew = true;
+ }
+
+ // email
+ //
+ if (t[3UL])
+ {
+ i.email_value.capacity (i.email_size);
+ grew = true;
+ }
+
+ // pem
+ //
+ if (t[4UL])
+ {
+ i.pem_value.capacity (i.pem_size);
+ grew = true;
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::brep::certificate, id_pgsql >::
+ bind (pgsql::bind* b,
+ image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (b);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ std::size_t n (0);
+ ODB_POTENTIALLY_UNUSED (n);
+
+ // fingerprint
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.fingerprint_value.data ();
+ b[n].capacity = i.fingerprint_value.capacity ();
+ b[n].size = &i.fingerprint_size;
+ b[n].is_null = &i.fingerprint_null;
+ n++;
+
+ // name
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.name_value.data ();
+ b[n].capacity = i.name_value.capacity ();
+ b[n].size = &i.name_size;
+ b[n].is_null = &i.name_null;
+ n++;
+
+ // organization
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.organization_value.data ();
+ b[n].capacity = i.organization_value.capacity ();
+ b[n].size = &i.organization_size;
+ b[n].is_null = &i.organization_null;
+ n++;
+
+ // email
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.email_value.data ();
+ b[n].capacity = i.email_value.capacity ();
+ b[n].size = &i.email_size;
+ b[n].is_null = &i.email_null;
+ n++;
+
+ // pem
+ //
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.pem_value.data ();
+ b[n].capacity = i.pem_value.capacity ();
+ b[n].size = &i.pem_size;
+ b[n].is_null = &i.pem_null;
+ n++;
+ }
+
+ bool access::composite_value_traits< ::brep::certificate, id_pgsql >::
+ init (image_type& i,
+ const value_type& o,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ bool grew (false);
+
+ // fingerprint
+ //
+ {
+ ::std::string const& v =
+ o.fingerprint;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.fingerprint_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.fingerprint_value,
+ size,
+ is_null,
+ v);
+ i.fingerprint_null = is_null;
+ i.fingerprint_size = size;
+ grew = grew || (cap != i.fingerprint_value.capacity ());
+ }
+
+ // name
+ //
+ {
+ ::std::string const& v =
+ o.name;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.name_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.name_value,
+ size,
+ is_null,
+ v);
+ i.name_null = is_null;
+ i.name_size = size;
+ grew = grew || (cap != i.name_value.capacity ());
+ }
+
+ // organization
+ //
+ {
+ ::std::string const& v =
+ o.organization;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.organization_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.organization_value,
+ size,
+ is_null,
+ v);
+ i.organization_null = is_null;
+ i.organization_size = size;
+ grew = grew || (cap != i.organization_value.capacity ());
+ }
+
+ // email
+ //
+ {
+ ::std::string const& v =
+ o.email;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.email_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.email_value,
+ size,
+ is_null,
+ v);
+ i.email_null = is_null;
+ i.email_size = size;
+ grew = grew || (cap != i.email_value.capacity ());
+ }
+
+ // pem
+ //
+ {
+ ::std::string const& v =
+ o.pem;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.pem_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.pem_value,
+ size,
+ is_null,
+ v);
+ i.pem_null = is_null;
+ i.pem_size = size;
+ grew = grew || (cap != i.pem_value.capacity ());
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::brep::certificate, id_pgsql >::
+ init (value_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // fingerprint
+ //
+ {
+ ::std::string& v =
+ o.fingerprint;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.fingerprint_value,
+ i.fingerprint_size,
+ i.fingerprint_null);
+ }
+
+ // name
+ //
+ {
+ ::std::string& v =
+ o.name;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.name_value,
+ i.name_size,
+ i.name_null);
+ }
+
+ // organization
+ //
+ {
+ ::std::string& v =
+ o.organization;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.organization_value,
+ i.organization_size,
+ i.organization_null);
+ }
+
+ // email
+ //
+ {
+ ::std::string& v =
+ o.email;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.email_value,
+ i.email_size,
+ i.email_null);
+ }
+
+ // pem
+ //
+ {
+ ::std::string& v =
+ o.pem;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.pem_value,
+ i.pem_size,
+ i.pem_null);
+ }
+ }
+
+ // tenant
+ //
+
+ const char access::object_traits_impl< ::brep::tenant, id_pgsql >::
+ persist_statement_name[] = "persist_brep_tenant";
+
+ const char access::object_traits_impl< ::brep::tenant, id_pgsql >::
+ find_statement_name[] = "find_brep_tenant";
+
+ const char access::object_traits_impl< ::brep::tenant, id_pgsql >::
+ update_statement_name[] = "update_brep_tenant";
+
+ const char access::object_traits_impl< ::brep::tenant, id_pgsql >::
+ erase_statement_name[] = "erase_brep_tenant";
+
+ const char access::object_traits_impl< ::brep::tenant, id_pgsql >::
+ query_statement_name[] = "query_brep_tenant";
+
+ const char access::object_traits_impl< ::brep::tenant, id_pgsql >::
+ erase_query_statement_name[] = "erase_query_brep_tenant";
+
+ const unsigned int access::object_traits_impl< ::brep::tenant, id_pgsql >::
+ persist_statement_types[] =
+ {
+ pgsql::text_oid,
+ pgsql::int8_oid,
+ pgsql::bool_oid
+ };
+
+ const unsigned int access::object_traits_impl< ::brep::tenant, id_pgsql >::
+ find_statement_types[] =
+ {
+ pgsql::text_oid
+ };
+
+ const unsigned int access::object_traits_impl< ::brep::tenant, id_pgsql >::
+ update_statement_types[] =
+ {
+ pgsql::int8_oid,
+ pgsql::bool_oid,
+ pgsql::text_oid
+ };
+
+ struct access::object_traits_impl< ::brep::tenant, id_pgsql >::extra_statement_cache_type
+ {
+ extra_statement_cache_type (
+ pgsql::connection&,
+ image_type&,
+ id_image_type&,
+ pgsql::binding&,
+ pgsql::binding&,
+ pgsql::native_binding&,
+ const unsigned int*)
+ {
+ }
+ };
+
+ access::object_traits_impl< ::brep::tenant, id_pgsql >::id_type
+ access::object_traits_impl< ::brep::tenant, id_pgsql >::
+ id (const image_type& i)
+ {
+ pgsql::database* db (0);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ id_type id;
+ {
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ id,
+ i.id_value,
+ i.id_size,
+ i.id_null);
+ }
+
+ return id;
+ }
+
+ bool access::object_traits_impl< ::brep::tenant, id_pgsql >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // id
+ //
+ if (t[0UL])
+ {
+ i.id_value.capacity (i.id_size);
+ grew = true;
+ }
+
+ // creation_timestamp
+ //
+ t[1UL] = 0;
+
+ // archived
+ //
+ t[2UL] = 0;
+
+ return grew;
+ }
+
+ void access::object_traits_impl< ::brep::tenant, id_pgsql >::
+ bind (pgsql::bind* b,
+ image_type& i,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ std::size_t n (0);
+
+ // id
+ //
+ if (sk != statement_update)
+ {
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.id_value.data ();
+ b[n].capacity = i.id_value.capacity ();
+ b[n].size = &i.id_size;
+ b[n].is_null = &i.id_null;
+ n++;
+ }
+
+ // creation_timestamp
+ //
+ b[n].type = pgsql::bind::bigint;
+ b[n].buffer = &i.creation_timestamp_value;
+ b[n].is_null = &i.creation_timestamp_null;
+ n++;
+
+ // archived
+ //
+ b[n].type = pgsql::bind::boolean_;
+ b[n].buffer = &i.archived_value;
+ b[n].is_null = &i.archived_null;
+ n++;
+ }
+
+ void access::object_traits_impl< ::brep::tenant, id_pgsql >::
+ bind (pgsql::bind* b, id_image_type& i)
+ {
+ std::size_t n (0);
+ b[n].type = pgsql::bind::text;
+ b[n].buffer = i.id_value.data ();
+ b[n].capacity = i.id_value.capacity ();
+ b[n].size = &i.id_size;
+ b[n].is_null = &i.id_null;
+ }
+
+ bool access::object_traits_impl< ::brep::tenant, id_pgsql >::
+ init (image_type& i,
+ const object_type& o,
+ pgsql::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace pgsql;
+
+ bool grew (false);
+
+ // id
+ //
+ if (sk == statement_insert)
+ {
+ ::std::string const& v =
+ o.id;
+
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.id_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.id_value,
+ size,
+ is_null,
+ v);
+ i.id_null = is_null;
+ i.id_size = size;
+ grew = grew || (cap != i.id_value.capacity ());
+ }
+
+ // creation_timestamp
+ //
+ {
+ ::butl::timestamp const& v =
+ o.creation_timestamp;
+
+ // From common.hxx:119:14
+ ::uint64_t const& vt =
+ std::chrono::duration_cast < std::chrono::nanoseconds > ((v).time_since_epoch ()).count ();
+
+ bool is_null (false);
+ pgsql::value_traits<
+ ::uint64_t,
+ pgsql::id_bigint >::set_image (
+ i.creation_timestamp_value, is_null, vt);
+ i.creation_timestamp_null = is_null;
+ }
+
+ // archived
+ //
+ {
+ bool const& v =
+ o.archived;
+
+ bool is_null (false);
+ pgsql::value_traits<
+ bool,
+ pgsql::id_boolean >::set_image (
+ i.archived_value, is_null, v);
+ i.archived_null = is_null;
+ }
+
+ return grew;
+ }
+
+ void access::object_traits_impl< ::brep::tenant, id_pgsql >::
+ init (object_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // id
+ //
+ {
+ ::std::string& v =
+ o.id;
+
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_value (
+ v,
+ i.id_value,
+ i.id_size,
+ i.id_null);
+ }
+
+ // creation_timestamp
+ //
+ {
+ ::butl::timestamp& v =
+ o.creation_timestamp;
+
+ ::uint64_t vt;
+
+ pgsql::value_traits<
+ ::uint64_t,
+ pgsql::id_bigint >::set_value (
+ vt,
+ i.creation_timestamp_value,
+ i.creation_timestamp_null);
+
+ // From common.hxx:119:14
+ v = brep::timestamp (std::chrono::duration_cast < brep::timestamp::duration > (std::chrono::nanoseconds (vt)));
+ }
+
+ // archived
+ //
+ {
+ bool& v =
+ o.archived;
+
+ pgsql::value_traits<
+ bool,
+ pgsql::id_boolean >::set_value (
+ v,
+ i.archived_value,
+ i.archived_null);
+ }
+ }
+
+ void access::object_traits_impl< ::brep::tenant, id_pgsql >::
+ init (id_image_type& i, const id_type& id)
+ {
+ bool grew (false);
+ {
+ bool is_null (false);
+ std::size_t size (0);
+ std::size_t cap (i.id_value.capacity ());
+ pgsql::value_traits<
+ ::std::string,
+ pgsql::id_string >::set_image (
+ i.id_value,
+ size,
+ is_null,
+ id);
+ i.id_null = is_null;
+ i.id_size = size;
+ grew = grew || (cap != i.id_value.capacity ());
+ }
+
+ if (grew)
+ i.version++;
+ }
+
+ const char access::object_traits_impl< ::brep::tenant, id_pgsql >::persist_statement[] =
+ "INSERT INTO \"tenant\" "
+ "(\"id\", "
+ "\"creation_timestamp\", "
+ "\"archived\") "
+ "VALUES "
+ "($1, $2, $3)";
+
+ const char access::object_traits_impl< ::brep::tenant, id_pgsql >::find_statement[] =
+ "SELECT "
+ "\"tenant\".\"id\", "
+ "\"tenant\".\"creation_timestamp\", "
+ "\"tenant\".\"archived\" "
+ "FROM \"tenant\" "
+ "WHERE \"tenant\