diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2024-05-21 11:08:50 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2024-05-21 11:08:50 +0300 |
commit | a51a5f81cabeb15fe8bf7fa6d02e287763758a69 (patch) | |
tree | 55e939e72deb11bbf7e0aad60000d2f3fa576ede | |
parent | 57f6378aea619ceb07b935012772bd4698e6a2be (diff) |
Make changes required for CIci
66 files changed, 92025 insertions, 38 deletions
@@ -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..2737258 --- /dev/null +++ b/clean/clean-options.cxx @@ -0,0 +1,938 @@ +// -*- 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 <utility> +#include <ostream> +#include <sstream> +#include <cstring> + +namespace cli +{ + // unknown_option + // + unknown_option:: + ~unknown_option () noexcept + { + } + + void unknown_option:: + print (::std::ostream& os) const + { + os << "unknown option '" << option ().c_str () << "'"; + } + + const char* unknown_option:: + what () const noexcept + { + return "unknown option"; + } + + // unknown_argument + // + unknown_argument:: + ~unknown_argument () noexcept + { + } + + void unknown_argument:: + print (::std::ostream& os) const + { + os << "unknown argument '" << argument ().c_str () << "'"; + } + + const char* unknown_argument:: + what () const noexcept + { + return "unknown argument"; + } + + // missing_value + // + missing_value:: + ~missing_value () noexcept + { + } + + void missing_value:: + print (::std::ostream& os) const + { + os << "missing value for option '" << option ().c_str () << "'"; + } + + const char* missing_value:: + what () const noexcept + { + return "missing option value"; + } + + // invalid_value + // + invalid_value:: + ~invalid_value () noexcept + { + } + + 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 noexcept + { + return "invalid option value"; + } + + // eos_reached + // + void eos_reached:: + print (::std::ostream& os) const + { + os << what (); + } + + const char* eos_reached:: + what () const noexcept + { + 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_; + + ++start_position_; + return r; + } + else + throw eos_reached (); + } + + void argv_scanner:: + skip () + { + if (i_ < argc_) + { + ++i_; + ++start_position_; + } + else + throw eos_reached (); + } + + std::size_t argv_scanner:: + position () + { + return start_position_; + } + + 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, bool& xs, scanner& s) + { + const char* o (s.next ()); + + if (s.more ()) + { + const char* v (s.next ()); + + if (std::strcmp (v, "1") == 0 || + std::strcmp (v, "true") == 0 || + std::strcmp (v, "TRUE") == 0 || + std::strcmp (v, "True") == 0) + x = true; + else if (std::strcmp (v, "0") == 0 || + std::strcmp (v, "false") == 0 || + std::strcmp (v, "FALSE") == 0 || + std::strcmp (v, "False") == 0) + x = false; + else + throw invalid_value (o, v); + } + else + throw missing_value (o); + + xs = 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::pair<X, std::size_t> > + { + static void + parse (std::pair<X, std::size_t>& x, bool& xs, scanner& s) + { + x.second = s.position (); + parser<X>::parse (x.first, xs, s); + } + }; + + 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::size_t pos (s.position ()); + 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, false, pos); + parser<K>::parse (k, dummy, s); + } + + if (!vstr.empty ()) + { + av[1] = const_cast<char*> (vstr.c_str ()); + argv_scanner s (0, ac, av, false, pos); + parser<V>::parse (v, dummy, s); + } + + m[k] = v; + } + else + throw missing_value (o); + + xs = true; + } + }; + + template <typename K, typename V, typename C> + struct parser<std::multimap<K, V, C> > + { + static void + parse (std::multimap<K, V, C>& m, bool& xs, scanner& s) + { + const char* o (s.next ()); + + if (s.more ()) + { + std::size_t pos (s.position ()); + 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, false, pos); + parser<K>::parse (k, dummy, s); + } + + if (!vstr.empty ()) + { + av[1] = const_cast<char*> (vstr.c_str ()); + argv_scanner s (0, ac, av, false, pos); + parser<V>::parse (v, dummy, s); + } + + m.insert (typename std::multimap<K, V, C>::value_type (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, bool X::*M> + void + thunk (X& x, scanner& s) + { + s.next (); + x.*M = true; + } + + 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> + +// 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, &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, &options::help_ >; + _cli_options_map_["--version"] = + &::cli::thunk< options, &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..d6e27f6 --- /dev/null +++ b/clean/clean-options.hxx @@ -0,0 +1,416 @@ +// -*- 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 () noexcept; + + unknown_option (const std::string& option); + + const std::string& + option () const; + + virtual void + print (::std::ostream&) const; + + virtual const char* + what () const noexcept; + + private: + std::string option_; + }; + + class unknown_argument: public exception + { + public: + virtual + ~unknown_argument () noexcept; + + unknown_argument (const std::string& argument); + + const std::string& + argument () const; + + virtual void + print (::std::ostream&) const; + + virtual const char* + what () const noexcept; + + private: + std::string argument_; + }; + + class missing_value: public exception + { + public: + virtual + ~missing_value () noexcept; + + missing_value (const std::string& option); + + const std::string& + option () const; + + virtual void + print (::std::ostream&) const; + + virtual const char* + what () const noexcept; + + private: + std::string option_; + }; + + class invalid_value: public exception + { + public: + virtual + ~invalid_value () noexcept; + + 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 noexcept; + + 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 noexcept; + }; + + // 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(). + // + // The position() function returns a monotonically-increasing + // number which, if stored, can later be used to determine the + // relative position of the argument returned by the following + // call to next(). Note that if multiple scanners are used to + // extract arguments from multiple sources, then the end + // position of the previous scanner should be used as the + // start position of the next. + // + class scanner + { + public: + virtual + ~scanner (); + + virtual bool + more () = 0; + + virtual const char* + peek () = 0; + + virtual const char* + next () = 0; + + virtual void + skip () = 0; + + virtual std::size_t + position () = 0; + }; + + class argv_scanner: public scanner + { + public: + argv_scanner (int& argc, + char** argv, + bool erase = false, + std::size_t start_position = 0); + + argv_scanner (int start, + int& argc, + char** argv, + bool erase = false, + std::size_t start_position = 0); + + int + end () const; + + virtual bool + more (); + + virtual const char* + peek (); + + virtual const char* + next (); + + virtual void + skip (); + + virtual std::size_t + position (); + + protected: + std::size_t start_position_; + 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..7b7558d --- /dev/null +++ b/clean/clean-options.ixx @@ -0,0 +1,257 @@ +// -*- 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, + std::size_t sp) + : start_position_ (sp + 1), + i_ (1), + argc_ (argc), + argv_ (argv), + erase_ (erase) + { + } + + inline argv_scanner:: + argv_scanner (int start, + int& argc, + char** argv, + bool erase, + std::size_t sp) + : start_position_ (sp + static_cast<std::size_t> (start)), + 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-021-post.sql b/libbrep/build-021-post.sql new file mode 100644 index 0000000..077c428 --- /dev/null +++ b/libbrep/build-021-post.sql @@ -0,0 +1,8 @@ +/* This file was generated by ODB, object-relational mapping (ORM) + * compiler for C++. + */ + +UPDATE "schema_version" + SET "migration" = FALSE + WHERE "name" = 'build'; + diff --git a/libbrep/build-021-pre.sql b/libbrep/build-021-pre.sql new file mode 100644 index 0000000..7f5d055 --- /dev/null +++ b/libbrep/build-021-pre.sql @@ -0,0 +1,8 @@ +/* This file was generated by ODB, object-relational mapping (ORM) + * compiler for C++. + */ + +UPDATE "schema_version" + SET "version" = 21, "migration" = TRUE + WHERE "name" = 'build'; + diff --git a/libbrep/build-022-post.sql b/libbrep/build-022-post.sql new file mode 100644 index 0000000..077c428 --- /dev/null +++ b/libbrep/build-022-post.sql @@ -0,0 +1,8 @@ +/* This file was generated by ODB, object-relational mapping (ORM) + * compiler for C++. + */ + +UPDATE "schema_version" + SET "migration" = FALSE + WHERE "name" = 'build'; + diff --git a/libbrep/build-022-pre.sql b/libbrep/build-022-pre.sql new file mode 100644 index 0000000..da7cd18 --- /dev/null +++ b/libbrep/build-022-pre.sql @@ -0,0 +1,8 @@ +/* This file was generated by ODB, object-relational mapping (ORM) + * compiler for C++. + */ + +UPDATE "schema_version" + SET "version" = 22, "migration" = TRUE + WHERE "name" = 'build'; + diff --git a/libbrep/build-023-post.sql b/libbrep/build-023-post.sql new file mode 100644 index 0000000..077c428 --- /dev/null +++ b/libbrep/build-023-post.sql @@ -0,0 +1,8 @@ +/* This file was generated by ODB, object-relational mapping (ORM) + * compiler for C++. + */ + +UPDATE "schema_version" + SET "migration" = FALSE + WHERE "name" = 'build'; + diff --git a/libbrep/build-023-pre.sql b/libbrep/build-023-pre.sql new file mode 100644 index 0000000..2ff2f7a --- /dev/null +++ b/libbrep/build-023-pre.sql @@ -0,0 +1,8 @@ +/* This file was generated by ODB, object-relational mapping (ORM) + * compiler for C++. + */ + +UPDATE "schema_version" + SET "version" = 23, "migration" = TRUE + WHERE "name" = 'build'; + diff --git a/libbrep/build-024-post.sql b/libbrep/build-024-post.sql new file mode 100644 index 0000000..077c428 --- /dev/null +++ b/libbrep/build-024-post.sql @@ -0,0 +1,8 @@ +/* This file was generated by ODB, object-relational mapping (ORM) + * compiler for C++. + */ + +UPDATE "schema_version" + SET "migration" = FALSE + WHERE "name" = 'build'; + diff --git a/libbrep/build-024-pre.sql b/libbrep/build-024-pre.sql new file mode 100644 index 0000000..9777925 --- /dev/null +++ b/libbrep/build-024-pre.sql @@ -0,0 +1,8 @@ +/* This file was generated by ODB, object-relational mapping (ORM) + * compiler for C++. + */ + +UPDATE "schema_version" + SET "version" = 24, "migration" = TRUE + WHERE "name" = 'build'; + diff --git a/libbrep/build-025-post.sql b/libbrep/build-025-post.sql new file mode 100644 index 0000000..077c428 --- /dev/null +++ b/libbrep/build-025-post.sql @@ -0,0 +1,8 @@ +/* This file was generated by ODB, object-relational mapping (ORM) + * compiler for C++. + */ + +UPDATE "schema_version" + SET "migration" = FALSE + WHERE "name" = 'build'; + diff --git a/libbrep/build-025-pre.sql b/libbrep/build-025-pre.sql new file mode 100644 index 0000000..fef3ab7 --- /dev/null +++ b/libbrep/build-025-pre.sql @@ -0,0 +1,79 @@ +/* This file was generated by ODB, object-relational mapping (ORM) + * compiler for C++. + */ + +CREATE TABLE "build_auxiliary_machines" ( + "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, + "target" TEXT NOT NULL, + "target_config_name" TEXT NOT NULL, + "package_config_name" 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, + "name" TEXT NOT NULL, + "summary" TEXT NOT NULL); + +CREATE INDEX "build_auxiliary_machines_object_id_i" + ON "build_auxiliary_machines" ( + "package_tenant", + "package_name", + "package_version_epoch", + "package_version_canonical_upstream", + "package_version_canonical_release", + "package_version_revision", + "target", + "target_config_name", + "package_config_name", + "toolchain_name", + "toolchain_version_epoch", + "toolchain_version_canonical_upstream", + "toolchain_version_canonical_release", + "toolchain_version_revision"); + +CREATE INDEX "build_auxiliary_machines_index_i" + ON "build_auxiliary_machines" ("index"); + +ALTER TABLE "build_auxiliary_machines" + ADD CONSTRAINT "object_id_fk" + FOREIGN KEY ("package_tenant", + "package_name", + "package_version_epoch", + "package_version_canonical_upstream", + "package_version_canonical_release", + "package_version_revision", + "target", + "target_config_name", + "package_config_name", + "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", + "target", + "target_config_name", + "package_config_name", + "toolchain_name", + "toolchain_version_epoch", + "toolchain_version_canonical_upstream", + "toolchain_version_canonical_release", + "toolchain_version_revision") + ON DELETE CASCADE; + +UPDATE "schema_version" + SET "version" = 25, "migration" = TRUE + WHERE "name" = 'build'; + diff --git a/libbrep/build-026-post.sql b/libbrep/build-026-post.sql new file mode 100644 index 0000000..077c428 --- /dev/null +++ b/libbrep/build-026-post.sql @@ -0,0 +1,8 @@ +/* This file was generated by ODB, object-relational mapping (ORM) + * compiler for C++. + */ + +UPDATE "schema_version" + SET "migration" = FALSE + WHERE "name" = 'build'; + diff --git a/libbrep/build-026-pre.sql b/libbrep/build-026-pre.sql new file mode 100644 index 0000000..486a186 --- /dev/null +++ b/libbrep/build-026-pre.sql @@ -0,0 +1,8 @@ +/* This file was generated by ODB, object-relational mapping (ORM) + * compiler for C++. + */ + +UPDATE "schema_version" + SET "version" = 26, "migration" = TRUE + WHERE "name" = 'build'; + diff --git a/libbrep/build-027-post.sql b/libbrep/build-027-post.sql new file mode 100644 index 0000000..077c428 --- /dev/null +++ b/libbrep/build-027-post.sql @@ -0,0 +1,8 @@ +/* This file was generated by ODB, object-relational mapping (ORM) + * compiler for C++. + */ + +UPDATE "schema_version" + SET "migration" = FALSE + WHERE "name" = 'build'; + diff --git a/libbrep/build-027-pre.sql b/libbrep/build-027-pre.sql new file mode 100644 index 0000000..44d92ea --- /dev/null +++ b/libbrep/build-027-pre.sql @@ -0,0 +1,8 @@ +/* This file was generated by ODB, object-relational mapping (ORM) + * compiler for C++. + */ + +UPDATE "schema_version" + SET "version" = 27, "migration" = TRUE + WHERE "name" = 'build'; + diff --git a/libbrep/build-028-post.sql b/libbrep/build-028-post.sql new file mode 100644 index 0000000..077c428 --- /dev/null +++ b/libbrep/build-028-post.sql @@ -0,0 +1,8 @@ +/* This file was generated by ODB, object-relational mapping (ORM) + * compiler for C++. + */ + +UPDATE "schema_version" + SET "migration" = FALSE + WHERE "name" = 'build'; + diff --git a/libbrep/build-028-pre.sql b/libbrep/build-028-pre.sql new file mode 100644 index 0000000..ee9c14e --- /dev/null +++ b/libbrep/build-028-pre.sql @@ -0,0 +1,8 @@ +/* This file was generated by ODB, object-relational mapping (ORM) + * compiler for C++. + */ + +UPDATE "schema_version" + SET "version" = 28, "migration" = TRUE + WHERE "name" = 'build'; + diff --git a/libbrep/build-extra.hxx b/libbrep/build-extra.hxx new file mode 100644 index 0000000..3e01b7e --- /dev/null +++ b/libbrep/build-extra.hxx @@ -0,0 +1,958 @@ + 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, 0x66, 0x69, 0x67, + 0x5f, 0x62, 0x6f, 0x74, 0x5f, 0x6b, 0x65, 0x79, 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, 0x63, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x5f, 0x61, 0x75, 0x78, 0x69, 0x6c, 0x69, 0x61, 0x72, 0x69, 0x65, + 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, 0x63, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 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, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 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, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 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, 0x6f, 0x74, 0x5f, 0x6b, + 0x65, 0x79, 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, 0x61, 0x75, 0x78, 0x69, 0x6c, 0x69, 0x61, 0x72, 0x69, 0x65, 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, 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, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x5f, 0x61, 0x6c, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x69, 0x76, + 0x65, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 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, + 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x5f, + 0x61, 0x6c, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 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, 0x72, 0x65, + 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 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, 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, 0x75, 0x62, + 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 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, 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, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, + 0x20, 0x42, 0x4f, 0x4f, 0x4c, 0x45, 0x41, 0x4e, 0x20, 0x4e, 0x4f, 0x54, + 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x69, 0x6e, 0x74, + 0x65, 0x72, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x20, 0x54, 0x45, 0x58, + 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x63, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x20, 0x42, 0x49, 0x47, 0x49, 0x4e, 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, 0x2c, 0x0a, 0x20, 0x20, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x5f, 0x69, 0x64, 0x20, 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e, 0x55, 0x4c, + 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x5f, 0x74, 0x79, 0x70, 0x65, 0x20, 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e, + 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x20, 0x54, 0x45, 0x58, 0x54, + 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x61, + 0x64, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x20, 0x42, 0x49, 0x47, 0x49, 0x4e, 0x54, 0x20, 0x4e, 0x55, 0x4c, + 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x71, 0x75, 0x65, 0x75, 0x65, 0x64, 0x5f, + 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x20, 0x42, 0x49, + 0x47, 0x49, 0x4e, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, + 0x20, 0x74, 0x6f, 0x6f, 0x6c, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x20, 0x54, 0x45, 0x58, 0x54, 0x20, 0x4f, 0x50, 0x54, + 0x49, 0x4f, 0x4e, 0x53, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x27, 0x62, 0x75, 0x69, 0x6c, 0x64, + 0x5f, 0x74, 0x6f, 0x6f, 0x6c, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x27, 0x29, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, + 0x20, 0x20, 0x74, 0x6f, 0x6f, 0x6c, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, + 0x68, 0x20, 0x49, 0x4e, 0x54, 0x45, 0x47, 0x45, 0x52, 0x20, 0x4f, 0x50, + 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x75, 0x6d, + 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x27, 0x62, 0x75, 0x69, 0x6c, + 0x64, 0x5f, 0x74, 0x6f, 0x6f, 0x6c, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, + 0x68, 0x27, 0x29, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, + 0x74, 0x6f, 0x6f, 0x6c, 0x63, 0x68, 0x61, 0x69, 0x6e, 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, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, + 0x53, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x20, 0x27, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x74, 0x6f, + 0x6f, 0x6c, 0x63, 0x68, 0x61, 0x69, 0x6e, 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, 0x27, 0x29, + 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x74, 0x6f, 0x6f, + 0x6c, 0x63, 0x68, 0x61, 0x69, 0x6e, 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, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x20, 0x28, 0x63, + 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x27, + 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x74, 0x6f, 0x6f, 0x6c, 0x63, 0x68, + 0x61, 0x69, 0x6e, 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, 0x27, 0x29, 0x20, 0x4e, 0x55, 0x4c, 0x4c, + 0x2c, 0x0a, 0x20, 0x20, 0x74, 0x6f, 0x6f, 0x6c, 0x63, 0x68, 0x61, 0x69, + 0x6e, 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, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x20, 0x28, + 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x20, + 0x27, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x74, 0x6f, 0x6f, 0x6c, 0x63, + 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x5f, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x27, 0x29, 0x20, + 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x74, 0x6f, 0x6f, 0x6c, + 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x5f, 0x75, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x20, 0x54, + 0x45, 0x58, 0x54, 0x20, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x20, + 0x28, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x20, 0x27, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x74, 0x6f, 0x6f, 0x6c, + 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x5f, 0x75, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x27, 0x29, + 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x74, 0x6f, 0x6f, + 0x6c, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x54, + 0x45, 0x58, 0x54, 0x20, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x20, + 0x28, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x20, 0x27, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x74, 0x6f, 0x6f, 0x6c, + 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x5f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x27, 0x29, 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, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 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, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 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, 0x66, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x70, 0x72, + 0x69, 0x6e, 0x74, 0x20, 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e, 0x4f, 0x54, + 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x22, 0x64, 0x61, + 0x74, 0x61, 0x22, 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, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 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, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x43, + 0x49, 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, + 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, + 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x20, 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e, + 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x62, 0x75, 0x69, 0x6c, 0x64, + 0x5f, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, + 0x6e, 0x74, 0x20, 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, + 0x2c, 0x0a, 0x20, 0x20, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x77, 0x61, + 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x20, + 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, + 0x20, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x77, 0x61, 0x72, 0x6e, 0x69, + 0x6e, 0x67, 0x5f, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x5f, 0x63, 0x6f, 0x6d, + 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e, 0x55, + 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, + 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x20, + 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, + 0x20, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x5f, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, + 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, + 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, 0x2c, 0x0a, + 0x20, 0x20, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x62, 0x6f, 0x74, + 0x20, 0x42, 0x4f, 0x4f, 0x4c, 0x45, 0x41, 0x4e, 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, 0x73, 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, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x73, 0x20, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x28, 0x74, 0x68, + 0x61, 0x74, 0x0a, 0x2d, 0x2d, 0x20, 0x69, 0x73, 0x20, 0x6f, 0x66, 0x20, + 0x61, 0x20, 0x33, 0x2d, 0x64, 0x69, 0x6d, 0x65, 0x6e, 0x73, 0x69, 0x6f, + 0x6e, 0x61, 0x6c, 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, 0x72, + 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 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, 0x62, 0x75, 0x69, 0x6c, 0x64, + 0x74, 0x69, 0x6d, 0x65, 0x20, 0x42, 0x4f, 0x4f, 0x4c, 0x45, 0x41, 0x4e, + 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, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x73, 0x27, 0x29, 0x3b, 0x0a, 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, 0x72, 0x65, 0x71, 0x75, 0x69, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x6c, 0x74, 0x65, 0x72, + 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 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, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x5f, 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, 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, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x54, + 0x45, 0x58, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, + 0x72, 0x65, 0x66, 0x6c, 0x65, 0x63, 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, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x72, 0x65, + 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x6c, + 0x74, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x73, 0x27, 0x29, + 0x3b, 0x0a, 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, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x5f, 0x61, 0x6c, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x69, 0x76, + 0x65, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 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, 0x72, 0x65, 0x71, + 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 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, 0x61, 0x6c, + 0x74, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 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, 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, + 0x69, 0x64, 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, 0x72, 0x65, 0x71, + 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x6c, 0x74, + 0x65, 0x72, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x72, 0x65, 0x71, + 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 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, 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, 0x6d, 0x69, 0x6e, 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, 0x6d, 0x69, 0x6e, 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, 0x6d, 0x69, 0x6e, 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, 0x2c, + 0x0a, 0x20, 0x20, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6d, 0x69, 0x6e, 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, 0x2c, 0x0a, 0x20, 0x20, 0x74, 0x65, 0x73, + 0x74, 0x5f, 0x6d, 0x69, 0x6e, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 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, 0x6d, 0x69, 0x6e, 0x5f, 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, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6d, 0x61, 0x78, 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, 0x6d, 0x61, + 0x78, 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, 0x6d, + 0x61, 0x78, 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, 0x2c, 0x0a, 0x20, 0x20, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6d, + 0x61, 0x78, 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, 0x2c, 0x0a, 0x20, 0x20, + 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6d, 0x61, 0x78, 0x5f, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 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, 0x6d, 0x61, 0x78, 0x5f, + 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, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6d, 0x69, + 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x20, 0x42, 0x4f, 0x4f, 0x4c, 0x45, + 0x41, 0x4e, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x74, + 0x65, 0x73, 0x74, 0x5f, 0x6d, 0x61, 0x78, 0x5f, 0x6f, 0x70, 0x65, 0x6e, + 0x20, 0x42, 0x4f, 0x4f, 0x4c, 0x45, 0x41, 0x4e, 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, 0x2c, 0x0a, 0x20, + 0x20, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x20, 0x54, + 0x45, 0x58, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, + 0x2c, 0x0a, 0x20, 0x20, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x62, 0x75, 0x69, + 0x6c, 0x64, 0x74, 0x69, 0x6d, 0x65, 0x20, 0x42, 0x4f, 0x4f, 0x4c, 0x45, + 0x41, 0x4e, 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, + 0x0a, 0x20, 0x20, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x65, 0x6e, 0x61, 0x62, + 0x6c, 0x65, 0x20, 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, + 0x2c, 0x0a, 0x20, 0x20, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x66, + 0x6c, 0x65, 0x63, 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, 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, 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, + 0x61, 0x75, 0x78, 0x69, 0x6c, 0x69, 0x61, 0x72, 0x69, 0x65, 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, 0x61, 0x75, 0x78, 0x69, 0x6c, + 0x69, 0x61, 0x72, 0x69, 0x65, 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, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, + 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x54, 0x45, 0x58, 0x54, 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, + 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, 0x61, 0x75, 0x78, 0x69, + 0x6c, 0x69, 0x61, 0x72, 0x69, 0x65, 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, 0x6f, 0x74, 0x5f, 0x6b, 0x65, 0x79, 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, 0x62, 0x6f, 0x74, 0x5f, 0x6b, 0x65, + 0x79, 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, 0x6b, 0x65, + 0x79, 0x5f, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x20, 0x54, 0x45, 0x58, + 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, + 0x20, 0x20, 0x6b, 0x65, 0x79, 0x5f, 0x66, 0x69, 0x6e, 0x67, 0x65, 0x72, + 0x70, 0x72, 0x69, 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, 0x62, 0x6f, 0x74, 0x5f, 0x6b, 0x65, + 0x79, 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, 0x73, 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, 0x66, 0x69, 0x67, 0x73, 0x20, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, + 0x20, 0x28, 0x74, 0x68, 0x61, 0x74, 0x20, 0x69, 0x73, 0x20, 0x61, 0x0a, + 0x2d, 0x2d, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x20, 0x6f, 0x66, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x20, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 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, 0x66, 0x69, 0x67, 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, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x20, 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x20, + 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x5f, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, + 0x20, 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, + 0x20, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x63, 0x6f, 0x6d, + 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e, 0x4f, + 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x20, 0x54, + 0x45, 0x58, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, + 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x65, 0x6d, 0x61, 0x69, 0x6c, + 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x54, 0x45, 0x58, + 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x77, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, + 0x5f, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x20, 0x54, 0x45, 0x58, 0x54, 0x20, + 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x5f, 0x77, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x65, + 0x6d, 0x61, 0x69, 0x6c, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, + 0x20, 0x54, 0x45, 0x58, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, + 0x20, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x65, 0x72, 0x72, + 0x6f, 0x72, 0x5f, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x20, 0x54, 0x45, 0x58, + 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, 0x20, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x65, + 0x6d, 0x61, 0x69, 0x6c, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 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, 0x70, 0x61, 0x63, 0x6b, 0x61, + 0x67, 0x65, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x63, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x73, 0x27, 0x29, 0x3b, 0x0a, 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, 0x66, + 0x69, 0x67, 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, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 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, + 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, + 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x62, 0x75, 0x69, 0x6c, + 0x64, 0x73, 0x27, 0x29, 0x3b, 0x0a, 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, 0x66, 0x69, 0x67, + 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, 0x63, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x5f, 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, 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, 0x66, 0x69, 0x67, 0x5f, 0x63, 0x6f, 0x6e, + 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x27, 0x29, 0x3b, 0x0a, + 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, 0x66, 0x69, 0x67, 0x5f, 0x61, 0x75, 0x78, 0x69, 0x6c, + 0x69, 0x61, 0x72, 0x69, 0x65, 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, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 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, 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, 0x6e, + 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x20, 0x54, 0x45, 0x58, 0x54, 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, 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, 0x66, 0x69, 0x67, 0x5f, 0x61, + 0x75, 0x78, 0x69, 0x6c, 0x69, 0x61, 0x72, 0x69, 0x65, 0x73, 0x27, 0x29, + 0x3b, 0x0a, 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, 0x66, 0x69, 0x67, 0x5f, 0x62, 0x6f, 0x74, + 0x5f, 0x6b, 0x65, 0x79, 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, + 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 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, 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, 0x6b, 0x65, 0x79, + 0x5f, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x20, 0x54, 0x45, 0x58, 0x54, + 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x2c, 0x0a, 0x20, + 0x20, 0x6b, 0x65, 0x79, 0x5f, 0x66, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x70, + 0x72, 0x69, 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, 0x66, 0x69, 0x67, 0x5f, + 0x62, 0x6f, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x27, 0x29, 0x3b, 0x0a diff --git a/libbrep/build-odb.cxx b/libbrep/build-odb.cxx new file mode 100644 index 0000000..6267d80 --- /dev/null +++ b/libbrep/build-odb.cxx @@ -0,0 +1,6469 @@ +// -*- 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_ptr (); + 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_ptr (); + 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_ptr (); + 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:37: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:37: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; + + // target + // + if (t[6UL]) + { + i.target_value.capacity (i.target_size); + grew = true; + } + + // target_config_name + // + if (t[7UL]) + { + i.target_config_name_value.capacity (i.target_config_name_size); + grew = true; + } + + // package_config_name + // + if (t[8UL]) + { + i.package_config_name_value.capacity (i.package_config_name_size); + grew = true; + } + + // toolchain_name + // + if (t[9UL]) + { + 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 + 10UL)) + 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; + + // target + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.target_value.data_ptr (); + b[n].capacity = i.target_value.capacity (); + b[n].size = &i.target_size; + b[n].is_null = &i.target_null; + n++; + + // target_config_name + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.target_config_name_value.data_ptr (); + b[n].capacity = i.target_config_name_value.capacity (); + b[n].size = &i.target_config_name_size; + b[n].is_null = &i.target_config_name_null; + n++; + + // package_config_name + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.package_config_name_value.data_ptr (); + b[n].capacity = i.package_config_name_value.capacity (); + b[n].size = &i.package_config_name_size; + b[n].is_null = &i.package_config_name_null; + n++; + + // toolchain_name + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.toolchain_name_value.data_ptr (); + 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; + } + + // target + // + { + ::butl::target_triplet const& v = + o.target; + + bool is_null (false); + std::size_t size (0); + std::size_t cap (i.target_value.capacity ()); + pgsql::value_traits< + ::butl::target_triplet, + 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 ()); + } + + // target_config_name + // + { + ::std::string const& v = + o.target_config_name; + + bool is_null (false); + std::size_t size (0); + std::size_t cap (i.target_config_name_value.capacity ()); + pgsql::value_traits< + ::std::string, + pgsql::id_string >::set_image ( + i.target_config_name_value, + size, + is_null, + v); + i.target_config_name_null = is_null; + i.target_config_name_size = size; + grew = grew || (cap != i.target_config_name_value.capacity ()); + } + + // package_config_name + // + { + ::std::string const& v = + o.package_config_name; + + bool is_null (false); + std::size_t size (0); + std::size_t cap (i.package_config_name_value.capacity ()); + pgsql::value_traits< + ::std::string, + pgsql::id_string >::set_image ( + i.package_config_name_value, + size, + is_null, + v); + i.package_config_name_null = is_null; + i.package_config_name_size = size; + grew = grew || (cap != i.package_config_name_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); + } + + // target + // + { + ::butl::target_triplet& v = + o.target; + + pgsql::value_traits< + ::butl::target_triplet, + pgsql::id_string >::set_value ( + v, + i.target_value, + i.target_size, + i.target_null); + } + + // target_config_name + // + { + ::std::string& v = + o.target_config_name; + + pgsql::value_traits< + ::std::string, + pgsql::id_string >::set_value ( + v, + i.target_config_name_value, + i.target_config_name_size, + i.target_config_name_null); + } + + // package_config_name + // + { + ::std::string& v = + o.package_config_name; + + pgsql::value_traits< + ::std::string, + pgsql::id_string >::set_value ( + v, + i.package_config_name_value, + i.package_config_name_size, + i.package_config_name_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_machine + // + + bool access::composite_value_traits< ::brep::build_machine, 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; + } + + // summary + // + if (t[1UL]) + { + i.summary_value.capacity (i.summary_size); + grew = true; + } + + return grew; + } + + void access::composite_value_traits< ::brep::build_machine, 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_ptr (); + b[n].capacity = i.name_value.capacity (); + b[n].size = &i.name_size; + b[n].is_null = &i.name_null; + n++; + + // summary + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.summary_value.data_ptr (); + b[n].capacity = i.summary_value.capacity (); + b[n].size = &i.summary_size; + b[n].is_null = &i.summary_null; + n++; + } + + bool access::composite_value_traits< ::brep::build_machine, 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 + // + { + ::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 ()); + } + + // summary + // + { + ::std::string const& v = + o.summary; + + bool is_null (false); + std::size_t size (0); + std::size_t cap (i.summary_value.capacity ()); + pgsql::value_traits< + ::std::string, + pgsql::id_string >::set_image ( + i.summary_value, + size, + is_null, + v); + i.summary_null = is_null; + i.summary_size = size; + grew = grew || (cap != i.summary_value.capacity ()); + } + + return grew; + } + + void access::composite_value_traits< ::brep::build_machine, 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 + // + { + ::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); + } + + // summary + // + { + ::std::string& v = + o.summary; + + pgsql::value_traits< + ::std::string, + pgsql::id_string >::set_value ( + v, + i.summary_value, + i.summary_size, + i.summary_null); + } + } + + // 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::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::text_oid, + pgsql::int8_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::int8_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::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::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::text_oid, + pgsql::int8_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::int8_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::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::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< auxiliary_machines_traits > auxiliary_machines; + pgsql::container_statements_impl< results_traits > results; + + pgsql::section_statements< ::brep::build, auxiliary_machines_section_traits > auxiliary_machines_section; + 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) + : auxiliary_machines (c, id, idn, idt), + results (c, id, idn, idt), + auxiliary_machines_section (c, im, idim, id, idv, idn, idt), + results_section (c, im, idim, id, idv, idn, idt) + { + } + }; + + // auxiliary_machines + // + + const char access::object_traits_impl< ::brep::build, id_pgsql >::auxiliary_machines_traits:: + select_name[] = "select_brep_build_auxiliary_machines"; + + const char access::object_traits_impl< ::brep::build, id_pgsql >::auxiliary_machines_traits:: + insert_name[] = "insert_brep_build_auxiliary_machines"; + + const char access::object_traits_impl< ::brep::build, id_pgsql >::auxiliary_machines_traits:: + delete_name[] = "delete_brep_build_auxiliary_machines"; + + const unsigned int access::object_traits_impl< ::brep::build, id_pgsql >::auxiliary_machines_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::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, id_pgsql >::auxiliary_machines_traits:: + select_statement[] = + "SELECT " + "\"build_auxiliary_machines\".\"index\", " + "\"build_auxiliary_machines\".\"name\", " + "\"build_auxiliary_machines\".\"summary\" " + "FROM \"build_auxiliary_machines\" " + "WHERE \"build_auxiliary_machines\".\"package_tenant\"=$1 AND \"build_auxiliary_machines\".\"package_name\"=$2::CITEXT AND \"build_auxiliary_machines\".\"package_version_epoch\"=$3 AND \"build_auxiliary_machines\".\"package_version_canonical_upstream\"=$4 AND \"build_auxiliary_machines\".\"package_version_canonical_release\"=$5 AND \"build_auxiliary_machines\".\"package_version_revision\"=$6 AND \"build_auxiliary_machines\".\"target\"=$7 AND \"build_auxiliary_machines\".\"target_config_name\"=$8 AND \"build_auxiliary_machines\".\"package_config_name\"=$9 AND \"build_auxiliary_machines\".\"toolchain_name\"=$10 AND \"build_auxiliary_machines\".\"toolchain_version_epoch\"=$11 AND \"build_auxiliary_machines\".\"toolchain_version_canonical_upstream\"=$12 AND \"build_auxiliary_machines\".\"toolchain_version_canonical_release\"=$13 AND \"build_auxiliary_machines\".\"toolchain_version_revision\"=$14 ORDER BY \"build_auxiliary_machines\".\"index\""; + + const char access::object_traits_impl< ::brep::build, id_pgsql >::auxiliary_machines_traits:: + insert_statement[] = + "INSERT INTO \"build_auxiliary_machines\" " + "(\"package_tenant\", " + "\"package_name\", " + "\"package_version_epoch\", " + "\"package_version_canonical_upstream\", " + "\"package_version_canonical_release\", " + "\"package_version_revision\", " + "\"target\", " + "\"target_config_name\", " + "\"package_config_name\", " + "\"toolchain_name\", " + "\"toolchain_version_epoch\", " + "\"toolchain_version_canonical_upstream\", " + "\"toolchain_version_canonical_release\", " + "\"toolchain_version_revision\", " + "\"index\", " + "\"name\", " + "\"summary\") " + "VALUES " + "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17)"; + + const char access::object_traits_impl< ::brep::build, id_pgsql >::auxiliary_machines_traits:: + delete_statement[] = + "DELETE FROM \"build_auxiliary_machines\" " + "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 \"target\"=$7 AND \"target_config_name\"=$8 AND \"package_config_name\"=$9 AND \"toolchain_name\"=$10 AND \"toolchain_version_epoch\"=$11 AND \"toolchain_version_canonical_upstream\"=$12 AND \"toolchain_version_canonical_release\"=$13 AND \"toolchain_version_revision\"=$14"; + + void access::object_traits_impl< ::brep::build, id_pgsql >::auxiliary_machines_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 >::auxiliary_machines_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 >::auxiliary_machines_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 >::auxiliary_machines_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 >::auxiliary_machines_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 >::auxiliary_machines_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 >::auxiliary_machines_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 >::auxiliary_machines_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 >::auxiliary_machines_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 >::auxiliary_machines_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 >::auxiliary_machines_traits:: + erase (statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + fs.ordered_ = true; + container_traits_type::erase (fs); + } + + // 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::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\".\"target\"=$7 AND \"build_results\".\"target_config_name\"=$8 AND \"build_results\".\"package_config_name\"=$9 AND \"build_results\".\"toolchain_name\"=$10 AND \"build_results\".\"toolchain_version_epoch\"=$11 AND \"build_results\".\"toolchain_version_canonical_upstream\"=$12 AND \"build_results\".\"toolchain_version_canonical_release\"=$13 AND \"build_results\".\"toolchain_version_revision\"=$14 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\", " + "\"target\", " + "\"target_config_name\", " + "\"package_config_name\", " + "\"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, $17, $18)"; + + 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 \"target\"=$7 AND \"target_config_name\"=$8 AND \"package_config_name\"=$9 AND \"toolchain_name\"=$10 AND \"toolchain_version_epoch\"=$11 AND \"toolchain_version_canonical_upstream\"=$12 AND \"toolchain_version_canonical_release\"=$13 AND \"toolchain_version_revision\"=$14"; + + 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); + } + + // auxiliary_machines_section + // + + void access::object_traits_impl< ::brep::build, id_pgsql >::auxiliary_machines_section_traits:: + load (extra_statement_cache_type& esc, object_type& obj) + { + // auxiliary_machines + // + { + ::std::vector< ::brep::build_machine >& v = + obj.auxiliary_machines; + + auxiliary_machines_traits::load ( + v, + esc.auxiliary_machines); + } + } + + void access::object_traits_impl< ::brep::build, id_pgsql >::auxiliary_machines_section_traits:: + update (extra_statement_cache_type& esc, const object_type& obj) + { + // auxiliary_machines + // + { + ::std::vector< ::brep::build_machine > const& v = + obj.auxiliary_machines; + + auxiliary_machines_traits::update ( + v, + esc.auxiliary_machines); + } + } + + // 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 + 14UL)) + grew = true; + + // toolchain_version + // + if (composite_value_traits< ::brep::upstream_version, id_pgsql >::grow ( + i.toolchain_version_value, t + 16UL)) + grew = true; + + // state + // + if (t[18UL]) + { + i.state_value.capacity (i.state_size); + grew = true; + } + + // interactive + // + if (t[19UL]) + { + i.interactive_value.capacity (i.interactive_size); + grew = true; + } + + // timestamp + // + t[20UL] = 0; + + // force + // + if (t[21UL]) + { + i.force_value.capacity (i.force_size); + grew = true; + } + + // status + // + if (t[22UL]) + { + i.status_value.capacity (i.status_size); + grew = true; + } + + // soft_timestamp + // + t[23UL] = 0; + + // hard_timestamp + // + t[24UL] = 0; + + // agent_fingerprint + // + if (t[25UL]) + { + i.agent_fingerprint_value.capacity (i.agent_fingerprint_size); + grew = true; + } + + // agent_challenge + // + if (t[26UL]) + { + i.agent_challenge_value.capacity (i.agent_challenge_size); + grew = true; + } + + // controller_checksum + // + if (t[27UL]) + { + i.controller_checksum_value.capacity (i.controller_checksum_size); + grew = true; + } + + // machine_checksum + // + if (t[28UL]) + { + i.machine_checksum_value.capacity (i.machine_checksum_size); + grew = true; + } + + // agent_checksum + // + if (t[29UL]) + { + i.agent_checksum_value.capacity (i.agent_checksum_size); + grew = true; + } + + // worker_checksum + // + if (t[30UL]) + { + i.worker_checksum_value.capacity (i.worker_checksum_size); + grew = true; + } + + // dependency_checksum + // + if (t[31UL]) + { + i.dependency_checksum_value.capacity (i.dependency_checksum_size); + grew = true; + } + + // machine_name + // + if (t[32UL]) + { + i.machine_name_value.capacity (i.machine_name_size); + grew = true; + } + + // machine_summary + // + if (t[33UL]) + { + i.machine_summary_value.capacity (i.machine_summary_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 += 14UL; + } + + // 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_ptr (); + b[n].capacity = i.state_value.capacity (); + b[n].size = &i.state_size; + b[n].is_null = &i.state_null; + n++; + + // interactive + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.interactive_value.data_ptr (); + b[n].capacity = i.interactive_value.capacity (); + b[n].size = &i.interactive_size; + b[n].is_null = &i.interactive_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_ptr (); + 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_ptr (); + b[n].capacity = i.status_value.capacity (); + b[n].size = &i.status_size; + b[n].is_null = &i.status_null; + n++; + + // soft_timestamp + // + b[n].type = pgsql::bind::bigint; + b[n].buffer = &i.soft_timestamp_value; + b[n].is_null = &i.soft_timestamp_null; + n++; + + // hard_timestamp + // + b[n].type = pgsql::bind::bigint; + b[n].buffer = &i.hard_timestamp_value; + b[n].is_null = &i.hard_timestamp_null; + n++; + + // agent_fingerprint + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.agent_fingerprint_value.data_ptr (); + 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_ptr (); + b[n].capacity = i.agent_challenge_value.capacity (); + b[n].size = &i.agent_challenge_size; + b[n].is_null = &i.agent_challenge_null; + n++; + + // controller_checksum + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.controller_checksum_value.data_ptr (); + b[n].capacity = i.controller_checksum_value.capacity (); + b[n].size = &i.controller_checksum_size; + b[n].is_null = &i.controller_checksum_null; + n++; + + // machine_checksum + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.machine_checksum_value.data_ptr (); + b[n].capacity = i.machine_checksum_value.capacity (); + b[n].size = &i.machine_checksum_size; + b[n].is_null = &i.machine_checksum_null; + n++; + + // agent_checksum + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.agent_checksum_value.data_ptr (); + b[n].capacity = i.agent_checksum_value.capacity (); + b[n].size = &i.agent_checksum_size; + b[n].is_null = &i.agent_checksum_null; + n++; + + // worker_checksum + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.worker_checksum_value.data_ptr (); + b[n].capacity = i.worker_checksum_value.capacity (); + b[n].size = &i.worker_checksum_size; + b[n].is_null = &i.worker_checksum_null; + n++; + + // dependency_checksum + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.dependency_checksum_value.data_ptr (); + b[n].capacity = i.dependency_checksum_value.capacity (); + b[n].size = &i.dependency_checksum_size; + b[n].is_null = &i.dependency_checksum_null; + n++; + + // machine_name + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.machine_name_value.data_ptr (); + b[n].capacity = i.machine_name_value.capacity (); + b[n].size = &i.machine_name_size; + b[n].is_null = &i.machine_name_null; + n++; + + // machine_summary + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.machine_summary_value.data_ptr (); + b[n].capacity = i.machine_summary_value.capacity (); + b[n].size = &i.machine_summary_size; + b[n].is_null = &i.machine_summary_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:188: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 ()); + } + + // interactive + // + { + ::butl::optional< ::std::basic_string< char > > const& v = + o.interactive; + + bool is_null (true); + std::size_t size (0); + std::size_t cap (i.interactive_value.capacity ()); + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_image ( + i.interactive_value, + size, + is_null, + v); + i.interactive_null = is_null; + i.interactive_size = size; + grew = grew || (cap != i.interactive_value.capacity ()); + } + + // timestamp + // + { + ::brep::build::timestamp_type const& v = + o.timestamp; + + // From common.hxx:123: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:210: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:220: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 ()); + } + + // soft_timestamp + // + { + ::brep::build::timestamp_type const& v = + o.soft_timestamp; + + // From common.hxx:123: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.soft_timestamp_value, is_null, vt); + i.soft_timestamp_null = is_null; + } + + // hard_timestamp + // + { + ::brep::build::timestamp_type const& v = + o.hard_timestamp; + + // From common.hxx:123: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.hard_timestamp_value, is_null, vt); + i.hard_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 ()); + } + + // controller_checksum + // + { + ::std::string const& v = + o.controller_checksum; + + bool is_null (false); + std::size_t size (0); + std::size_t cap (i.controller_checksum_value.capacity ()); + pgsql::value_traits< + ::std::string, + pgsql::id_string >::set_image ( + i.controller_checksum_value, + size, + is_null, + v); + i.controller_checksum_null = is_null; + i.controller_checksum_size = size; + grew = grew || (cap != i.controller_checksum_value.capacity ()); + } + + // machine_checksum + // + { + ::std::string const& v = + o.machine_checksum; + + bool is_null (false); + std::size_t size (0); + std::size_t cap (i.machine_checksum_value.capacity ()); + pgsql::value_traits< + ::std::string, + pgsql::id_string >::set_image ( + i.machine_checksum_value, + size, + is_null, + v); + i.machine_checksum_null = is_null; + i.machine_checksum_size = size; + grew = grew || (cap != i.machine_checksum_value.capacity ()); + } + + // agent_checksum + // + { + ::butl::optional< ::std::basic_string< char > > const& v = + o.agent_checksum; + + bool is_null (true); + std::size_t size (0); + std::size_t cap (i.agent_checksum_value.capacity ()); + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_image ( + i.agent_checksum_value, + size, + is_null, + v); + i.agent_checksum_null = is_null; + i.agent_checksum_size = size; + grew = grew || (cap != i.agent_checksum_value.capacity ()); + } + + // worker_checksum + // + { + ::butl::optional< ::std::basic_string< char > > const& v = + o.worker_checksum; + + bool is_null (true); + std::size_t size (0); + std::size_t cap (i.worker_checksum_value.capacity ()); + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_image ( + i.worker_checksum_value, + size, + is_null, + v); + i.worker_checksum_null = is_null; + i.worker_checksum_size = size; + grew = grew || (cap != i.worker_checksum_value.capacity ()); + } + + // dependency_checksum + // + { + ::butl::optional< ::std::basic_string< char > > const& v = + o.dependency_checksum; + + bool is_null (true); + std::size_t size (0); + std::size_t cap (i.dependency_checksum_value.capacity ()); + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_image ( + i.dependency_checksum_value, + size, + is_null, + v); + i.dependency_checksum_null = is_null; + i.dependency_checksum_size = size; + grew = grew || (cap != i.dependency_checksum_value.capacity ()); + } + + // machine_name + // + { + // From build.hxx:398:7 + ::std::string const& v = + o.machine.name; + + bool is_null (false); + std::size_t size (0); + std::size_t cap (i.machine_name_value.capacity ()); + pgsql::value_traits< + ::std::string, + pgsql::id_string >::set_image ( + i.machine_name_value, + size, + is_null, + v); + i.machine_name_null = is_null; + i.machine_name_size = size; + grew = grew || (cap != i.machine_name_value.capacity ()); + } + + // machine_summary + // + { + // From build.hxx:401:7 + ::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 ()); + } + + 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:383:7 + ::brep::upstream_version v; + + composite_value_traits< ::brep::upstream_version, id_pgsql >::init ( + v, + i.package_version_value, + db); + + // From build.hxx:383:7 + o.package_version.init (o.id.package.version, (v)); + } + + // toolchain_version + // + { + // From build.hxx:389:7 + ::brep::upstream_version v; + + composite_value_traits< ::brep::upstream_version, id_pgsql >::init ( + v, + i.toolchain_version_value, + db); + + // From build.hxx:389: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:188:14 + v = brep::to_build_state (vt); + } + + // interactive + // + { + ::butl::optional< ::std::basic_string< char > >& v = + o.interactive; + + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_value ( + v, + i.interactive_value, + i.interactive_size, + i.interactive_null); + } + + // 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:123: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:210: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:220:14 + v = (vt) ? bbot::to_result_status ( * (vt)) : brep::optional_result_status (); + } + + // soft_timestamp + // + { + ::brep::build::timestamp_type& v = + o.soft_timestamp; + + ::uint64_t vt; + + pgsql::value_traits< + ::uint64_t, + pgsql::id_bigint >::set_value ( + vt, + i.soft_timestamp_value, + i.soft_timestamp_null); + + // From common.hxx:123:14 + v = brep::timestamp (std::chrono::duration_cast < brep::timestamp::duration > (std::chrono::nanoseconds (vt))); + } + + // hard_timestamp + // + { + ::brep::build::timestamp_type& v = + o.hard_timestamp; + + ::uint64_t vt; + + pgsql::value_traits< + ::uint64_t, + pgsql::id_bigint >::set_value ( + vt, + i.hard_timestamp_value, + i.hard_timestamp_null); + + // From common.hxx:123: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); + } + + // controller_checksum + // + { + ::std::string& v = + o.controller_checksum; + + pgsql::value_traits< + ::std::string, + pgsql::id_string >::set_value ( + v, + i.controller_checksum_value, + i.controller_checksum_size, + i.controller_checksum_null); + } + + // machine_checksum + // + { + ::std::string& v = + o.machine_checksum; + + pgsql::value_traits< + ::std::string, + pgsql::id_string >::set_value ( + v, + i.machine_checksum_value, + i.machine_checksum_size, + i.machine_checksum_null); + } + + // agent_checksum + // + { + ::butl::optional< ::std::basic_string< char > >& v = + o.agent_checksum; + + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_value ( + v, + i.agent_checksum_value, + i.agent_checksum_size, + i.agent_checksum_null); + } + + // worker_checksum + // + { + ::butl::optional< ::std::basic_string< char > >& v = + o.worker_checksum; + + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_value ( + v, + i.worker_checksum_value, + i.worker_checksum_size, + i.worker_checksum_null); + } + + // dependency_checksum + // + { + ::butl::optional< ::std::basic_string< char > >& v = + o.dependency_checksum; + + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_value ( + v, + i.dependency_checksum_value, + i.dependency_checksum_size, + i.dependency_checksum_null); + } + + // machine_name + // + { + // From build.hxx:398:7 + ::std::string& v = + o.machine.name; + + pgsql::value_traits< + ::std::string, + pgsql::id_string >::set_value ( + v, + i.machine_name_value, + i.machine_name_size, + i.machine_name_null); + } + + // machine_summary + // + { + // From build.hxx:401:7 + ::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); + } + } + + 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\", " + "\"target\", " + "\"target_config_name\", " + "\"package_config_name\", " + "\"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\", " + "\"interactive\", " + "\"timestamp\", " + "\"force\", " + "\"status\", " + "\"soft_timestamp\", " + "\"hard_timestamp\", " + "\"agent_fingerprint\", " + "\"agent_challenge\", " + "\"controller_checksum\", " + "\"machine_checksum\", " + "\"agent_checksum\", " + "\"worker_checksum\", " + "\"dependency_checksum\", " + "\"machine\", " + "\"machine_summary\") " + "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, $27, $28, $29, $30, $31, $32, $33, $34)"; + + 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\".\"target\", " + "\"build\".\"target_config_name\", " + "\"build\".\"package_config_name\", " + "\"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\".\"interactive\", " + "\"build\".\"timestamp\", " + "\"build\".\"force\", " + "\"build\".\"status\", " + "\"build\".\"soft_timestamp\", " + "\"build\".\"hard_timestamp\", " + "\"build\".\"agent_fingerprint\", " + "\"build\".\"agent_challenge\", " + "\"build\".\"controller_checksum\", " + "\"build\".\"machine_checksum\", " + "\"build\".\"agent_checksum\", " + "\"build\".\"worker_checksum\", " + "\"build\".\"dependency_checksum\", " + "\"build\".\"machine\", " + "\"build\".\"machine_summary\" " + "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\".\"target\"=$7 AND \"build\".\"target_config_name\"=$8 AND \"build\".\"package_config_name\"=$9 AND \"build\".\"toolchain_name\"=$10 AND \"build\".\"toolchain_version_epoch\"=$11 AND \"build\".\"toolchain_version_canonical_upstream\"=$12 AND \"build\".\"toolchain_version_canonical_release\"=$13 AND \"build\".\"toolchain_version_revision\"=$14"; + + 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, " + "\"interactive\"=$6, " + "\"timestamp\"=$7, " + "\"force\"=$8, " + "\"status\"=$9, " + "\"soft_timestamp\"=$10, " + "\"hard_timestamp\"=$11, " + "\"agent_fingerprint\"=$12, " + "\"agent_challenge\"=$13, " + "\"controller_checksum\"=$14, " + "\"machine_checksum\"=$15, " + "\"agent_checksum\"=$16, " + "\"worker_checksum\"=$17, " + "\"dependency_checksum\"=$18, " + "\"machine\"=$19, " + "\"machine_summary\"=$20 " + "WHERE \"package_tenant\"=$21 AND \"package_name\"=$22::CITEXT AND \"package_version_epoch\"=$23 AND \"package_version_canonical_upstream\"=$24 AND \"package_version_canonical_release\"=$25 AND \"package_version_revision\"=$26 AND \"target\"=$27 AND \"target_config_name\"=$28 AND \"package_config_name\"=$29 AND \"toolchain_name\"=$30 AND \"toolchain_version_epoch\"=$31 AND \"toolchain_version_canonical_upstream\"=$32 AND \"toolchain_version_canonical_release\"=$33 AND \"toolchain_version_revision\"=$34"; + + 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 \"target\"=$7 AND \"target_config_name\"=$8 AND \"package_config_name\"=$9 AND \"toolchain_name\"=$10 AND \"toolchain_version_epoch\"=$11 AND \"toolchain_version_canonical_upstream\"=$12 AND \"toolchain_version_canonical_release\"=$13 AND \"toolchain_version_revision\"=$14"; + + 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\".\"target\", " + "\"build\".\"target_config_name\", " + "\"build\".\"package_config_name\", " + "\"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\".\"interactive\", " + "\"build\".\"timestamp\", " + "\"build\".\"force\", " + "\"build\".\"status\", " + "\"build\".\"soft_timestamp\", " + "\"build\".\"hard_timestamp\", " + "\"build\".\"agent_fingerprint\", " + "\"build\".\"agent_challenge\", " + "\"build\".\"controller_checksum\", " + "\"build\".\"machine_checksum\", " + "\"build\".\"agent_checksum\", " + "\"build\".\"worker_checksum\", " + "\"build\".\"dependency_checksum\", " + "\"build\".\"machine\", " + "\"build\".\"machine_summary\" " + "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) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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 ()); + + // auxiliary_machines + // + { + ::std::vector< ::brep::build_machine > const& v = + obj.auxiliary_machines; + + auxiliary_machines_traits::persist ( + v, + esc.auxiliary_machines); + } + + // results + // + { + ::bbot::operation_results const& v = + obj.results; + + results_traits::persist ( + v, + esc.results); + } + + obj.auxiliary_machines_section.reset (true, false); + + 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 (db)); + 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.auxiliary_machines_section.loaded ()) + { + auxiliary_machines_section_traits::update (esc, obj); + } + + 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; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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 ()); + + // auxiliary_machines + // + { + auxiliary_machines_traits::erase ( + esc.auxiliary_machines); + } + + // 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 (db)); + 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 (db)); + 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 (db)); + 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.auxiliary_machines_section) + { + auxiliary_machines_section_traits::load (esc, obj); + r = true; + } + + 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.auxiliary_machines_section)auxiliary_machines_section_traits::update (esc, obj); + else 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.auxiliary_machines_section.loaded ()) + { + auxiliary_machines_section_traits::load (esc, obj); + obj.auxiliary_machines_section.reset (true, false); + } + } + else + obj.auxiliary_machines_section.reset (); + + 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& db, const query_base_type& q) + { + using namespace pgsql; + using odb::details::shared; + using odb::details::shared_ptr; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + + 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& db, const query_base_type& q) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + + 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::transaction& tr (pgsql::transaction::current ()); + ODB_POTENTIALLY_UNUSED (tr); + + // The connection used by the current transaction and the + // one used to prepare this statement must be the same. + // + assert (q.verify_connection (tr)); + + statements_type& sts ( + st->connection ().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_ptr (); + 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_ptr (); + 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_ptr (); + 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:450: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:454: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:458: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:462: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:447:7 + ::brep::upstream_version v; + + composite_value_traits< ::brep::upstream_version, id_pgsql >::init ( + v, + i.version_value, + db); + + // From build.hxx:447: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:432: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& db, const query_base_type& q) + { + using namespace pgsql; + using odb::details::shared; + using odb::details::shared_ptr; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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::transaction& tr (pgsql::transaction::current ()); + ODB_POTENTIALLY_UNUSED (tr); + + // The connection used by the current transaction and the + // one used to prepare this statement must be the same. + // + assert (q.verify_connection (tr)); + + statements_type& sts ( + st->connection ().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; + + // archived + // + t[34UL] = 0; + + 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 += 34UL; + + // 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::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 (*db)); + + // 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); + } + } + + // archived + // + { + bool& v = + o.archived; + + pgsql::value_traits< + bool, + pgsql::id_boolean >::set_value ( + v, + i.archived_value, + i.archived_null); + } + + // 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\".\"target\", " + "\"build\".\"target_config_name\", " + "\"build\".\"package_config_name\", " + "\"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\".\"interactive\", " + "\"build\".\"timestamp\", " + "\"build\".\"force\", " + "\"build\".\"status\", " + "\"build\".\"soft_timestamp\", " + "\"build\".\"hard_timestamp\", " + "\"build\".\"agent_fingerprint\", " + "\"build\".\"agent_challenge\", " + "\"build\".\"controller_checksum\", " + "\"build\".\"machine_checksum\", " + "\"build\".\"agent_checksum\", " + "\"build\".\"worker_checksum\", " + "\"build\".\"dependency_checksum\", " + "\"build\".\"machine\", " + "\"build\".\"machine_summary\", " + "\"build_tenant\".\"archived\" "); + + r += "FROM \"build\""; + + r += " INNER JOIN \"build_package\" ON"; + // From build.hxx:476: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:479: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& db, const query_base_type& q) + { + using namespace pgsql; + using odb::details::shared; + using odb::details::shared_ptr; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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::transaction& tr (pgsql::transaction::current ()); + ODB_POTENTIALLY_UNUSED (tr); + + // The connection used by the current transaction and the + // one used to prepare this statement must be the same. + // + assert (q.verify_connection (tr)); + + statements_type& sts ( + st->connection ().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:488: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:491: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& db, const query_base_type& q) + { + using namespace pgsql; + using odb::details::shared; + using odb::details::shared_ptr; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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::transaction& tr (pgsql::transaction::current ()); + ODB_POTENTIALLY_UNUSED (tr); + + // The connection used by the current transaction and the + // one used to prepare this statement must be the same. + // + assert (q.verify_connection (tr)); + + statements_type& sts ( + st->connection ().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_id + // + + const char access::view_traits_impl< ::brep::package_build_id, id_pgsql >:: + query_statement_name[] = "query_brep_package_build_id"; + + bool access::view_traits_impl< ::brep::package_build_id, 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; + + return grew; + } + + void access::view_traits_impl< ::brep::package_build_id, 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::build_id, id_pgsql >::bind ( + b + n, i.id_value, sk); + n += 14UL; + } + + void access::view_traits_impl< ::brep::package_build_id, 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::build_id& v = + o.id; + + composite_value_traits< ::brep::build_id, id_pgsql >::init ( + v, + i.id_value, + db); + } + } + + access::view_traits_impl< ::brep::package_build_id, id_pgsql >::query_base_type + access::view_traits_impl< ::brep::package_build_id, 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\".\"target\", " + "\"build\".\"target_config_name\", " + "\"build\".\"package_config_name\", " + "\"build\".\"toolchain_name\", " + "\"build\".\"toolchain_version_epoch\", " + "\"build\".\"toolchain_version_canonical_upstream\", " + "\"build\".\"toolchain_version_canonical_release\", " + "\"build\".\"toolchain_version_revision\" "); + + r += "FROM \"build\""; + + r += " INNER JOIN \"build_package\" ON"; + // From build.hxx:506: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::package_build_id, id_pgsql >::view_type > + access::view_traits_impl< ::brep::package_build_id, id_pgsql >:: + query (database& db, const query_base_type& q) + { + using namespace pgsql; + using odb::details::shared; + using odb::details::shared_ptr; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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, 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, 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::transaction& tr (pgsql::transaction::current ()); + ODB_POTENTIALLY_UNUSED (tr); + + // The connection used by the current transaction and the + // one used to prepare this statement must be the same. + // + assert (q.verify_connection (tr)); + + statements_type& sts ( + st->connection ().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::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, + 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::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::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::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 + 14UL)) + grew = true; + + // toolchain_version + // + if (composite_value_traits< ::brep::upstream_version, id_pgsql >::grow ( + i.toolchain_version_value, t + 16UL)) + grew = true; + + // report_soft_timestamp + // + t[18UL] = 0; + + // report_hard_timestamp + // + t[19UL] = 0; + + // package_timestamp + // + t[20UL] = 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 += 14UL; + } + + // 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_soft_timestamp + // + b[n].type = pgsql::bind::bigint; + b[n].buffer = &i.report_soft_timestamp_value; + b[n].is_null = &i.report_soft_timestamp_null; + n++; + + // report_hard_timestamp + // + b[n].type = pgsql::bind::bigint; + b[n].buffer = &i.report_hard_timestamp_value; + b[n].is_null = &i.report_hard_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_soft_timestamp + // + { + ::butl::timestamp const& v = + o.report_soft_timestamp; + + // From common.hxx:123: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_soft_timestamp_value, is_null, vt); + i.report_soft_timestamp_null = is_null; + } + + // report_hard_timestamp + // + { + ::butl::timestamp const& v = + o.report_hard_timestamp; + + // From common.hxx:123: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_hard_timestamp_value, is_null, vt); + i.report_hard_timestamp_null = is_null; + } + + // package_timestamp + // + { + ::butl::timestamp const& v = + o.package_timestamp; + + // From common.hxx:123: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:570:7 + ::brep::upstream_version v; + + composite_value_traits< ::brep::upstream_version, id_pgsql >::init ( + v, + i.package_version_value, + db); + + // From build.hxx:570:7 + o.package_version.init (o.id.package.version, (v)); + } + + // toolchain_version + // + { + // From build.hxx:576:7 + ::brep::upstream_version v; + + composite_value_traits< ::brep::upstream_version, id_pgsql >::init ( + v, + i.toolchain_version_value, + db); + + // From build.hxx:576:7 + o.toolchain_version.init (o.id.toolchain_version, (v)); + } + + // report_soft_timestamp + // + { + ::butl::timestamp& v = + o.report_soft_timestamp; + + ::uint64_t vt; + + pgsql::value_traits< + ::uint64_t, + pgsql::id_bigint >::set_value ( + vt, + i.report_soft_timestamp_value, + i.report_soft_timestamp_null); + + // From common.hxx:123:14 + v = brep::timestamp (std::chrono::duration_cast < brep::timestamp::duration > (std::chrono::nanoseconds (vt))); + } + + // report_hard_timestamp + // + { + ::butl::timestamp& v = + o.report_hard_timestamp; + + ::uint64_t vt; + + pgsql::value_traits< + ::uint64_t, + pgsql::id_bigint >::set_value ( + vt, + i.report_hard_timestamp_value, + i.report_hard_timestamp_null); + + // From common.hxx:123: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:123: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\", " + "\"target\", " + "\"target_config_name\", " + "\"package_config_name\", " + "\"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_soft_timestamp\", " + "\"report_hard_timestamp\", " + "\"package_timestamp\") " + "VALUES " + "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21)"; + + 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\".\"target\", " + "\"build_delay\".\"target_config_name\", " + "\"build_delay\".\"package_config_name\", " + "\"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_soft_timestamp\", " + "\"build_delay\".\"report_hard_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\".\"target\"=$7 AND \"build_delay\".\"target_config_name\"=$8 AND \"build_delay\".\"package_config_name\"=$9 AND \"build_delay\".\"toolchain_name\"=$10 AND \"build_delay\".\"toolchain_version_epoch\"=$11 AND \"build_delay\".\"toolchain_version_canonical_upstream\"=$12 AND \"build_delay\".\"toolchain_version_canonical_release\"=$13 AND \"build_delay\".\"toolchain_version_revision\"=$14"; + + 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_soft_timestamp\"=$5, " + "\"report_hard_timestamp\"=$6, " + "\"package_timestamp\"=$7 " + "WHERE \"package_tenant\"=$8 AND \"package_name\"=$9::CITEXT AND \"package_version_epoch\"=$10 AND \"package_version_canonical_upstream\"=$11 AND \"package_version_canonical_release\"=$12 AND \"package_version_revision\"=$13 AND \"target\"=$14 AND \"target_config_name\"=$15 AND \"package_config_name\"=$16 AND \"toolchain_name\"=$17 AND \"toolchain_version_epoch\"=$18 AND \"toolchain_version_canonical_upstream\"=$19 AND \"toolchain_version_canonical_release\"=$20 AND \"toolchain_version_revision\"=$21"; + + 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 \"target\"=$7 AND \"target_config_name\"=$8 AND \"package_config_name\"=$9 AND \"toolchain_name\"=$10 AND \"toolchain_version_epoch\"=$11 AND \"toolchain_version_canonical_upstream\"=$12 AND \"toolchain_version_canonical_release\"=$13 AND \"toolchain_version_revision\"=$14"; + + 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\".\"target\", " + "\"build_delay\".\"target_config_name\", " + "\"build_delay\".\"package_config_name\", " + "\"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_soft_timestamp\", " + "\"build_delay\".\"report_hard_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) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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 (db)); + 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; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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 (db)); + 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 (db)); + 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 (db)); + 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& db, const query_base_type& q) + { + using namespace pgsql; + using odb::details::shared; + using odb::details::shared_ptr; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + + 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& db, const query_base_type& q) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + + 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::transaction& tr (pgsql::transaction::current ()); + ODB_POTENTIALLY_UNUSED (tr); + + // The connection used by the current transaction and the + // one used to prepare this statement must be the same. + // + assert (q.verify_connection (tr)); + + statements_type& sts ( + st->connection ().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_auxiliary_machines\" 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" + " \"target\" TEXT NOT NULL,\n" + " \"target_config_name\" TEXT NOT NULL,\n" + " \"package_config_name\" 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" + " \"interactive\" TEXT NULL,\n" + " \"timestamp\" BIGINT NOT NULL,\n" + " \"force\" TEXT NOT NULL,\n" + " \"status\" TEXT NULL,\n" + " \"soft_timestamp\" BIGINT NOT NULL,\n" + " \"hard_timestamp\" BIGINT NOT NULL,\n" + " \"agent_fingerprint\" TEXT NULL,\n" + " \"agent_challenge\" TEXT NULL,\n" + " \"controller_checksum\" TEXT NOT NULL,\n" + " \"machine_checksum\" TEXT NOT NULL,\n" + " \"agent_checksum\" TEXT NULL,\n" + " \"worker_checksum\" TEXT NULL,\n" + " \"dependency_checksum\" TEXT NULL,\n" + " \"machine\" TEXT NOT NULL,\n" + " \"machine_summary\" 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" + " \"target\",\n" + " \"target_config_name\",\n" + " \"package_config_name\",\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_auxiliary_machines\" (\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" + " \"target\" TEXT NOT NULL,\n" + " \"target_config_name\" TEXT NOT NULL,\n" + " \"package_config_name\" 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" + " \"name\" TEXT NOT NULL,\n" + " \"summary\" 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" + " \"target\",\n" + " \"target_config_name\",\n" + " \"package_config_name\",\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" + " \"target\",\n" + " \"target_config_name\",\n" + " \"package_config_name\",\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_auxiliary_machines_object_id_i\"\n" + " ON \"build_auxiliary_machines\" (\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" + " \"target\",\n" + " \"target_config_name\",\n" + " \"package_config_name\",\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_auxiliary_machines_index_i\"\n" + " ON \"build_auxiliary_machines\" (\"index\")"); + 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" + " \"target\" TEXT NOT NULL,\n" + " \"target_config_name\" TEXT NOT NULL,\n" + " \"package_config_name\" 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" + " \"target\",\n" + " \"target_config_name\",\n" + " \"package_config_name\",\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" + " \"target\",\n" + " \"target_config_name\",\n" + " \"package_config_name\",\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" + " \"target\",\n" + " \"target_config_name\",\n" + " \"package_config_name\",\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" + " \"target\" TEXT NOT NULL,\n" + " \"target_config_name\" TEXT NOT NULL,\n" + " \"package_config_name\" 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_soft_timestamp\" BIGINT NOT NULL,\n" + " \"report_hard_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" + " \"target\",\n" + " \"target_config_name\",\n" + " \"package_config_name\",\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', 28, 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_20_ ( + id_pgsql, + "build", + 20ULL, + 0); + + static bool + migrate_schema_21 (database& db, unsigned short pass, bool pre) + { + ODB_POTENTIALLY_UNUSED (db); + ODB_POTENTIALLY_UNUSED (pass); + ODB_POTENTIALLY_UNUSED (pre); + + if (pre) + { + switch (pass) + { + case 1: + { + return true; + } + case 2: + { + db.execute ("UPDATE \"schema_version\"\n" + " SET \"version\" = 21, \"migration\" = TRUE\n" + " WHERE \"name\" = 'build'"); + return false; + } + } + } + else + { + switch (pass) + { + case 1: + { + return true; + } + case 2: + { + db.execute ("UPDATE \"schema_version\"\n" + " SET \"migration\" = FALSE\n" + " WHERE \"name\" = 'build'"); + return false; + } + } + } + + return false; + } + + static const schema_catalog_migrate_entry + migrate_schema_entry_21_ ( + id_pgsql, + "build", + 21ULL, + &migrate_schema_21); + + static bool + migrate_schema_22 (database& db, unsigned short pass, bool pre) + { + ODB_POTENTIALLY_UNUSED (db); + ODB_POTENTIALLY_UNUSED (pass); + ODB_POTENTIALLY_UNUSED (pre); + + if (pre) + { + switch (pass) + { + case 1: + { + return true; + } + case 2: + { + db.execute ("UPDATE \"schema_version\"\n" + " SET \"version\" = 22, \"migration\" = TRUE\n" + " WHERE \"name\" = 'build'"); + return false; + } + } + } + else + { + switch (pass) + { + case 1: + { + return true; + } + case 2: + { + db.execute ("UPDATE \"schema_version\"\n" + " SET \"migration\" = FALSE\n" + " WHERE \"name\" = 'build'"); + return false; + } + } + } + + return false; + } + + static const schema_catalog_migrate_entry + migrate_schema_entry_22_ ( + id_pgsql, + "build", + 22ULL, + &migrate_schema_22); + + static bool + migrate_schema_23 (database& db, unsigned short pass, bool pre) + { + ODB_POTENTIALLY_UNUSED (db); + ODB_POTENTIALLY_UNUSED (pass); + ODB_POTENTIALLY_UNUSED (pre); + + if (pre) + { + switch (pass) + { + case 1: + { + return true; + } + case 2: + { + db.execute ("UPDATE \"schema_version\"\n" + " SET \"version\" = 23, \"migration\" = TRUE\n" + " WHERE \"name\" = 'build'"); + return false; + } + } + } + else + { + switch (pass) + { + case 1: + { + return true; + } + case 2: + { + db.execute ("UPDATE \"schema_version\"\n" + " SET \"migration\" = FALSE\n" + " WHERE \"name\" = 'build'"); + return false; + } + } + } + + return false; + } + + static const schema_catalog_migrate_entry + migrate_schema_entry_23_ ( + id_pgsql, + "build", + 23ULL, + &migrate_schema_23); + + static bool + migrate_schema_24 (database& db, unsigned short pass, bool pre) + { + ODB_POTENTIALLY_UNUSED (db); + ODB_POTENTIALLY_UNUSED (pass); + ODB_POTENTIALLY_UNUSED (pre); + + if (pre) + { + switch (pass) + { + case 1: + { + return true; + } + case 2: + { + db.execute ("UPDATE \"schema_version\"\n" + " SET \"version\" = 24, \"migration\" = TRUE\n" + " WHERE \"name\" = 'build'"); + return false; + } + } + } + else + { + switch (pass) + { + case 1: + { + return true; + } + case 2: + { + db.execute ("UPDATE \"schema_version\"\n" + " SET \"migration\" = FALSE\n" + " WHERE \"name\" = 'build'"); + return false; + } + } + } + + return false; + } + + static const schema_catalog_migrate_entry + migrate_schema_entry_24_ ( + id_pgsql, + "build", + 24ULL, + &migrate_schema_24); + + static bool + migrate_schema_25 (database& db, unsigned short pass, bool pre) + { + ODB_POTENTIALLY_UNUSED (db); + ODB_POTENTIALLY_UNUSED (pass); + ODB_POTENTIALLY_UNUSED (pre); + + if (pre) + { + switch (pass) + { + case 1: + { + db.execute ("CREATE TABLE \"build_auxiliary_machines\" (\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" + " \"target\" TEXT NOT NULL,\n" + " \"target_config_name\" TEXT NOT NULL,\n" + " \"package_config_name\" 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" + " \"name\" TEXT NOT NULL,\n" + " \"summary\" TEXT NOT NULL)"); + db.execute ("CREATE INDEX \"build_auxiliary_machines_object_id_i\"\n" + " ON \"build_auxiliary_machines\" (\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" + " \"target\",\n" + " \"target_config_name\",\n" + " \"package_config_name\",\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_auxiliary_machines_index_i\"\n" + " ON \"build_auxiliary_machines\" (\"index\")"); + return true; + } + case 2: + { + db.execute ("ALTER TABLE \"build_auxiliary_machines\"\n" + " ADD 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" + " \"target\",\n" + " \"target_config_name\",\n" + " \"package_config_name\",\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" + " \"target\",\n" + " \"target_config_name\",\n" + " \"package_config_name\",\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 ("UPDATE \"schema_version\"\n" + " SET \"version\" = 25, \"migration\" = TRUE\n" + " WHERE \"name\" = 'build'"); + return false; + } + } + } + else + { + switch (pass) + { + case 1: + { + return true; + } + case 2: + { + db.execute ("UPDATE \"schema_version\"\n" + " SET \"migration\" = FALSE\n" + " WHERE \"name\" = 'build'"); + return false; + } + } + } + + return false; + } + + static const schema_catalog_migrate_entry + migrate_schema_entry_25_ ( + id_pgsql, + "build", + 25ULL, + &migrate_schema_25); + + static bool + migrate_schema_26 (database& db, unsigned short pass, bool pre) + { + ODB_POTENTIALLY_UNUSED (db); + ODB_POTENTIALLY_UNUSED (pass); + ODB_POTENTIALLY_UNUSED (pre); + + if (pre) + { + switch (pass) + { + case 1: + { + return true; + } + case 2: + { + db.execute ("UPDATE \"schema_version\"\n" + " SET \"version\" = 26, \"migration\" = TRUE\n" + " WHERE \"name\" = 'build'"); + return false; + } + } + } + else + { + switch (pass) + { + case 1: + { + return true; + } + case 2: + { + db.execute ("UPDATE \"schema_version\"\n" + " SET \"migration\" = FALSE\n" + " WHERE \"name\" = 'build'"); + return false; + } + } + } + + return false; + } + + static const schema_catalog_migrate_entry + migrate_schema_entry_26_ ( + id_pgsql, + "build", + 26ULL, + &migrate_schema_26); + + static bool + migrate_schema_27 (database& db, unsigned short pass, bool pre) + { + ODB_POTENTIALLY_UNUSED (db); + ODB_POTENTIALLY_UNUSED (pass); + ODB_POTENTIALLY_UNUSED (pre); + + if (pre) + { + switch (pass) + { + case 1: + { + return true; + } + case 2: + { + db.execute ("UPDATE \"schema_version\"\n" + " SET \"version\" = 27, \"migration\" = TRUE\n" + " WHERE \"name\" = 'build'"); + return false; + } + } + } + else + { + switch (pass) + { + case 1: + { + return true; + } + case 2: + { + db.execute ("UPDATE \"schema_version\"\n" + " SET \"migration\" = FALSE\n" + " WHERE \"name\" = 'build'"); + return false; + } + } + } + + return false; + } + + static const schema_catalog_migrate_entry + migrate_schema_entry_27_ ( + id_pgsql, + "build", + 27ULL, + &migrate_schema_27); + + static bool + migrate_schema_28 (database& db, unsigned short pass, bool pre) + { + ODB_POTENTIALLY_UNUSED (db); + ODB_POTENTIALLY_UNUSED (pass); + ODB_POTENTIALLY_UNUSED (pre); + + if (pre) + { + switch (pass) + { + case 1: + { + return true; + } + case 2: + { + db.execute ("UPDATE \"schema_version\"\n" + " SET \"version\" = 28, \"migration\" = TRUE\n" + " WHERE \"name\" = 'build'"); + return false; + } + } + } + else + { + switch (pass) + { + case 1: + { + return true; + } + case 2: + { + db.execute ("UPDATE \"schema_version\"\n" + " SET \"migration\" = FALSE\n" + " WHERE \"name\" = 'build'"); + return false; + } + } + } + + return false; + } + + static const schema_catalog_migrate_entry + migrate_schema_entry_28_ ( + id_pgsql, + "build", + 28ULL, + &migrate_schema_28); +} + +#include <odb/post.hxx> diff --git a/libbrep/build-odb.hxx b/libbrep/build-odb.hxx new file mode 100644 index 0000000..d946f47 --- /dev/null +++ b/libbrep/build-odb.hxx @@ -0,0 +1,2568 @@ +// -*- 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 != 20476UL +#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); + }; + + // package_build_id + // + template <> + struct class_traits< ::brep::package_build_id > + { + static const class_kind kind = class_view; + }; + + template <> + class access::view_traits< ::brep::package_build_id > + { + public: + typedef ::brep::package_build_id view_type; + typedef ::brep::package_build_id* 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; + + // target + // + details::buffer target_value; + std::size_t target_size; + bool target_null; + + // target_config_name + // + details::buffer target_config_name_value; + std::size_t target_config_name_size; + bool target_config_name_null; + + // package_config_name + // + details::buffer package_config_name_value; + std::size_t package_config_name_size; + bool package_config_name_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 = 14UL; + }; + + // build_machine + // + template <> + class access::composite_value_traits< ::brep::build_machine, id_pgsql > + { + public: + typedef ::brep::build_machine value_type; + + struct image_type + { + // name + // + details::buffer name_value; + std::size_t name_size; + bool name_null; + + // summary + // + details::buffer summary_value; + std::size_t summary_size; + bool summary_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; + }; + + // 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; + + // target + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::butl::target_triplet, + pgsql::id_string >::query_type, + pgsql::id_string > + target_type_; + + static const target_type_ target; + + // target_config_name + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + target_config_name_type_; + + static const target_config_name_type_ target_config_name; + + // package_config_name + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + package_config_name_type_; + + static const package_config_name_type_ package_config_name; + + // 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; + + // interactive + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::basic_string< char >, + pgsql::id_string >::query_type, + pgsql::id_string > + interactive_type_; + + static const interactive_type_ interactive; + + // 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; + + // soft_timestamp + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::uint64_t, + pgsql::id_bigint >::query_type, + pgsql::id_bigint > + soft_timestamp_type_; + + static const soft_timestamp_type_ soft_timestamp; + + // hard_timestamp + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::uint64_t, + pgsql::id_bigint >::query_type, + pgsql::id_bigint > + hard_timestamp_type_; + + static const hard_timestamp_type_ hard_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; + + // controller_checksum + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + controller_checksum_type_; + + static const controller_checksum_type_ controller_checksum; + + // machine_checksum + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + machine_checksum_type_; + + static const machine_checksum_type_ machine_checksum; + + // agent_checksum + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::basic_string< char >, + pgsql::id_string >::query_type, + pgsql::id_string > + agent_checksum_type_; + + static const agent_checksum_type_ agent_checksum; + + // worker_checksum + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::basic_string< char >, + pgsql::id_string >::query_type, + pgsql::id_string > + worker_checksum_type_; + + static const worker_checksum_type_ worker_checksum; + + // dependency_checksum + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::basic_string< char >, + pgsql::id_string >::query_type, + pgsql::id_string > + dependency_checksum_type_; + + static const dependency_checksum_type_ dependency_checksum; + + // machine_name + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + machine_name_type_; + + static const machine_name_type_ machine_name; + + // 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; + }; + + 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_::target_type_ + query_columns< ::brep::build, id_pgsql, A >::id_class_:: + target (A::table_name, "\"target\"", 0); + + template <typename A> + const typename query_columns< ::brep::build, id_pgsql, A >::id_class_::target_config_name_type_ + query_columns< ::brep::build, id_pgsql, A >::id_class_:: + target_config_name (A::table_name, "\"target_config_name\"", 0); + + template <typename A> + const typename query_columns< ::brep::build, id_pgsql, A >::id_class_::package_config_name_type_ + query_columns< ::brep::build, id_pgsql, A >::id_class_:: + package_config_name (A::table_name, "\"package_config_name\"", 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 >::interactive_type_ + query_columns< ::brep::build, id_pgsql, A >:: + interactive (A::table_name, "\"interactive\"", 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 >::soft_timestamp_type_ + query_columns< ::brep::build, id_pgsql, A >:: + soft_timestamp (A::table_name, "\"soft_timestamp\"", 0); + + template <typename A> + const typename query_columns< ::brep::build, id_pgsql, A >::hard_timestamp_type_ + query_columns< ::brep::build, id_pgsql, A >:: + hard_timestamp (A::table_name, "\"hard_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 >::controller_checksum_type_ + query_columns< ::brep::build, id_pgsql, A >:: + controller_checksum (A::table_name, "\"controller_checksum\"", 0); + + template <typename A> + const typename query_columns< ::brep::build, id_pgsql, A >::machine_checksum_type_ + query_columns< ::brep::build, id_pgsql, A >:: + machine_checksum (A::table_name, "\"machine_checksum\"", 0); + + template <typename A> + const typename query_columns< ::brep::build, id_pgsql, A >::agent_checksum_type_ + query_columns< ::brep::build, id_pgsql, A >:: + agent_checksum (A::table_name, "\"agent_checksum\"", 0); + + template <typename A> + const typename query_columns< ::brep::build, id_pgsql, A >::worker_checksum_type_ + query_columns< ::brep::build, id_pgsql, A >:: + worker_checksum (A::table_name, "\"worker_checksum\"", 0); + + template <typename A> + const typename query_columns< ::brep::build, id_pgsql, A >::dependency_checksum_type_ + query_columns< ::brep::build, id_pgsql, A >:: + dependency_checksum (A::table_name, "\"dependency_checksum\"", 0); + + template <typename A> + const typename query_columns< ::brep::build, id_pgsql, A >::machine_name_type_ + query_columns< ::brep::build, id_pgsql, A >:: + machine_name (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> + 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; + + // interactive + // + details::buffer interactive_value; + std::size_t interactive_size; + bool interactive_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; + + // soft_timestamp + // + long long soft_timestamp_value; + bool soft_timestamp_null; + + // hard_timestamp + // + long long hard_timestamp_value; + bool hard_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; + + // controller_checksum + // + details::buffer controller_checksum_value; + std::size_t controller_checksum_size; + bool controller_checksum_null; + + // machine_checksum + // + details::buffer machine_checksum_value; + std::size_t machine_checksum_size; + bool machine_checksum_null; + + // agent_checksum + // + details::buffer agent_checksum_value; + std::size_t agent_checksum_size; + bool agent_checksum_null; + + // worker_checksum + // + details::buffer worker_checksum_value; + std::size_t worker_checksum_size; + bool worker_checksum_null; + + // dependency_checksum + // + details::buffer dependency_checksum_value; + std::size_t dependency_checksum_size; + bool dependency_checksum_null; + + // machine_name + // + details::buffer machine_name_value; + std::size_t machine_name_size; + bool machine_name_null; + + // machine_summary + // + details::buffer machine_summary_value; + std::size_t machine_summary_size; + bool machine_summary_null; + + std::size_t version; + }; + + struct extra_statement_cache_type; + + // auxiliary_machines + // + struct auxiliary_machines_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 = 14UL; + static const std::size_t data_column_count = 17UL; + + static const bool versioned = false; + + static const char insert_statement[]; + static const char select_statement[]; + static const char delete_statement[]; + + typedef ::std::vector< ::brep::build_machine > 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< auxiliary_machines_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 + // + 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 = 14UL; + static const std::size_t data_column_count = 18UL; + + 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&); + }; + + // auxiliary_machines_section + // + struct auxiliary_machines_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 = 14UL; + 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&); + }; + + // 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 = 14UL; + 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 = 34UL; + static const std::size_t id_column_count = 14UL; + 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[]; + + static const std::size_t batch = 1UL; + + 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; + + // 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 = 35UL; + + 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 > + { + }; + + // package_build_id + // + template <> + class access::view_traits_impl< ::brep::package_build_id, id_pgsql >: + public access::view_traits< ::brep::package_build_id > + { + public: + struct image_type + { + // id + // + composite_value_traits< ::brep::build_id, id_pgsql >::image_type id_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 = 14UL; + + 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, id_common >: + public access::view_traits_impl< ::brep::package_build_id, 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; + + // target + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::butl::target_triplet, + pgsql::id_string >::query_type, + pgsql::id_string > + target_type_; + + static const target_type_ target; + + // target_config_name + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + target_config_name_type_; + + static const target_config_name_type_ target_config_name; + + // package_config_name + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + package_config_name_type_; + + static const package_config_name_type_ package_config_name; + + // 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_soft_timestamp + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::uint64_t, + pgsql::id_bigint >::query_type, + pgsql::id_bigint > + report_soft_timestamp_type_; + + static const report_soft_timestamp_type_ report_soft_timestamp; + + // report_hard_timestamp + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::uint64_t, + pgsql::id_bigint >::query_type, + pgsql::id_bigint > + report_hard_timestamp_type_; + + static const report_hard_timestamp_type_ report_hard_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_::target_type_ + query_columns< ::brep::build_delay, id_pgsql, A >::id_class_:: + target (A::table_name, "\"target\"", 0); + + template <typename A> + const typename query_columns< ::brep::build_delay, id_pgsql, A >::id_class_::target_config_name_type_ + query_columns< ::brep::build_delay, id_pgsql, A >::id_class_:: + target_config_name (A::table_name, "\"target_config_name\"", 0); + + template <typename A> + const typename query_columns< ::brep::build_delay, id_pgsql, A >::id_class_::package_config_name_type_ + query_columns< ::brep::build_delay, id_pgsql, A >::id_class_:: + package_config_name (A::table_name, "\"package_config_name\"", 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_soft_timestamp_type_ + query_columns< ::brep::build_delay, id_pgsql, A >:: + report_soft_timestamp (A::table_name, "\"report_soft_timestamp\"", 0); + + template <typename A> + const typename query_columns< ::brep::build_delay, id_pgsql, A >::report_hard_timestamp_type_ + query_columns< ::brep::build_delay, id_pgsql, A >:: + report_hard_timestamp (A::table_name, "\"report_hard_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_soft_timestamp + // + long long report_soft_timestamp_value; + bool report_soft_timestamp_null; + + // report_hard_timestamp + // + long long report_hard_timestamp_value; + bool report_hard_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 = 21UL; + static const std::size_t id_column_count = 14UL; + 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[]; + + static const std::size_t batch = 1UL; + + 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; + }; + + // package_build_id + // + struct access::view_traits_impl< ::brep::package_build_id, 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_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..935a790 --- /dev/null +++ b/libbrep/build-odb.ixx @@ -0,0 +1,254 @@ +// -*- 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); + } + + // package_build_id + // + + inline + void access::view_traits< ::brep::package_build_id >:: + 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); + } +} + +#include <odb/schema-version.hxx> + +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.target_null; + r = r && i.target_config_name_null; + r = r && i.package_config_name_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.target_null = true; + i.target_config_name_null = true; + i.package_config_name_null = true; + i.toolchain_name_null = true; + composite_value_traits< ::brep::canonical_version, id_pgsql >::set_null (i.toolchain_version_value, sk); + } + + // build_machine + // + + inline + bool access::composite_value_traits< ::brep::build_machine, id_pgsql >:: + get_null (const image_type& i) + { + bool r (true); + r = r && i.name_null; + r = r && i.summary_null; + return r; + } + + inline + void access::composite_value_traits< ::brep::build_machine, id_pgsql >:: + set_null (image_type& i, + pgsql::statement_kind sk) + { + ODB_POTENTIALLY_UNUSED (sk); + + using namespace pgsql; + + i.name_null = true; + i.summary_null = true; + } + + // 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 + // + + // package_build_id + // + + // 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..69ae654 --- /dev/null +++ b/libbrep/build-package-odb.cxx @@ -0,0 +1,10203 @@ +// -*- 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/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 +{ + // 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 >:: + update_statement_name[] = "update_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, + pgsql::text_oid, + pgsql::int8_oid, + pgsql::bool_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::int8_oid, + pgsql::int8_oid, + pgsql::text_oid, + pgsql::int4_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::int4_oid, + pgsql::text_oid, + pgsql::text_oid + }; + + const unsigned int access::object_traits_impl< ::brep::build_tenant, id_pgsql >:: + find_statement_types[] = + { + pgsql::text_oid + }; + + const unsigned int access::object_traits_impl< ::brep::build_tenant, id_pgsql >:: + update_statement_types[] = + { + pgsql::bool_oid, + pgsql::text_oid, + pgsql::int8_oid, + pgsql::bool_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::int8_oid, + pgsql::int8_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 + }; + + 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; + } + + // private_ + // + t[1UL] = 0; + + // interactive + // + if (t[2UL]) + { + i.interactive_value.capacity (i.interactive_size); + grew = true; + } + + // creation_timestamp + // + t[3UL] = 0; + + // archived + // + t[4UL] = 0; + + // service + // + if (composite_value_traits< ::brep::tenant_service, id_pgsql >::grow ( + i.service_value, t + 5UL)) + grew = true; + + // loaded_timestamp + // + t[8UL] = 0; + + // queued_timestamp + // + t[9UL] = 0; + + // toolchain + // + if (composite_value_traits< ::brep::build_toolchain, id_pgsql >::grow ( + i.toolchain_value, t + 10UL)) + grew = true; + + 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; + + std::size_t n (0); + + // id + // + if (sk != statement_update) + { + b[n].type = pgsql::bind::text; + b[n].buffer = i.id_value.data_ptr (); + b[n].capacity = i.id_value.capacity (); + b[n].size = &i.id_size; + b[n].is_null = &i.id_null; + n++; + } + + // private_ + // + b[n].type = pgsql::bind::boolean_; + b[n].buffer = &i.private_value; + b[n].is_null = &i.private_null; + n++; + + // interactive + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.interactive_value.data_ptr (); + b[n].capacity = i.interactive_value.capacity (); + b[n].size = &i.interactive_size; + b[n].is_null = &i.interactive_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++; + + // service + // + composite_value_traits< ::brep::tenant_service, id_pgsql >::bind ( + b + n, i.service_value, sk); + n += 3UL; + + // loaded_timestamp + // + b[n].type = pgsql::bind::bigint; + b[n].buffer = &i.loaded_timestamp_value; + b[n].is_null = &i.loaded_timestamp_null; + n++; + + // queued_timestamp + // + b[n].type = pgsql::bind::bigint; + b[n].buffer = &i.queued_timestamp_value; + b[n].is_null = &i.queued_timestamp_null; + n++; + + // toolchain + // + composite_value_traits< ::brep::build_toolchain, id_pgsql >::bind ( + b + n, i.toolchain_value, sk); + n += 7UL; + } + + 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_ptr (); + 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; + + 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 ()); + } + + // private_ + // + { + bool const& v = + o.private_; + + bool is_null (false); + pgsql::value_traits< + bool, + pgsql::id_boolean >::set_image ( + i.private_value, is_null, v); + i.private_null = is_null; + } + + // interactive + // + { + ::butl::optional< ::std::basic_string< char > > const& v = + o.interactive; + + bool is_null (true); + std::size_t size (0); + std::size_t cap (i.interactive_value.capacity ()); + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_image ( + i.interactive_value, + size, + is_null, + v); + i.interactive_null = is_null; + i.interactive_size = size; + grew = grew || (cap != i.interactive_value.capacity ()); + } + + // creation_timestamp + // + { + ::butl::timestamp const& v = + o.creation_timestamp; + + // From common.hxx:123: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; + } + + // service + // + { + ::butl::optional< ::brep::tenant_service > const& v = + o.service; + + if (wrapper_traits< ::butl::optional< ::brep::tenant_service > >::get_null (v)) + composite_value_traits< ::brep::tenant_service, id_pgsql >::set_null ( + i.service_value, sk); + else + { + const::brep::tenant_service& vw = + wrapper_traits< ::butl::optional< ::brep::tenant_service > >::get_ref (v); + + if (composite_value_traits< ::brep::tenant_service, id_pgsql >::init ( + i.service_value, + vw, + sk)) + grew = true; + } + } + + // loaded_timestamp + // + { + ::butl::optional< ::std::chrono::time_point< ::std::chrono::system_clock, ::std::chrono::duration< long int, ::std::ratio< 1, 1000000000 > > > > const& v = + o.loaded_timestamp; + + // From common.hxx:133:14 + ::brep::optional_uint64 const& vt = + (v) ? std::chrono::duration_cast < std::chrono::nanoseconds > ((v)->time_since_epoch ()).count () : brep::optional_uint64 (); + + bool is_null (true); + pgsql::value_traits< + ::brep::optional_uint64, + pgsql::id_bigint >::set_image ( + i.loaded_timestamp_value, is_null, vt); + i.loaded_timestamp_null = is_null; + } + + // queued_timestamp + // + { + ::butl::optional< ::std::chrono::time_point< ::std::chrono::system_clock, ::std::chrono::duration< long int, ::std::ratio< 1, 1000000000 > > > > const& v = + o.queued_timestamp; + + // From common.hxx:133:14 + ::brep::optional_uint64 const& vt = + (v) ? std::chrono::duration_cast < std::chrono::nanoseconds > ((v)->time_since_epoch ()).count () : brep::optional_uint64 (); + + bool is_null (true); + pgsql::value_traits< + ::brep::optional_uint64, + pgsql::id_bigint >::set_image ( + i.queued_timestamp_value, is_null, vt); + i.queued_timestamp_null = is_null; + } + + // toolchain + // + { + ::butl::optional< ::brep::build_toolchain > const& v = + o.toolchain; + + if (wrapper_traits< ::butl::optional< ::brep::build_toolchain > >::get_null (v)) + composite_value_traits< ::brep::build_toolchain, id_pgsql >::set_null ( + i.toolchain_value, sk); + else + { + const::brep::build_toolchain& vw = + wrapper_traits< ::butl::optional< ::brep::build_toolchain > >::get_ref (v); + + if (composite_value_traits< ::brep::build_toolchain, id_pgsql >::init ( + i.toolchain_value, + vw, + sk)) + grew = true; + } + } + + 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); + } + + // private_ + // + { + bool& v = + o.private_; + + pgsql::value_traits< + bool, + pgsql::id_boolean >::set_value ( + v, + i.private_value, + i.private_null); + } + + // interactive + // + { + ::butl::optional< ::std::basic_string< char > >& v = + o.interactive; + + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_value ( + v, + i.interactive_value, + i.interactive_size, + i.interactive_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:123: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); + } + + // service + // + { + ::butl::optional< ::brep::tenant_service >& v = + o.service; + + if (composite_value_traits< ::brep::tenant_service, id_pgsql >::get_null ( + i.service_value)) + wrapper_traits< ::butl::optional< ::brep::tenant_service > >::set_null (v); + else + { + ::brep::tenant_service& vw = + wrapper_traits< ::butl::optional< ::brep::tenant_service > >::set_ref (v); + + composite_value_traits< ::brep::tenant_service, id_pgsql >::init ( + vw, + i.service_value, + db); + } + } + + // loaded_timestamp + // + { + ::butl::optional< ::std::chrono::time_point< ::std::chrono::system_clock, ::std::chrono::duration< long int, ::std::ratio< 1, 1000000000 > > > >& v = + o.loaded_timestamp; + + ::brep::optional_uint64 vt; + + pgsql::value_traits< + ::brep::optional_uint64, + pgsql::id_bigint >::set_value ( + vt, + i.loaded_timestamp_value, + i.loaded_timestamp_null); + + // From common.hxx:133:14 + v = (vt) ? brep::timestamp (std::chrono::duration_cast < brep::timestamp::duration > (std::chrono::nanoseconds ( * (vt)))) : brep::optional_timestamp (); + } + + // queued_timestamp + // + { + ::butl::optional< ::std::chrono::time_point< ::std::chrono::system_clock, ::std::chrono::duration< long int, ::std::ratio< 1, 1000000000 > > > >& v = + o.queued_timestamp; + + ::brep::optional_uint64 vt; + + pgsql::value_traits< + ::brep::optional_uint64, + pgsql::id_bigint >::set_value ( + vt, + i.queued_timestamp_value, + i.queued_timestamp_null); + + // From common.hxx:133:14 + v = (vt) ? brep::timestamp (std::chrono::duration_cast < brep::timestamp::duration > (std::chrono::nanoseconds ( * (vt)))) : brep::optional_timestamp (); + } + + // toolchain + // + { + ::butl::optional< ::brep::build_toolchain >& v = + o.toolchain; + + if (composite_value_traits< ::brep::build_toolchain, id_pgsql >::get_null ( + i.toolchain_value)) + wrapper_traits< ::butl::optional< ::brep::build_toolchain > >::set_null (v); + else + { + ::brep::build_toolchain& vw = + wrapper_traits< ::butl::optional< ::brep::build_toolchain > >::set_ref (v); + + composite_value_traits< ::brep::build_toolchain, id_pgsql >::init ( + vw, + i.toolchain_value, + db); + } + } + } + + 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\", " + "\"private\", " + "\"interactive\", " + "\"creation_timestamp\", " + "\"archived\", " + "\"service_id\", " + "\"service_type\", " + "\"service_data\", " + "\"loaded_timestamp\", " + "\"queued_timestamp\", " + "\"toolchain_name\", " + "\"toolchain_version_epoch\", " + "\"toolchain_version_canonical_upstream\", " + "\"toolchain_version_canonical_release\", " + "\"toolchain_version_revision\", " + "\"toolchain_version_upstream\", " + "\"toolchain_version_release\") " + "VALUES " + "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17)"; + + const char access::object_traits_impl< ::brep::build_tenant, id_pgsql >::find_statement[] = + "SELECT " + "\"build_tenant\".\"id\", " + "\"build_tenant\".\"private\", " + "\"build_tenant\".\"interactive\", " + "\"build_tenant\".\"creation_timestamp\", " + "\"build_tenant\".\"archived\", " + "\"build_tenant\".\"service_id\", " + "\"build_tenant\".\"service_type\", " + "\"build_tenant\".\"service_data\", " + "\"build_tenant\".\"loaded_timestamp\", " + "\"build_tenant\".\"queued_timestamp\", " + "\"build_tenant\".\"toolchain_name\", " + "\"build_tenant\".\"toolchain_version_epoch\", " + "\"build_tenant\".\"toolchain_version_canonical_upstream\", " + "\"build_tenant\".\"toolchain_version_canonical_release\", " + "\"build_tenant\".\"toolchain_version_revision\", " + "\"build_tenant\".\"toolchain_version_upstream\", " + "\"build_tenant\".\"toolchain_version_release\" " + "FROM \"build_tenant\" " + "WHERE \"build_tenant\".\"id\"=$1"; + + const char access::object_traits_impl< ::brep::build_tenant, id_pgsql >::update_statement[] = + "UPDATE \"build_tenant\" " + "SET " + "\"private\"=$1, " + "\"interactive\"=$2, " + "\"creation_timestamp\"=$3, " + "\"archived\"=$4, " + "\"service_id\"=$5, " + "\"service_type\"=$6, " + "\"service_data\"=$7, " + "\"loaded_timestamp\"=$8, " + "\"queued_timestamp\"=$9, " + "\"toolchain_name\"=$10, " + "\"toolchain_version_epoch\"=$11, " + "\"toolchain_version_canonical_upstream\"=$12, " + "\"toolchain_version_canonical_release\"=$13, " + "\"toolchain_version_revision\"=$14, " + "\"toolchain_version_upstream\"=$15, " + "\"toolchain_version_release\"=$16 " + "WHERE \"id\"=$17"; + + 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\".\"private\", " + "\"build_tenant\".\"interactive\", " + "\"build_tenant\".\"creation_timestamp\", " + "\"build_tenant\".\"archived\", " + "\"build_tenant\".\"service_id\", " + "\"build_tenant\".\"service_type\", " + "\"build_tenant\".\"service_data\", " + "\"build_tenant\".\"loaded_timestamp\", " + "\"build_tenant\".\"queued_timestamp\", " + "\"build_tenant\".\"toolchain_name\", " + "\"build_tenant\".\"toolchain_version_epoch\", " + "\"build_tenant\".\"toolchain_version_canonical_upstream\", " + "\"build_tenant\".\"toolchain_version_canonical_release\", " + "\"build_tenant\".\"toolchain_version_revision\", " + "\"build_tenant\".\"toolchain_version_upstream\", " + "\"build_tenant\".\"toolchain_version_release\" " + "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) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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 >:: + 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 (db)); + 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_tenant, id_pgsql >:: + erase (database& db, const id_type& id) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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 (db)); + 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 (db)); + 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 (db)); + 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& db, const query_base_type& q) + { + using namespace pgsql; + using odb::details::shared; + using odb::details::shared_ptr; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + + 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& db, const query_base_type& q) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + + 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::transaction& tr (pgsql::transaction::current ()); + ODB_POTENTIALLY_UNUSED (tr); + + // The connection used by the current transaction and the + // one used to prepare this statement must be the same. + // + assert (q.verify_connection (tr)); + + statements_type& sts ( + st->connection ().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_ptr (); + 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:309: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:85: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:309:14 + v = brep::repository_location (std::move ((vt).url), (vt).type); + // From build-package.hxx:85: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) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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 (db)); + 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 (db)); + 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 (db)); + 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& db, const query_base_type& q) + { + using namespace pgsql; + using odb::details::shared; + using odb::details::shared_ptr; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + + 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& db, const query_base_type& q) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + + 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::transaction& tr (pgsql::transaction::current ()); + ODB_POTENTIALLY_UNUSED (tr); + + // The connection used by the current transaction and the + // one used to prepare this statement must be the same. + // + assert (q.verify_connection (tr)); + + statements_type& sts ( + st->connection ().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_public_key + // + + const char access::object_traits_impl< ::brep::build_public_key, id_pgsql >:: + persist_statement_name[] = "persist_brep_build_public_key"; + + const char access::object_traits_impl< ::brep::build_public_key, id_pgsql >:: + find_statement_name[] = "find_brep_build_public_key"; + + const char access::object_traits_impl< ::brep::build_public_key, id_pgsql >:: + erase_statement_name[] = "erase_brep_build_public_key"; + + const char access::object_traits_impl< ::brep::build_public_key, id_pgsql >:: + query_statement_name[] = "query_brep_build_public_key"; + + const char access::object_traits_impl< ::brep::build_public_key, id_pgsql >:: + erase_query_statement_name[] = "erase_query_brep_build_public_key"; + + const unsigned int access::object_traits_impl< ::brep::build_public_key, id_pgsql >:: + persist_statement_types[] = + { + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid + }; + + const unsigned int access::object_traits_impl< ::brep::build_public_key, id_pgsql >:: + find_statement_types[] = + { + pgsql::text_oid, + pgsql::text_oid + }; + + struct access::object_traits_impl< ::brep::build_public_key, 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_public_key, id_pgsql >::id_type + access::object_traits_impl< ::brep::build_public_key, id_pgsql >:: + id (const image_type& i) + { + pgsql::database* db (0); + ODB_POTENTIALLY_UNUSED (db); + + id_type id; + { + composite_value_traits< ::brep::public_key_id, id_pgsql >::init ( + id, + i.id_value, + db); + } + + return id; + } + + bool access::object_traits_impl< ::brep::build_public_key, 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::public_key_id, id_pgsql >::grow ( + i.id_value, t + 0UL)) + grew = true; + + // data + // + if (t[2UL]) + { + i.data_value.capacity (i.data_size); + grew = true; + } + + return grew; + } + + void access::object_traits_impl< ::brep::build_public_key, 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::public_key_id, id_pgsql >::bind ( + b + n, i.id_value, sk); + n += 2UL; + + // data + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.data_value.data_ptr (); + b[n].capacity = i.data_value.capacity (); + b[n].size = &i.data_size; + b[n].is_null = &i.data_null; + n++; + } + + void access::object_traits_impl< ::brep::build_public_key, 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::public_key_id, id_pgsql >::bind ( + b + n, i.id_value, sk); + } + + bool access::object_traits_impl< ::brep::build_public_key, 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::public_key_id const& v = + o.id; + + if (composite_value_traits< ::brep::public_key_id, id_pgsql >::init ( + i.id_value, + v, + sk)) + grew = true; + } + + // data + // + { + // From build-package.hxx:107:45 + ::std::string const& v = + o; + + bool is_null (false); + std::size_t size (0); + std::size_t cap (i.data_value.capacity ()); + pgsql::value_traits< + ::std::string, + pgsql::id_string >::set_image ( + i.data_value, + size, + is_null, + v); + i.data_null = is_null; + i.data_size = size; + grew = grew || (cap != i.data_value.capacity ()); + } + + return grew; + } + + void access::object_traits_impl< ::brep::build_public_key, 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::public_key_id& v = + o.id; + + composite_value_traits< ::brep::public_key_id, id_pgsql >::init ( + v, + i.id_value, + db); + } + + // data + // + { + // From build-package.hxx:107:45 + ::std::string& v = + o; + + pgsql::value_traits< + ::std::string, + pgsql::id_string >::set_value ( + v, + i.data_value, + i.data_size, + i.data_null); + } + } + + void access::object_traits_impl< ::brep::build_public_key, 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::public_key_id, id_pgsql >::init ( + i.id_value, + id, + sk)) + grew = true; + } + + if (grew) + i.version++; + } + + const char access::object_traits_impl< ::brep::build_public_key, id_pgsql >::persist_statement[] = + "INSERT INTO \"build_public_key\" " + "(\"tenant\", " + "\"fingerprint\", " + "\"data\") " + "VALUES " + "($1, $2, $3)"; + + const char access::object_traits_impl< ::brep::build_public_key, id_pgsql >::find_statement[] = + "SELECT " + "\"build_public_key\".\"tenant\", " + "\"build_public_key\".\"fingerprint\", " + "\"build_public_key\".\"data\" " + "FROM \"build_public_key\" " + "WHERE \"build_public_key\".\"tenant\"=$1 AND \"build_public_key\".\"fingerprint\"=$2"; + + const char access::object_traits_impl< ::brep::build_public_key, id_pgsql >::erase_statement[] = + "DELETE FROM \"build_public_key\" " + "WHERE \"tenant\"=$1 AND \"fingerprint\"=$2"; + + const char access::object_traits_impl< ::brep::build_public_key, id_pgsql >::query_statement[] = + "SELECT " + "\"build_public_key\".\"tenant\", " + "\"build_public_key\".\"fingerprint\", " + "\"build_public_key\".\"data\" " + "FROM \"build_public_key\""; + + const char access::object_traits_impl< ::brep::build_public_key, id_pgsql >::erase_query_statement[] = + "DELETE FROM \"build_public_key\""; + + const char access::object_traits_impl< ::brep::build_public_key, id_pgsql >::table_name[] = + "\"build_public_key\""; + + void access::object_traits_impl< ::brep::build_public_key, id_pgsql >:: + persist (database& db, const object_type& obj) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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_public_key, id_pgsql >:: + erase (database& db, const id_type& id) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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_public_key, id_pgsql >::pointer_type + access::object_traits_impl< ::brep::build_public_key, 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 (db)); + 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_public_key, id_pgsql >:: + find (database& db, const id_type& id, object_type& obj) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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_public_key, id_pgsql >:: + reload (database& db, object_type& obj) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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_public_key, 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_public_key, id_pgsql >::object_type > + access::object_traits_impl< ::brep::build_public_key, id_pgsql >:: + query (database& db, const query_base_type& q) + { + using namespace pgsql; + using odb::details::shared; + using odb::details::shared_ptr; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + + 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_public_key, id_pgsql >:: + erase_query (database& db, const query_base_type& q) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + + 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_public_key, 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_public_key, 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::transaction& tr (pgsql::transaction::current ()); + ODB_POTENTIALLY_UNUSED (tr); + + // The connection used by the current transaction and the + // one used to prepare this statement must be the same. + // + assert (q.verify_connection (tr)); + + statements_type& sts ( + st->connection ().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_package_config + // + + bool access::composite_value_traits< ::brep::build_package_config, 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; + } + + // arguments + // + if (t[1UL]) + { + i.arguments_value.capacity (i.arguments_size); + grew = true; + } + + // comment + // + if (t[2UL]) + { + i.comment_value.capacity (i.comment_size); + grew = true; + } + + // email + // + if (composite_value_traits< ::bpkg::email, id_pgsql >::grow ( + i.email_value, t + 3UL)) + grew = true; + + // warning_email + // + if (composite_value_traits< ::bpkg::email, id_pgsql >::grow ( + i.warning_email_value, t + 5UL)) + grew = true; + + // error_email + // + if (composite_value_traits< ::bpkg::email, id_pgsql >::grow ( + i.error_email_value, t + 7UL)) + grew = true; + + return grew; + } + + void access::composite_value_traits< ::brep::build_package_config, 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_ptr (); + b[n].capacity = i.name_value.capacity (); + b[n].size = &i.name_size; + b[n].is_null = &i.name_null; + n++; + + // arguments + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.arguments_value.data_ptr (); + b[n].capacity = i.arguments_value.capacity (); + b[n].size = &i.arguments_size; + b[n].is_null = &i.arguments_null; + n++; + + // comment + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.comment_value.data_ptr (); + b[n].capacity = i.comment_value.capacity (); + b[n].size = &i.comment_size; + b[n].is_null = &i.comment_null; + n++; + + // email + // + composite_value_traits< ::bpkg::email, id_pgsql >::bind ( + b + n, i.email_value, sk); + n += 2UL; + + // warning_email + // + composite_value_traits< ::bpkg::email, id_pgsql >::bind ( + b + n, i.warning_email_value, sk); + n += 2UL; + + // error_email + // + composite_value_traits< ::bpkg::email, id_pgsql >::bind ( + b + n, i.error_email_value, sk); + n += 2UL; + } + + bool access::composite_value_traits< ::brep::build_package_config, 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 + // + { + ::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 ()); + } + + // arguments + // + { + ::std::string const& v = + o.arguments; + + bool is_null (false); + std::size_t size (0); + std::size_t cap (i.arguments_value.capacity ()); + pgsql::value_traits< + ::std::string, + pgsql::id_string >::set_image ( + i.arguments_value, + size, + is_null, + v); + i.arguments_null = is_null; + i.arguments_size = size; + grew = grew || (cap != i.arguments_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 ()); + } + + // email + // + { + ::butl::optional< ::bpkg::email > const& v = + o.email; + + if (wrapper_traits< ::butl::optional< ::bpkg::email > >::get_null (v)) + composite_value_traits< ::bpkg::email, id_pgsql >::set_null ( + i.email_value, sk); + else + { + const::bpkg::email& vw = + wrapper_traits< ::butl::optional< ::bpkg::email > >::get_ref (v); + + if (composite_value_traits< ::bpkg::email, id_pgsql >::init ( + i.email_value, + vw, + sk)) + grew = true; + } + } + + // warning_email + // + { + ::butl::optional< ::bpkg::email > const& v = + o.warning_email; + + if (wrapper_traits< ::butl::optional< ::bpkg::email > >::get_null (v)) + composite_value_traits< ::bpkg::email, id_pgsql >::set_null ( + i.warning_email_value, sk); + else + { + const::bpkg::email& vw = + wrapper_traits< ::butl::optional< ::bpkg::email > >::get_ref (v); + + if (composite_value_traits< ::bpkg::email, id_pgsql >::init ( + i.warning_email_value, + vw, + sk)) + grew = true; + } + } + + // error_email + // + { + ::butl::optional< ::bpkg::email > const& v = + o.error_email; + + if (wrapper_traits< ::butl::optional< ::bpkg::email > >::get_null (v)) + composite_value_traits< ::bpkg::email, id_pgsql >::set_null ( + i.error_email_value, sk); + else + { + const::bpkg::email& vw = + wrapper_traits< ::butl::optional< ::bpkg::email > >::get_ref (v); + + if (composite_value_traits< ::bpkg::email, id_pgsql >::init ( + i.error_email_value, + vw, + sk)) + grew = true; + } + } + + return grew; + } + + void access::composite_value_traits< ::brep::build_package_config, 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 + // + { + ::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); + } + + // arguments + // + { + ::std::string& v = + o.arguments; + + pgsql::value_traits< + ::std::string, + pgsql::id_string >::set_value ( + v, + i.arguments_value, + i.arguments_size, + i.arguments_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); + } + + // email + // + { + ::butl::optional< ::bpkg::email >& v = + o.email; + + if (composite_value_traits< ::bpkg::email, id_pgsql >::get_null ( + i.email_value)) + wrapper_traits< ::butl::optional< ::bpkg::email > >::set_null (v); + else + { + ::bpkg::email& vw = + wrapper_traits< ::butl::optional< ::bpkg::email > >::set_ref (v); + + composite_value_traits< ::bpkg::email, id_pgsql >::init ( + vw, + i.email_value, + db); + } + } + + // warning_email + // + { + ::butl::optional< ::bpkg::email >& v = + o.warning_email; + + if (composite_value_traits< ::bpkg::email, id_pgsql >::get_null ( + i.warning_email_value)) + wrapper_traits< ::butl::optional< ::bpkg::email > >::set_null (v); + else + { + ::bpkg::email& vw = + wrapper_traits< ::butl::optional< ::bpkg::email > >::set_ref (v); + + composite_value_traits< ::bpkg::email, id_pgsql >::init ( + vw, + i.warning_email_value, + db); + } + } + + // error_email + // + { + ::butl::optional< ::bpkg::email >& v = + o.error_email; + + if (composite_value_traits< ::bpkg::email, id_pgsql >::get_null ( + i.error_email_value)) + wrapper_traits< ::butl::optional< ::bpkg::email > >::set_null (v); + else + { + ::bpkg::email& vw = + wrapper_traits< ::butl::optional< ::bpkg::email > >::set_ref (v); + + composite_value_traits< ::bpkg::email, id_pgsql >::init ( + vw, + i.error_email_value, + db); + } + } + } + + // build_package_bot_key_key + // + + bool access::composite_value_traits< ::brep::build_package_bot_key_key, id_pgsql >:: + grow (image_type& i, + bool* t) + { + ODB_POTENTIALLY_UNUSED (i); + ODB_POTENTIALLY_UNUSED (t); + + bool grew (false); + + // outer + // + t[0UL] = 0; + + // inner + // + t[1UL] = 0; + + return grew; + } + + void access::composite_value_traits< ::brep::build_package_bot_key_key, 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); + + // outer + // + b[n].type = pgsql::bind::bigint; + b[n].buffer = &i.outer_value; + b[n].is_null = &i.outer_null; + n++; + + // inner + // + b[n].type = pgsql::bind::bigint; + b[n].buffer = &i.inner_value; + b[n].is_null = &i.inner_null; + n++; + } + + bool access::composite_value_traits< ::brep::build_package_bot_key_key, 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); + + // outer + // + { + ::brep::build_package_bot_key_key::outer_type const& v = + o.outer; + + bool is_null (false); + pgsql::value_traits< + ::brep::build_package_bot_key_key::outer_type, + pgsql::id_bigint >::set_image ( + i.outer_value, is_null, v); + i.outer_null = is_null; + } + + // inner + // + { + ::brep::build_package_bot_key_key::inner_type const& v = + o.inner; + + bool is_null (false); + pgsql::value_traits< + ::brep::build_package_bot_key_key::inner_type, + pgsql::id_bigint >::set_image ( + i.inner_value, is_null, v); + i.inner_null = is_null; + } + + return grew; + } + + void access::composite_value_traits< ::brep::build_package_bot_key_key, id_pgsql >:: + init (value_type& o, + const image_type& i, + database* db) + { + ODB_POTENTIALLY_UNUSED (o); + ODB_POTENTIALLY_UNUSED (i); + ODB_POTENTIALLY_UNUSED (db); + + // outer + // + { + ::brep::build_package_bot_key_key::outer_type& v = + o.outer; + + pgsql::value_traits< + ::brep::build_package_bot_key_key::outer_type, + pgsql::id_bigint >::set_value ( + v, + i.outer_value, + i.outer_null); + } + + // inner + // + { + ::brep::build_package_bot_key_key::inner_type& v = + o.inner; + + pgsql::value_traits< + ::brep::build_package_bot_key_key::inner_type, + pgsql::id_bigint >::set_value ( + v, + i.inner_value, + i.inner_null); + } + } + + // build_dependency + // + + bool access::composite_value_traits< ::brep::build_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::build_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_ptr (); + 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::build_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::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_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::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_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); + + // build_dependency base + // + if (composite_value_traits< ::brep::build_dependency, id_pgsql >::grow ( + i, t + 0UL)) + grew = true; + + // type + // + if (t[21UL]) + { + i.type_value.capacity (i.type_size); + grew = true; + } + + // buildtime + // + t[22UL] = 0; + + // enable + // + if (t[23UL]) + { + i.enable_value.capacity (i.enable_size); + grew = true; + } + + // reflect + // + if (t[24UL]) + { + i.reflect_value.capacity (i.reflect_size); + 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); + + // build_dependency base + // + composite_value_traits< ::brep::build_dependency, id_pgsql >::bind (b + n, i, sk); + n += 21UL; + + // type + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.type_value.data_ptr (); + b[n].capacity = i.type_value.capacity (); + b[n].size = &i.type_size; + b[n].is_null = &i.type_null; + n++; + + // buildtime + // + b[n].type = pgsql::bind::boolean_; + b[n].buffer = &i.buildtime_value; + b[n].is_null = &i.buildtime_null; + n++; + + // enable + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.enable_value.data_ptr (); + b[n].capacity = i.enable_value.capacity (); + b[n].size = &i.enable_size; + b[n].is_null = &i.enable_null; + n++; + + // reflect + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.reflect_value.data_ptr (); + b[n].capacity = i.reflect_value.capacity (); + b[n].size = &i.reflect_size; + b[n].is_null = &i.reflect_null; + n++; + } + + 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); + + // build_dependency base + // + if (composite_value_traits< ::brep::build_dependency, id_pgsql >::init (i, o, sk)) + grew = true; + + // type + // + { + ::bpkg::test_dependency_type const& v = + o.type; + + // From common.hxx:623: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 ()); + } + + // 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; + } + + // enable + // + { + ::butl::optional< ::std::basic_string< char > > const& v = + o.enable; + + bool is_null (true); + std::size_t size (0); + std::size_t cap (i.enable_value.capacity ()); + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_image ( + i.enable_value, + size, + is_null, + v); + i.enable_null = is_null; + i.enable_size = size; + grew = grew || (cap != i.enable_value.capacity ()); + } + + // reflect + // + { + ::butl::optional< ::std::basic_string< char > > const& v = + o.reflect; + + bool is_null (true); + std::size_t size (0); + std::size_t cap (i.reflect_value.capacity ()); + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_image ( + i.reflect_value, + size, + is_null, + v); + i.reflect_null = is_null; + i.reflect_size = size; + grew = grew || (cap != i.reflect_value.capacity ()); + } + + 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); + + // build_dependency base + // + composite_value_traits< ::brep::build_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 common.hxx:623:14 + v = brep::to_test_dependency_type (vt); + } + + // buildtime + // + { + bool& v = + o.buildtime; + + pgsql::value_traits< + bool, + pgsql::id_boolean >::set_value ( + v, + i.buildtime_value, + i.buildtime_null); + } + + // enable + // + { + ::butl::optional< ::std::basic_string< char > >& v = + o.enable; + + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_value ( + v, + i.enable_value, + i.enable_size, + i.enable_null); + } + + // reflect + // + { + ::butl::optional< ::std::basic_string< char > >& v = + o.reflect; + + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_value ( + v, + i.reflect_value, + i.reflect_size, + i.reflect_null); + } + } + + // 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::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::bool_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< requirements_traits > requirements; + pgsql::container_statements_impl< requirement_alternatives_traits > requirement_alternatives; + pgsql::container_statements_impl< requirement_alternative_requirements_traits > requirement_alternative_requirements; + pgsql::container_statements_impl< tests_traits > tests; + pgsql::container_statements_impl< builds_traits > builds; + pgsql::container_statements_impl< constraints_traits > constraints; + pgsql::container_statements_impl< auxiliaries_traits > auxiliaries; + pgsql::container_statements_impl< bot_keys_traits > bot_keys; + pgsql::container_statements_impl< configs_traits > configs; + pgsql::container_statements_impl< config_builds_traits > config_builds; + pgsql::container_statements_impl< config_constraints_traits > config_constraints; + pgsql::container_statements_impl< config_auxiliaries_traits > config_auxiliaries; + pgsql::container_statements_impl< config_bot_keys_traits > config_bot_keys; + + pgsql::section_statements< ::brep::build_package, requirements_tests_section_traits > requirements_tests_section; + pgsql::section_statements< ::brep::build_package, constraints_section_traits > constraints_section; + pgsql::section_statements< ::brep::build_package, auxiliaries_section_traits > auxiliaries_section; + pgsql::section_statements< ::brep::build_package, bot_keys_section_traits > bot_keys_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) + : requirements (c, id, idn, idt), + requirement_alternatives (c, id, idn, idt), + requirement_alternative_requirements (c, id, idn, idt), + tests (c, id, idn, idt), + builds (c, id, idn, idt), + constraints (c, id, idn, idt), + auxiliaries (c, id, idn, idt), + bot_keys (c, id, idn, idt), + configs (c, id, idn, idt), + config_builds (c, id, idn, idt), + config_constraints (c, id, idn, idt), + config_auxiliaries (c, id, idn, idt), + config_bot_keys (c, id, idn, idt), + requirements_tests_section (c, im, idim, id, idv, idn, idt), + constraints_section (c, im, idim, id, idv, idn, idt), + auxiliaries_section (c, im, idim, id, idv, idn, idt), + bot_keys_section (c, im, idim, id, idv, idn, idt) + { + } + }; + + // requirements + // + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::requirements_traits:: + select_name[] = "select_brep_build_package_requirements"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::requirements_traits:: + insert_name[] = "insert_brep_build_package_requirements"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::requirements_traits:: + delete_name[] = "delete_brep_build_package_requirements"; + + const unsigned int access::object_traits_impl< ::brep::build_package, id_pgsql >::requirements_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 + }; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::requirements_traits:: + select_statement[] = + "SELECT " + "\"build_package_requirements\".\"index\", " + "\"build_package_requirements\".\"buildtime\", " + "\"build_package_requirements\".\"comment\" " + "FROM \"build_package_requirements\" " + "WHERE \"build_package_requirements\".\"tenant\"=$1 AND \"build_package_requirements\".\"name\"=$2::CITEXT AND \"build_package_requirements\".\"version_epoch\"=$3 AND \"build_package_requirements\".\"version_canonical_upstream\"=$4 AND \"build_package_requirements\".\"version_canonical_release\"=$5 AND \"build_package_requirements\".\"version_revision\"=$6 ORDER BY \"build_package_requirements\".\"index\""; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::requirements_traits:: + insert_statement[] = + "INSERT INTO \"build_package_requirements\" " + "(\"tenant\", " + "\"name\", " + "\"version_epoch\", " + "\"version_canonical_upstream\", " + "\"version_canonical_release\", " + "\"version_revision\", " + "\"index\", " + "\"buildtime\", " + "\"comment\") " + "VALUES " + "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8, $9)"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::requirements_traits:: + delete_statement[] = + "DELETE FROM \"build_package_requirements\" " + "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 >::requirements_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 >::requirements_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 >::requirements_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 >::requirements_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 >::requirements_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 >::requirements_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 >::requirements_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 >::requirements_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 >::requirements_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 >::requirements_traits:: + erase (statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + fs.ordered_ = true; + container_traits_type::erase (fs); + } + + // requirement_alternatives + // + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::requirement_alternatives_traits:: + select_name[] = "select_brep_build_package_requirement_alternatives"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::requirement_alternatives_traits:: + insert_name[] = "insert_brep_build_package_requirement_alternatives"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::requirement_alternatives_traits:: + delete_name[] = "delete_brep_build_package_requirement_alternatives"; + + const unsigned int access::object_traits_impl< ::brep::build_package, id_pgsql >::requirement_alternatives_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::int8_oid, + pgsql::text_oid, + pgsql::text_oid + }; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::requirement_alternatives_traits:: + select_statement[] = + "SELECT " + "\"build_package_requirement_alternatives\".\"requirement_index\", " + "\"build_package_requirement_alternatives\".\"index\", " + "\"build_package_requirement_alternatives\".\"enable\", " + "\"build_package_requirement_alternatives\".\"reflect\" " + "FROM \"build_package_requirement_alternatives\" " + "WHERE \"build_package_requirement_alternatives\".\"tenant\"=$1 AND \"build_package_requirement_alternatives\".\"name\"=$2::CITEXT AND \"build_package_requirement_alternatives\".\"version_epoch\"=$3 AND \"build_package_requirement_alternatives\".\"version_canonical_upstream\"=$4 AND \"build_package_requirement_alternatives\".\"version_canonical_release\"=$5 AND \"build_package_requirement_alternatives\".\"version_revision\"=$6"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::requirement_alternatives_traits:: + insert_statement[] = + "INSERT INTO \"build_package_requirement_alternatives\" " + "(\"tenant\", " + "\"name\", " + "\"version_epoch\", " + "\"version_canonical_upstream\", " + "\"version_canonical_release\", " + "\"version_revision\", " + "\"requirement_index\", " + "\"index\", " + "\"enable\", " + "\"reflect\") " + "VALUES " + "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8, $9, $10)"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::requirement_alternatives_traits:: + delete_statement[] = + "DELETE FROM \"build_package_requirement_alternatives\" " + "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 >::requirement_alternatives_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; + + // key + // + composite_value_traits< key_type, id_pgsql >::bind ( + b + n, d.key_value, sk); + n += 2UL; + + // 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 >::requirement_alternatives_traits:: + grow (data_image_type& i, + bool* t) + { + bool grew (false); + + // key + // + if (composite_value_traits< key_type, id_pgsql >::grow ( + i.key_value, t + 0UL)) + grew = true; + + // value + // + if (composite_value_traits< value_type, id_pgsql >::grow ( + i.value_value, t + 2UL)) + grew = true; + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::requirement_alternatives_traits:: + init (data_image_type& i, + const key_type* k, + const value_type& v) + { + using namespace pgsql; + + statement_kind sk (statement_insert); + ODB_POTENTIALLY_UNUSED (sk); + + bool grew (false); + + // key + // + if (k != 0) + { + composite_value_traits< key_type, id_pgsql >::init ( + i.key_value, + *k, + sk); + } + + // 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 >::requirement_alternatives_traits:: + init (key_type& k, + value_type& v, + const data_image_type& i, + database* db) + { + ODB_POTENTIALLY_UNUSED (db); + + // key + // + { + composite_value_traits< key_type, id_pgsql >::init ( + k, + i.key_value, + db); + } + + // value + // + { + composite_value_traits< value_type, id_pgsql >::init ( + v, + i.value_value, + db); + } + } + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::requirement_alternatives_traits:: + insert (const key_type& k, 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, &k, 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 >::requirement_alternatives_traits:: + select (key_type& k, 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 (k, 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 >::requirement_alternatives_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 >::requirement_alternatives_traits:: + persist (const container_type& c, + statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::persist (c, fs); + } + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::requirement_alternatives_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 ()); + container_traits_type::load (c, more, fs); + } + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::requirement_alternatives_traits:: + erase (statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::erase (fs); + } + + // requirement_alternative_requirements + // + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::requirement_alternative_requirements_traits:: + select_name[] = "select_brep_build_package_requirement_alternative_requirements"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::requirement_alternative_requirements_traits:: + insert_name[] = "insert_brep_build_package_requirement_alternative_requirements"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::requirement_alternative_requirements_traits:: + delete_name[] = "delete_brep_build_package_requirement_alternative_requirements"; + + const unsigned int access::object_traits_impl< ::brep::build_package, id_pgsql >::requirement_alternative_requirements_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::int8_oid, + pgsql::int8_oid, + pgsql::text_oid + }; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::requirement_alternative_requirements_traits:: + select_statement[] = + "SELECT " + "\"build_package_requirement_alternative_requirements\".\"requirement_index\", " + "\"build_package_requirement_alternative_requirements\".\"alternative_index\", " + "\"build_package_requirement_alternative_requirements\".\"index\", " + "\"build_package_requirement_alternative_requirements\".\"id\" " + "FROM \"build_package_requirement_alternative_requirements\" " + "WHERE \"build_package_requirement_alternative_requirements\".\"tenant\"=$1 AND \"build_package_requirement_alternative_requirements\".\"name\"=$2::CITEXT AND \"build_package_requirement_alternative_requirements\".\"version_epoch\"=$3 AND \"build_package_requirement_alternative_requirements\".\"version_canonical_upstream\"=$4 AND \"build_package_requirement_alternative_requirements\".\"version_canonical_release\"=$5 AND \"build_package_requirement_alternative_requirements\".\"version_revision\"=$6"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::requirement_alternative_requirements_traits:: + insert_statement[] = + "INSERT INTO \"build_package_requirement_alternative_requirements\" " + "(\"tenant\", " + "\"name\", " + "\"version_epoch\", " + "\"version_canonical_upstream\", " + "\"version_canonical_release\", " + "\"version_revision\", " + "\"requirement_index\", " + "\"alternative_index\", " + "\"index\", " + "\"id\") " + "VALUES " + "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8, $9, $10)"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::requirement_alternative_requirements_traits:: + delete_statement[] = + "DELETE FROM \"build_package_requirement_alternative_requirements\" " + "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 >::requirement_alternative_requirements_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; + + // key + // + composite_value_traits< key_type, id_pgsql >::bind ( + b + n, d.key_value, sk); + n += 3UL; + + // value + // + b[n].type = pgsql::bind::text; + b[n].buffer = d.value_value.data_ptr (); + b[n].capacity = d.value_value.capacity (); + b[n].size = &d.value_size; + b[n].is_null = &d.value_null; + } + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::requirement_alternative_requirements_traits:: + grow (data_image_type& i, + bool* t) + { + bool grew (false); + + // key + // + if (composite_value_traits< key_type, id_pgsql >::grow ( + i.key_value, t + 0UL)) + grew = true; + + // value + // + if (t[3UL]) + { + i.value_value.capacity (i.value_size); + grew = true; + } + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::requirement_alternative_requirements_traits:: + init (data_image_type& i, + const key_type* k, + const value_type& v) + { + using namespace pgsql; + + statement_kind sk (statement_insert); + ODB_POTENTIALLY_UNUSED (sk); + + bool grew (false); + + // key + // + if (k != 0) + { + composite_value_traits< key_type, id_pgsql >::init ( + i.key_value, + *k, + sk); + } + + // value + // + { + bool is_null (false); + std::size_t size (0); + std::size_t cap (i.value_value.capacity ()); + pgsql::value_traits< + value_type, + 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 ()); + } + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::requirement_alternative_requirements_traits:: + init (key_type& k, + value_type& v, + const data_image_type& i, + database* db) + { + ODB_POTENTIALLY_UNUSED (db); + + // key + // + { + composite_value_traits< key_type, id_pgsql >::init ( + k, + i.key_value, + db); + } + + // value + // + { + pgsql::value_traits< + value_type, + pgsql::id_string >::set_value ( + v, + i.value_value, + i.value_size, + i.value_null); + } + } + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::requirement_alternative_requirements_traits:: + insert (const key_type& k, 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, &k, 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 >::requirement_alternative_requirements_traits:: + select (key_type& k, 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 (k, 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 >::requirement_alternative_requirements_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 >::requirement_alternative_requirements_traits:: + persist (const container_type& c, + statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::persist (c, fs); + } + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::requirement_alternative_requirements_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 ()); + container_traits_type::load (c, more, fs); + } + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::requirement_alternative_requirements_traits:: + erase (statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::erase (fs); + } + + // 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::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::bool_oid, + pgsql::bool_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::int4_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::int4_oid, + pgsql::text_oid, + pgsql::bool_oid, + pgsql::text_oid, + pgsql::text_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_min_version_epoch\", " + "\"build_package_tests\".\"test_min_version_canonical_upstream\", " + "\"build_package_tests\".\"test_min_version_canonical_release\", " + "\"build_package_tests\".\"test_min_version_revision\", " + "\"build_package_tests\".\"test_min_version_upstream\", " + "\"build_package_tests\".\"test_min_version_release\", " + "\"build_package_tests\".\"test_max_version_epoch\", " + "\"build_package_tests\".\"test_max_version_canonical_upstream\", " + "\"build_package_tests\".\"test_max_version_canonical_release\", " + "\"build_package_tests\".\"test_max_version_revision\", " + "\"build_package_tests\".\"test_max_version_upstream\", " + "\"build_package_tests\".\"test_max_version_release\", " + "\"build_package_tests\".\"test_min_open\", " + "\"build_package_tests\".\"test_max_open\", " + "\"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\", " + "\"build_package_tests\".\"test_type\", " + "\"build_package_tests\".\"test_buildtime\", " + "\"build_package_tests\".\"test_enable\", " + "\"build_package_tests\".\"test_reflect\" " + "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_min_version_epoch\", " + "\"test_min_version_canonical_upstream\", " + "\"test_min_version_canonical_release\", " + "\"test_min_version_revision\", " + "\"test_min_version_upstream\", " + "\"test_min_version_release\", " + "\"test_max_version_epoch\", " + "\"test_max_version_canonical_upstream\", " + "\"test_max_version_canonical_release\", " + "\"test_max_version_revision\", " + "\"test_max_version_upstream\", " + "\"test_max_version_release\", " + "\"test_min_open\", " + "\"test_max_open\", " + "\"test_package_tenant\", " + "\"test_package_name\", " + "\"test_package_version_epoch\", " + "\"test_package_version_canonical_upstream\", " + "\"test_package_version_canonical_release\", " + "\"test_package_version_revision\", " + "\"test_type\", " + "\"test_buildtime\", " + "\"test_enable\", " + "\"test_reflect\") " + "VALUES " + "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8::CITEXT, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24::CITEXT, $25, $26, $27, $28, $29, $30, $31, $32)"; + + 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); + } + + // auxiliaries + // + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::auxiliaries_traits:: + select_name[] = "select_brep_build_package_auxiliaries"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::auxiliaries_traits:: + insert_name[] = "insert_brep_build_package_auxiliaries"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::auxiliaries_traits:: + delete_name[] = "delete_brep_build_package_auxiliaries"; + + const unsigned int access::object_traits_impl< ::brep::build_package, id_pgsql >::auxiliaries_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 + }; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::auxiliaries_traits:: + select_statement[] = + "SELECT " + "\"build_package_auxiliaries\".\"index\", " + "\"build_package_auxiliaries\".\"environment_name\", " + "\"build_package_auxiliaries\".\"config\", " + "\"build_package_auxiliaries\".\"comment\" " + "FROM \"build_package_auxiliaries\" " + "WHERE \"build_package_auxiliaries\".\"tenant\"=$1 AND \"build_package_auxiliaries\".\"name\"=$2::CITEXT AND \"build_package_auxiliaries\".\"version_epoch\"=$3 AND \"build_package_auxiliaries\".\"version_canonical_upstream\"=$4 AND \"build_package_auxiliaries\".\"version_canonical_release\"=$5 AND \"build_package_auxiliaries\".\"version_revision\"=$6 ORDER BY \"build_package_auxiliaries\".\"index\""; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::auxiliaries_traits:: + insert_statement[] = + "INSERT INTO \"build_package_auxiliaries\" " + "(\"tenant\", " + "\"name\", " + "\"version_epoch\", " + "\"version_canonical_upstream\", " + "\"version_canonical_release\", " + "\"version_revision\", " + "\"index\", " + "\"environment_name\", " + "\"config\", " + "\"comment\") " + "VALUES " + "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8, $9, $10)"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::auxiliaries_traits:: + delete_statement[] = + "DELETE FROM \"build_package_auxiliaries\" " + "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 >::auxiliaries_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 >::auxiliaries_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 >::auxiliaries_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 >::auxiliaries_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 >::auxiliaries_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 >::auxiliaries_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 >::auxiliaries_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 >::auxiliaries_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 >::auxiliaries_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 >::auxiliaries_traits:: + erase (statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + fs.ordered_ = true; + container_traits_type::erase (fs); + } + + // bot_keys + // + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::bot_keys_traits:: + select_name[] = "select_brep_build_package_bot_keys"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::bot_keys_traits:: + insert_name[] = "insert_brep_build_package_bot_keys"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::bot_keys_traits:: + delete_name[] = "delete_brep_build_package_bot_keys"; + + const unsigned int access::object_traits_impl< ::brep::build_package, id_pgsql >::bot_keys_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 >::bot_keys_traits:: + select_statement[] = + "SELECT " + "\"build_package_bot_keys\".\"index\", " + "\"build_package_bot_keys\".\"key_tenant\", " + "\"build_package_bot_keys\".\"key_fingerprint\" " + "FROM \"build_package_bot_keys\" " + "WHERE \"build_package_bot_keys\".\"tenant\"=$1 AND \"build_package_bot_keys\".\"name\"=$2::CITEXT AND \"build_package_bot_keys\".\"version_epoch\"=$3 AND \"build_package_bot_keys\".\"version_canonical_upstream\"=$4 AND \"build_package_bot_keys\".\"version_canonical_release\"=$5 AND \"build_package_bot_keys\".\"version_revision\"=$6 ORDER BY \"build_package_bot_keys\".\"index\""; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::bot_keys_traits:: + insert_statement[] = + "INSERT INTO \"build_package_bot_keys\" " + "(\"tenant\", " + "\"name\", " + "\"version_epoch\", " + "\"version_canonical_upstream\", " + "\"version_canonical_release\", " + "\"version_revision\", " + "\"index\", " + "\"key_tenant\", " + "\"key_fingerprint\") " + "VALUES " + "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8, $9)"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::bot_keys_traits:: + delete_statement[] = + "DELETE FROM \"build_package_bot_keys\" " + "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 >::bot_keys_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< ::brep::public_key_id, id_pgsql >::bind ( + b + n, d.value_value, sk); + } + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::bot_keys_traits:: + grow (data_image_type& i, + bool* t) + { + bool grew (false); + + // index + // + t[0UL] = 0; + + // value + // + if (composite_value_traits< ::brep::public_key_id, id_pgsql >::grow ( + i.value_value, t + 1UL)) + grew = true; + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::bot_keys_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 + // + { + typedef object_traits< ::brep::build_public_key > obj_traits; + typedef odb::pointer_traits< value_type > 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.value_value, + ptr_id, + sk)) + grew = true; + } + else + composite_value_traits< obj_traits::id_type, id_pgsql >::set_null (i.value_value, sk); + } + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::bot_keys_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 + // + { + typedef object_traits< ::brep::build_public_key > obj_traits; + typedef odb::pointer_traits< value_type > ptr_traits; + + if (composite_value_traits< obj_traits::id_type, id_pgsql >::get_null ( + i.value_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.value_value, + db); + + v = ptr_traits::pointer_type ( + *static_cast<pgsql::database*> (db), ptr_id); + } + } + } + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::bot_keys_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 >::bot_keys_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 >::bot_keys_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 >::bot_keys_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 >::bot_keys_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 >::bot_keys_traits:: + erase (statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + fs.ordered_ = true; + container_traits_type::erase (fs); + } + + // configs + // + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::configs_traits:: + select_name[] = "select_brep_build_package_configs"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::configs_traits:: + insert_name[] = "insert_brep_build_package_configs"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::configs_traits:: + delete_name[] = "delete_brep_build_package_configs"; + + const unsigned int access::object_traits_impl< ::brep::build_package, id_pgsql >::configs_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::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid + }; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::configs_traits:: + select_statement[] = + "SELECT " + "\"build_package_configs\".\"index\", " + "\"build_package_configs\".\"config_name\", " + "\"build_package_configs\".\"config_arguments\", " + "\"build_package_configs\".\"config_comment\", " + "\"build_package_configs\".\"config_email\", " + "\"build_package_configs\".\"config_email_comment\", " + "\"build_package_configs\".\"config_warning_email\", " + "\"build_package_configs\".\"config_warning_email_comment\", " + "\"build_package_configs\".\"config_error_email\", " + "\"build_package_configs\".\"config_error_email_comment\" " + "FROM \"build_package_configs\" " + "WHERE \"build_package_configs\".\"tenant\"=$1 AND \"build_package_configs\".\"name\"=$2::CITEXT AND \"build_package_configs\".\"version_epoch\"=$3 AND \"build_package_configs\".\"version_canonical_upstream\"=$4 AND \"build_package_configs\".\"version_canonical_release\"=$5 AND \"build_package_configs\".\"version_revision\"=$6 ORDER BY \"build_package_configs\".\"index\""; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::configs_traits:: + insert_statement[] = + "INSERT INTO \"build_package_configs\" " + "(\"tenant\", " + "\"name\", " + "\"version_epoch\", " + "\"version_canonical_upstream\", " + "\"version_canonical_release\", " + "\"version_revision\", " + "\"index\", " + "\"config_name\", " + "\"config_arguments\", " + "\"config_comment\", " + "\"config_email\", " + "\"config_email_comment\", " + "\"config_warning_email\", " + "\"config_warning_email_comment\", " + "\"config_error_email\", " + "\"config_error_email_comment\") " + "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_package, id_pgsql >::configs_traits:: + delete_statement[] = + "DELETE FROM \"build_package_configs\" " + "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 >::configs_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 >::configs_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 >::configs_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 >::configs_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 >::configs_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 >::configs_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 >::configs_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 >::configs_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 >::configs_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 >::configs_traits:: + erase (statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + fs.ordered_ = true; + container_traits_type::erase (fs); + } + + // config_builds + // + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::config_builds_traits:: + select_name[] = "select_brep_build_package_config_builds"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::config_builds_traits:: + insert_name[] = "insert_brep_build_package_config_builds"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::config_builds_traits:: + delete_name[] = "delete_brep_build_package_config_builds"; + + const unsigned int access::object_traits_impl< ::brep::build_package, id_pgsql >::config_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::int8_oid, + pgsql::text_oid, + pgsql::text_oid + }; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::config_builds_traits:: + select_statement[] = + "SELECT " + "\"build_package_config_builds\".\"config_index\", " + "\"build_package_config_builds\".\"index\", " + "\"build_package_config_builds\".\"expression\", " + "\"build_package_config_builds\".\"comment\" " + "FROM \"build_package_config_builds\" " + "WHERE \"build_package_config_builds\".\"tenant\"=$1 AND \"build_package_config_builds\".\"name\"=$2::CITEXT AND \"build_package_config_builds\".\"version_epoch\"=$3 AND \"build_package_config_builds\".\"version_canonical_upstream\"=$4 AND \"build_package_config_builds\".\"version_canonical_release\"=$5 AND \"build_package_config_builds\".\"version_revision\"=$6"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::config_builds_traits:: + insert_statement[] = + "INSERT INTO \"build_package_config_builds\" " + "(\"tenant\", " + "\"name\", " + "\"version_epoch\", " + "\"version_canonical_upstream\", " + "\"version_canonical_release\", " + "\"version_revision\", " + "\"config_index\", " + "\"index\", " + "\"expression\", " + "\"comment\") " + "VALUES " + "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8, $9, $10)"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::config_builds_traits:: + delete_statement[] = + "DELETE FROM \"build_package_config_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 >::config_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; + + // key + // + composite_value_traits< key_type, id_pgsql >::bind ( + b + n, d.key_value, sk); + n += 2UL; + + // 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 >::config_builds_traits:: + grow (data_image_type& i, + bool* t) + { + bool grew (false); + + // key + // + if (composite_value_traits< key_type, id_pgsql >::grow ( + i.key_value, t + 0UL)) + grew = true; + + // value + // + if (composite_value_traits< value_type, id_pgsql >::grow ( + i.value_value, t + 2UL)) + grew = true; + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::config_builds_traits:: + init (data_image_type& i, + const key_type* k, + const value_type& v) + { + using namespace pgsql; + + statement_kind sk (statement_insert); + ODB_POTENTIALLY_UNUSED (sk); + + bool grew (false); + + // key + // + if (k != 0) + { + composite_value_traits< key_type, id_pgsql >::init ( + i.key_value, + *k, + sk); + } + + // 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 >::config_builds_traits:: + init (key_type& k, + value_type& v, + const data_image_type& i, + database* db) + { + ODB_POTENTIALLY_UNUSED (db); + + // key + // + { + composite_value_traits< key_type, id_pgsql >::init ( + k, + i.key_value, + db); + } + + // value + // + { + composite_value_traits< value_type, id_pgsql >::init ( + v, + i.value_value, + db); + } + } + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::config_builds_traits:: + insert (const key_type& k, 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, &k, 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 >::config_builds_traits:: + select (key_type& k, 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 (k, 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 >::config_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 >::config_builds_traits:: + persist (const container_type& c, + statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::persist (c, fs); + } + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::config_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 ()); + container_traits_type::load (c, more, fs); + } + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::config_builds_traits:: + erase (statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::erase (fs); + } + + // config_constraints + // + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::config_constraints_traits:: + select_name[] = "select_brep_build_package_config_constraints"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::config_constraints_traits:: + insert_name[] = "insert_brep_build_package_config_constraints"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::config_constraints_traits:: + delete_name[] = "delete_brep_build_package_config_constraints"; + + const unsigned int access::object_traits_impl< ::brep::build_package, id_pgsql >::config_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::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 >::config_constraints_traits:: + select_statement[] = + "SELECT " + "\"build_package_config_constraints\".\"config_index\", " + "\"build_package_config_constraints\".\"index\", " + "\"build_package_config_constraints\".\"exclusion\", " + "\"build_package_config_constraints\".\"config\", " + "\"build_package_config_constraints\".\"target\", " + "\"build_package_config_constraints\".\"comment\" " + "FROM \"build_package_config_constraints\" " + "WHERE \"build_package_config_constraints\".\"tenant\"=$1 AND \"build_package_config_constraints\".\"name\"=$2::CITEXT AND \"build_package_config_constraints\".\"version_epoch\"=$3 AND \"build_package_config_constraints\".\"version_canonical_upstream\"=$4 AND \"build_package_config_constraints\".\"version_canonical_release\"=$5 AND \"build_package_config_constraints\".\"version_revision\"=$6"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::config_constraints_traits:: + insert_statement[] = + "INSERT INTO \"build_package_config_constraints\" " + "(\"tenant\", " + "\"name\", " + "\"version_epoch\", " + "\"version_canonical_upstream\", " + "\"version_canonical_release\", " + "\"version_revision\", " + "\"config_index\", " + "\"index\", " + "\"exclusion\", " + "\"config\", " + "\"target\", " + "\"comment\") " + "VALUES " + "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::config_constraints_traits:: + delete_statement[] = + "DELETE FROM \"build_package_config_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 >::config_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; + + // key + // + composite_value_traits< key_type, id_pgsql >::bind ( + b + n, d.key_value, sk); + n += 2UL; + + // 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 >::config_constraints_traits:: + grow (data_image_type& i, + bool* t) + { + bool grew (false); + + // key + // + if (composite_value_traits< key_type, id_pgsql >::grow ( + i.key_value, t + 0UL)) + grew = true; + + // value + // + if (composite_value_traits< value_type, id_pgsql >::grow ( + i.value_value, t + 2UL)) + grew = true; + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::config_constraints_traits:: + init (data_image_type& i, + const key_type* k, + const value_type& v) + { + using namespace pgsql; + + statement_kind sk (statement_insert); + ODB_POTENTIALLY_UNUSED (sk); + + bool grew (false); + + // key + // + if (k != 0) + { + composite_value_traits< key_type, id_pgsql >::init ( + i.key_value, + *k, + sk); + } + + // 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 >::config_constraints_traits:: + init (key_type& k, + value_type& v, + const data_image_type& i, + database* db) + { + ODB_POTENTIALLY_UNUSED (db); + + // key + // + { + composite_value_traits< key_type, id_pgsql >::init ( + k, + i.key_value, + db); + } + + // value + // + { + composite_value_traits< value_type, id_pgsql >::init ( + v, + i.value_value, + db); + } + } + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::config_constraints_traits:: + insert (const key_type& k, 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, &k, 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 >::config_constraints_traits:: + select (key_type& k, 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 (k, 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 >::config_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 >::config_constraints_traits:: + persist (const container_type& c, + statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::persist (c, fs); + } + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::config_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 ()); + container_traits_type::load (c, more, fs); + } + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::config_constraints_traits:: + erase (statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::erase (fs); + } + + // config_auxiliaries + // + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::config_auxiliaries_traits:: + select_name[] = "select_brep_build_package_config_auxiliaries"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::config_auxiliaries_traits:: + insert_name[] = "insert_brep_build_package_config_auxiliaries"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::config_auxiliaries_traits:: + delete_name[] = "delete_brep_build_package_config_auxiliaries"; + + const unsigned int access::object_traits_impl< ::brep::build_package, id_pgsql >::config_auxiliaries_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::int8_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid + }; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::config_auxiliaries_traits:: + select_statement[] = + "SELECT " + "\"build_package_config_auxiliaries\".\"config_index\", " + "\"build_package_config_auxiliaries\".\"index\", " + "\"build_package_config_auxiliaries\".\"environment_name\", " + "\"build_package_config_auxiliaries\".\"config\", " + "\"build_package_config_auxiliaries\".\"comment\" " + "FROM \"build_package_config_auxiliaries\" " + "WHERE \"build_package_config_auxiliaries\".\"tenant\"=$1 AND \"build_package_config_auxiliaries\".\"name\"=$2::CITEXT AND \"build_package_config_auxiliaries\".\"version_epoch\"=$3 AND \"build_package_config_auxiliaries\".\"version_canonical_upstream\"=$4 AND \"build_package_config_auxiliaries\".\"version_canonical_release\"=$5 AND \"build_package_config_auxiliaries\".\"version_revision\"=$6"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::config_auxiliaries_traits:: + insert_statement[] = + "INSERT INTO \"build_package_config_auxiliaries\" " + "(\"tenant\", " + "\"name\", " + "\"version_epoch\", " + "\"version_canonical_upstream\", " + "\"version_canonical_release\", " + "\"version_revision\", " + "\"config_index\", " + "\"index\", " + "\"environment_name\", " + "\"config\", " + "\"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 >::config_auxiliaries_traits:: + delete_statement[] = + "DELETE FROM \"build_package_config_auxiliaries\" " + "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 >::config_auxiliaries_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; + + // key + // + composite_value_traits< key_type, id_pgsql >::bind ( + b + n, d.key_value, sk); + n += 2UL; + + // 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 >::config_auxiliaries_traits:: + grow (data_image_type& i, + bool* t) + { + bool grew (false); + + // key + // + if (composite_value_traits< key_type, id_pgsql >::grow ( + i.key_value, t + 0UL)) + grew = true; + + // value + // + if (composite_value_traits< value_type, id_pgsql >::grow ( + i.value_value, t + 2UL)) + grew = true; + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::config_auxiliaries_traits:: + init (data_image_type& i, + const key_type* k, + const value_type& v) + { + using namespace pgsql; + + statement_kind sk (statement_insert); + ODB_POTENTIALLY_UNUSED (sk); + + bool grew (false); + + // key + // + if (k != 0) + { + composite_value_traits< key_type, id_pgsql >::init ( + i.key_value, + *k, + sk); + } + + // 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 >::config_auxiliaries_traits:: + init (key_type& k, + value_type& v, + const data_image_type& i, + database* db) + { + ODB_POTENTIALLY_UNUSED (db); + + // key + // + { + composite_value_traits< key_type, id_pgsql >::init ( + k, + i.key_value, + db); + } + + // value + // + { + composite_value_traits< value_type, id_pgsql >::init ( + v, + i.value_value, + db); + } + } + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::config_auxiliaries_traits:: + insert (const key_type& k, 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, &k, 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 >::config_auxiliaries_traits:: + select (key_type& k, 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 (k, 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 >::config_auxiliaries_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 >::config_auxiliaries_traits:: + persist (const container_type& c, + statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::persist (c, fs); + } + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::config_auxiliaries_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 ()); + container_traits_type::load (c, more, fs); + } + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::config_auxiliaries_traits:: + erase (statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::erase (fs); + } + + // config_bot_keys + // + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::config_bot_keys_traits:: + select_name[] = "select_brep_build_package_config_bot_keys"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::config_bot_keys_traits:: + insert_name[] = "insert_brep_build_package_config_bot_keys"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::config_bot_keys_traits:: + delete_name[] = "delete_brep_build_package_config_bot_keys"; + + const unsigned int access::object_traits_impl< ::brep::build_package, id_pgsql >::config_bot_keys_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::int8_oid, + pgsql::text_oid, + pgsql::text_oid + }; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::config_bot_keys_traits:: + select_statement[] = + "SELECT " + "\"build_package_config_bot_keys\".\"config_index\", " + "\"build_package_config_bot_keys\".\"index\", " + "\"build_package_config_bot_keys\".\"key_tenant\", " + "\"build_package_config_bot_keys\".\"key_fingerprint\" " + "FROM \"build_package_config_bot_keys\" " + "WHERE \"build_package_config_bot_keys\".\"tenant\"=$1 AND \"build_package_config_bot_keys\".\"name\"=$2::CITEXT AND \"build_package_config_bot_keys\".\"version_epoch\"=$3 AND \"build_package_config_bot_keys\".\"version_canonical_upstream\"=$4 AND \"build_package_config_bot_keys\".\"version_canonical_release\"=$5 AND \"build_package_config_bot_keys\".\"version_revision\"=$6"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::config_bot_keys_traits:: + insert_statement[] = + "INSERT INTO \"build_package_config_bot_keys\" " + "(\"tenant\", " + "\"name\", " + "\"version_epoch\", " + "\"version_canonical_upstream\", " + "\"version_canonical_release\", " + "\"version_revision\", " + "\"config_index\", " + "\"index\", " + "\"key_tenant\", " + "\"key_fingerprint\") " + "VALUES " + "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8, $9, $10)"; + + const char access::object_traits_impl< ::brep::build_package, id_pgsql >::config_bot_keys_traits:: + delete_statement[] = + "DELETE FROM \"build_package_config_bot_keys\" " + "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 >::config_bot_keys_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; + + // key + // + composite_value_traits< key_type, id_pgsql >::bind ( + b + n, d.key_value, sk); + n += 2UL; + + // value + // + composite_value_traits< ::brep::public_key_id, id_pgsql >::bind ( + b + n, d.value_value, sk); + } + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::config_bot_keys_traits:: + grow (data_image_type& i, + bool* t) + { + bool grew (false); + + // key + // + if (composite_value_traits< key_type, id_pgsql >::grow ( + i.key_value, t + 0UL)) + grew = true; + + // value + // + if (composite_value_traits< ::brep::public_key_id, id_pgsql >::grow ( + i.value_value, t + 2UL)) + grew = true; + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::config_bot_keys_traits:: + init (data_image_type& i, + const key_type* k, + const value_type& v) + { + using namespace pgsql; + + statement_kind sk (statement_insert); + ODB_POTENTIALLY_UNUSED (sk); + + bool grew (false); + + // key + // + if (k != 0) + { + composite_value_traits< key_type, id_pgsql >::init ( + i.key_value, + *k, + sk); + } + + // value + // + { + typedef object_traits< ::brep::build_public_key > obj_traits; + typedef odb::pointer_traits< value_type > 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.value_value, + ptr_id, + sk)) + grew = true; + } + else + composite_value_traits< obj_traits::id_type, id_pgsql >::set_null (i.value_value, sk); + } + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::config_bot_keys_traits:: + init (key_type& k, + value_type& v, + const data_image_type& i, + database* db) + { + ODB_POTENTIALLY_UNUSED (db); + + // key + // + { + composite_value_traits< key_type, id_pgsql >::init ( + k, + i.key_value, + db); + } + + // value + // + { + typedef object_traits< ::brep::build_public_key > obj_traits; + typedef odb::pointer_traits< value_type > ptr_traits; + + if (composite_value_traits< obj_traits::id_type, id_pgsql >::get_null ( + i.value_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.value_value, + db); + + v = ptr_traits::pointer_type ( + *static_cast<pgsql::database*> (db), ptr_id); + } + } + } + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::config_bot_keys_traits:: + insert (const key_type& k, 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, &k, 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 >::config_bot_keys_traits:: + select (key_type& k, 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 (k, 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 >::config_bot_keys_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 >::config_bot_keys_traits:: + persist (const container_type& c, + statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::persist (c, fs); + } + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::config_bot_keys_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 ()); + container_traits_type::load (c, more, fs); + } + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::config_bot_keys_traits:: + erase (statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::erase (fs); + } + + // requirements_tests_section + // + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::requirements_tests_section_traits:: + load (extra_statement_cache_type& esc, object_type& obj) + { + // requirements + // + { + ::brep::build_package::requirements_type& v = + obj.requirements; + + requirements_traits::load ( + v, + esc.requirements); + } + + // requirement_alternatives + // + { + ::brep::requirement_alternatives_map v; + + requirement_alternatives_traits::load ( + v, + esc.requirement_alternatives); + + // From build-package.hxx:246:7 + odb::nested_set (obj.requirements, std::move (v)); + } + + // requirement_alternative_requirements + // + { + ::brep::requirement_alternative_requirements_map v; + + requirement_alternative_requirements_traits::load ( + v, + esc.requirement_alternative_requirements); + + // From build-package.hxx:256:7 + odb::nested2_set (obj.requirements, std::move (v)); + } + + // tests + // + { + ::butl::small_vector< ::brep::build_test_dependency, 1 >& v = + obj.tests; + + tests_traits::load ( + v, + esc.tests); + } + } + + // constraints_section + // + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::constraints_section_traits:: + load (extra_statement_cache_type& esc, object_type& obj) + { + // 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); + } + + // config_builds + // + { + ::brep::build_class_exprs_map v; + + config_builds_traits::load ( + v, + esc.config_builds); + + // From build-package.hxx:294:7 + brep::build_package_config_builds bs; + odb::nested_set (bs, std::move (v)); + move (bs).to_configs (obj.configs); + } + + // config_constraints + // + { + ::brep::build_constraints_map v; + + config_constraints_traits::load ( + v, + esc.config_constraints); + + // From build-package.hxx:305:7 + brep::build_package_config_constraints cs; + odb::nested_set (cs, std::move (v)); + move (cs).to_configs (obj.configs); + } + } + + // auxiliaries_section + // + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::auxiliaries_section_traits:: + load (extra_statement_cache_type& esc, object_type& obj) + { + // auxiliaries + // + { + ::brep::build_auxiliaries& v = + obj.auxiliaries; + + auxiliaries_traits::load ( + v, + esc.auxiliaries); + } + + // config_auxiliaries + // + { + ::brep::build_auxiliaries_map v; + + config_auxiliaries_traits::load ( + v, + esc.config_auxiliaries); + + // From build-package.hxx:316:7 + brep::build_package_config_auxiliaries as; + odb::nested_set (as, std::move (v)); + move (as).to_configs (obj.configs); + } + } + + // bot_keys_section + // + + void access::object_traits_impl< ::brep::build_package, id_pgsql >::bot_keys_section_traits:: + load (extra_statement_cache_type& esc, object_type& obj) + { + // bot_keys + // + { + ::brep::build_package_bot_keys& v = + obj.bot_keys; + + bot_keys_traits::load ( + v, + esc.bot_keys); + } + + // config_bot_keys + // + { + ::brep::build_package_bot_keys_map v; + + config_bot_keys_traits::load ( + v, + esc.config_bot_keys); + + // From build-package.hxx:328:7 + brep::build_package_config_bot_keys < lazy_shared_ptr < brep::build_public_key >> bks; + odb::nested_set (bks, std::move (v)); + move (bks).to_configs (obj.configs); + } + } + + 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; + + // project + // + if (t[8UL]) + { + i.project_value.capacity (i.project_size); + grew = true; + } + + // build_email + // + if (composite_value_traits< ::bpkg::email, id_pgsql >::grow ( + i.build_email_value, t + 9UL)) + grew = true; + + // build_warning_email + // + if (composite_value_traits< ::bpkg::email, id_pgsql >::grow ( + i.build_warning_email_value, t + 11UL)) + grew = true; + + // build_error_email + // + if (composite_value_traits< ::bpkg::email, id_pgsql >::grow ( + i.build_error_email_value, t + 13UL)) + grew = true; + + // internal_repository + // + if (composite_value_traits< ::brep::repository_id, id_pgsql >::grow ( + i.internal_repository_value, t + 15UL)) + grew = true; + + // buildable + // + t[17UL] = 0; + + // custom_bot + // + t[18UL] = 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; + + // project + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.project_value.data_ptr (); + b[n].capacity = i.project_value.capacity (); + b[n].size = &i.project_size; + b[n].is_null = &i.project_null; + n++; + + // build_email + // + composite_value_traits< ::bpkg::email, id_pgsql >::bind ( + b + n, i.build_email_value, sk); + n += 2UL; + + // build_warning_email + // + composite_value_traits< ::bpkg::email, id_pgsql >::bind ( + b + n, i.build_warning_email_value, sk); + n += 2UL; + + // build_error_email + // + composite_value_traits< ::bpkg::email, id_pgsql >::bind ( + b + n, i.build_error_email_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++; + + // custom_bot + // + b[n].type = pgsql::bind::boolean_; + b[n].buffer = &i.custom_bot_value; + b[n].is_null = &i.custom_bot_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; + } + + // project + // + { + ::bpkg::package_name const& v = + o.project; + + bool is_null (false); + std::size_t size (0); + std::size_t cap (i.project_value.capacity ()); + pgsql::value_traits< + ::bpkg::package_name, + pgsql::id_string >::set_image ( + i.project_value, + size, + is_null, + v); + i.project_null = is_null; + i.project_size = size; + grew = grew || (cap != i.project_value.capacity ()); + } + + // build_email + // + { + ::butl::optional< ::bpkg::email > const& v = + o.build_email; + + if (wrapper_traits< ::butl::optional< ::bpkg::email > >::get_null (v)) + composite_value_traits< ::bpkg::email, id_pgsql >::set_null ( + i.build_email_value, sk); + else + { + const::bpkg::email& vw = + wrapper_traits< ::butl::optional< ::bpkg::email > >::get_ref (v); + + if (composite_value_traits< ::bpkg::email, id_pgsql >::init ( + i.build_email_value, + vw, + sk)) + grew = true; + } + } + + // build_warning_email + // + { + ::butl::optional< ::bpkg::email > const& v = + o.build_warning_email; + + if (wrapper_traits< ::butl::optional< ::bpkg::email > >::get_null (v)) + composite_value_traits< ::bpkg::email, id_pgsql >::set_null ( + i.build_warning_email_value, sk); + else + { + const::bpkg::email& vw = + wrapper_traits< ::butl::optional< ::bpkg::email > >::get_ref (v); + + if (composite_value_traits< ::bpkg::email, id_pgsql >::init ( + i.build_warning_email_value, + vw, + sk)) + grew = true; + } + } + + // build_error_email + // + { + ::butl::optional< ::bpkg::email > const& v = + o.build_error_email; + + if (wrapper_traits< ::butl::optional< ::bpkg::email > >::get_null (v)) + composite_value_traits< ::bpkg::email, id_pgsql >::set_null ( + i.build_error_email_value, sk); + else + { + const::bpkg::email& vw = + wrapper_traits< ::butl::optional< ::bpkg::email > >::get_ref (v); + + if (composite_value_traits< ::bpkg::email, id_pgsql >::init ( + i.build_error_email_value, + vw, + 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; + } + + // custom_bot + // + { + ::butl::optional< bool > const& v = + o.custom_bot; + + bool is_null (true); + pgsql::value_traits< + ::butl::optional< bool >, + pgsql::id_boolean >::set_image ( + i.custom_bot_value, is_null, v); + i.custom_bot_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:227:32 + ::brep::upstream_version v; + + composite_value_traits< ::brep::upstream_version, id_pgsql >::init ( + v, + i.version_value, + db); + + // From build-package.hxx:227:32 + o.version.init (o.id.version, (v)); + } + + // project + // + { + ::bpkg::package_name& v = + o.project; + + pgsql::value_traits< + ::bpkg::package_name, + pgsql::id_string >::set_value ( + v, + i.project_value, + i.project_size, + i.project_null); + } + + // build_email + // + { + ::butl::optional< ::bpkg::email >& v = + o.build_email; + + if (composite_value_traits< ::bpkg::email, id_pgsql >::get_null ( + i.build_email_value)) + wrapper_traits< ::butl::optional< ::bpkg::email > >::set_null (v); + else + { + ::bpkg::email& vw = + wrapper_traits< ::butl::optional< ::bpkg::email > >::set_ref (v); + + composite_value_traits< ::bpkg::email, id_pgsql >::init ( + vw, + i.build_email_value, + db); + } + } + + // build_warning_email + // + { + ::butl::optional< ::bpkg::email >& v = + o.build_warning_email; + + if (composite_value_traits< ::bpkg::email, id_pgsql >::get_null ( + i.build_warning_email_value)) + wrapper_traits< ::butl::optional< ::bpkg::email > >::set_null (v); + else + { + ::bpkg::email& vw = + wrapper_traits< ::butl::optional< ::bpkg::email > >::set_ref (v); + + composite_value_traits< ::bpkg::email, id_pgsql >::init ( + vw, + i.build_warning_email_value, + db); + } + } + + // build_error_email + // + { + ::butl::optional< ::bpkg::email >& v = + o.build_error_email; + + if (composite_value_traits< ::bpkg::email, id_pgsql >::get_null ( + i.build_error_email_value)) + wrapper_traits< ::butl::optional< ::bpkg::email > >::set_null (v); + else + { + ::bpkg::email& vw = + wrapper_traits< ::butl::optional< ::bpkg::email > >::set_ref (v); + + composite_value_traits< ::bpkg::email, id_pgsql >::init ( + vw, + i.build_error_email_value, + db); + } + } + + // 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); + } + + // custom_bot + // + { + ::butl::optional< bool >& v = + o.custom_bot; + + pgsql::value_traits< + ::butl::optional< bool >, + pgsql::id_boolean >::set_value ( + v, + i.custom_bot_value, + i.custom_bot_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\", " + "\"project\", " + "\"build_email\", " + "\"build_email_comment\", " + "\"build_warning_email\", " + "\"build_warning_email_comment\", " + "\"build_error_email\", " + "\"build_error_email_comment\", " + "\"internal_repository_tenant\", " + "\"internal_repository_canonical_name\", " + "\"buildable\", " + "\"custom_bot\") " + "VALUES " + "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8, $9::CITEXT, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19)"; + + 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\".\"project\"::TEXT, " + "\"build_package\".\"build_email\", " + "\"build_package\".\"build_email_comment\", " + "\"build_package\".\"build_warning_email\", " + "\"build_package\".\"build_warning_email_comment\", " + "\"build_package\".\"build_error_email\", " + "\"build_package\".\"build_error_email_comment\", " + "\"build_package\".\"internal_repository_tenant\", " + "\"build_package\".\"internal_repository_canonical_name\", " + "\"build_package\".\"buildable\", " + "\"build_package\".\"custom_bot\" " + "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\".\"project\"::TEXT,\n" + "\"build_package\".\"build_email\",\n" + "\"build_package\".\"build_email_comment\",\n" + "\"build_package\".\"build_warning_email\",\n" + "\"build_package\".\"build_warning_email_comment\",\n" + "\"build_package\".\"build_error_email\",\n" + "\"build_package\".\"build_error_email_comment\",\n" + "\"build_package\".\"internal_repository_tenant\",\n" + "\"build_package\".\"internal_repository_canonical_name\",\n" + "\"build_package\".\"buildable\",\n" + "\"build_package\".\"custom_bot\"\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) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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 ()); + + // requirements + // + { + ::brep::build_package::requirements_type const& v = + obj.requirements; + + requirements_traits::persist ( + v, + esc.requirements); + } + + // requirement_alternatives + // + { + // From build-package.hxx:245:7 + ::brep::requirement_alternatives_map const& v = + odb::nested_get (obj.requirements); + + requirement_alternatives_traits::persist ( + v, + esc.requirement_alternatives); + } + + // requirement_alternative_requirements + // + { + // From build-package.hxx:255:7 + ::brep::requirement_alternative_requirements_map const& v = + odb::nested2_get (obj.requirements); + + requirement_alternative_requirements_traits::persist ( + v, + esc.requirement_alternative_requirements); + } + + // 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); + } + + // auxiliaries + // + { + ::brep::build_auxiliaries const& v = + obj.auxiliaries; + + auxiliaries_traits::persist ( + v, + esc.auxiliaries); + } + + // bot_keys + // + { + ::brep::build_package_bot_keys const& v = + obj.bot_keys; + + bot_keys_traits::persist ( + v, + esc.bot_keys); + } + + // configs + // + { + ::brep::build_package_configs const& v = + obj.configs; + + configs_traits::persist ( + v, + esc.configs); + } + + // config_builds + // + { + // From build-package.hxx:292:7 + ::brep::build_class_exprs_map const& v = + odb::nested_get (brep::build_package_config_builds (obj.configs)); + + config_builds_traits::persist ( + v, + esc.config_builds); + } + + // config_constraints + // + { + // From build-package.hxx:303:7 + ::brep::build_constraints_map const& v = + odb::nested_get (brep::build_package_config_constraints (obj.configs)); + + config_constraints_traits::persist ( + v, + esc.config_constraints); + } + + // config_auxiliaries + // + { + // From build-package.hxx:314:7 + ::brep::build_auxiliaries_map const& v = + odb::nested_get (brep::build_package_config_auxiliaries (obj.configs)); + + config_auxiliaries_traits::persist ( + v, + esc.config_auxiliaries); + } + + // config_bot_keys + // + { + // From build-package.hxx:325:7 + ::brep::build_package_bot_keys_map const& v = + odb::nested_get (brep::build_package_config_bot_keys < lazy_shared_ptr < brep::build_public_key >> (obj.configs)); + + config_bot_keys_traits::persist ( + v, + esc.config_bot_keys); + } + + obj.requirements_tests_section.reset (true, false); + + obj.constraints_section.reset (true, false); + + obj.auxiliaries_section.reset (true, false); + + obj.bot_keys_section.reset (true, false); + + 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; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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 ()); + + // requirements + // + { + requirements_traits::erase ( + esc.requirements); + } + + // requirement_alternatives + // + { + requirement_alternatives_traits::erase ( + esc.requirement_alternatives); + } + + // requirement_alternative_requirements + // + { + requirement_alternative_requirements_traits::erase ( + esc.requirement_alternative_requirements); + } + + // tests + // + { + tests_traits::erase ( + esc.tests); + } + + // builds + // + { + builds_traits::erase ( + esc.builds); + } + + // constraints + // + { + constraints_traits::erase ( + esc.constraints); + } + + // auxiliaries + // + { + auxiliaries_traits::erase ( + esc.auxiliaries); + } + + // bot_keys + // + { + bot_keys_traits::erase ( + esc.bot_keys); + } + + // configs + // + { + configs_traits::erase ( + esc.configs); + } + + // config_builds + // + { + config_builds_traits::erase ( + esc.config_builds); + } + + // config_constraints + // + { + config_constraints_traits::erase ( + esc.config_constraints); + } + + // config_auxiliaries + // + { + config_auxiliaries_traits::erase ( + esc.config_auxiliaries); + } + + // config_bot_keys + // + { + config_bot_keys_traits::erase ( + esc.config_bot_keys); + } + + 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 (db)); + 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 (db)); + 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 (db)); + 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 >:: + 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.requirements_tests_section) + { + requirements_tests_section_traits::load (esc, obj); + r = true; + } + + if (!r && &s == &obj.constraints_section) + { + constraints_section_traits::load (esc, obj); + r = true; + } + + if (!r && &s == &obj.auxiliaries_section) + { + auxiliaries_section_traits::load (esc, obj); + r = true; + } + + if (!r && &s == &obj.bot_keys_section) + { + bot_keys_section_traits::load (esc, obj); + r = true; + } + + sts.load_delayed (0); + l.unlock (); + return r; + } + + 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 ()); + + // configs + // + { + ::brep::build_package_configs& v = + obj.configs; + + configs_traits::load ( + v, + esc.configs); + } + + if (reload) + { + if (obj.requirements_tests_section.loaded ()) + { + requirements_tests_section_traits::load (esc, obj); + obj.requirements_tests_section.reset (true, false); + } + } + else + obj.requirements_tests_section.reset (); + + if (reload) + { + if (obj.constraints_section.loaded ()) + { + constraints_section_traits::load (esc, obj); + obj.constraints_section.reset (true, false); + } + } + else + obj.constraints_section.reset (); + + if (reload) + { + if (obj.auxiliaries_section.loaded ()) + { + auxiliaries_section_traits::load (esc, obj); + obj.auxiliaries_section.reset (true, false); + } + } + else + obj.auxiliaries_section.reset (); + + if (reload) + { + if (obj.bot_keys_section.loaded ()) + { + bot_keys_section_traits::load (esc, obj); + obj.bot_keys_section.reset (true, false); + } + } + else + obj.bot_keys_section.reset (); + } + + result< access::object_traits_impl< ::brep::build_package, id_pgsql >::object_type > + access::object_traits_impl< ::brep::build_package, id_pgsql >:: + query (database& db, const query_base_type& q) + { + using namespace pgsql; + using odb::details::shared; + using odb::details::shared_ptr; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + + 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& db, const query_base_type& q) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + + 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::transaction& tr (pgsql::transaction::current ()); + ODB_POTENTIALLY_UNUSED (tr); + + // The connection used by the current transaction and the + // one used to prepare this statement must be the same. + // + assert (q.verify_connection (tr)); + + statements_type& sts ( + st->connection ().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_package_version + // + + const char access::view_traits_impl< ::brep::build_package_version, id_pgsql >:: + query_statement_name[] = "query_brep_build_package_version"; + + bool access::view_traits_impl< ::brep::build_package_version, 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; + + return grew; + } + + void access::view_traits_impl< ::brep::build_package_version, 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; + } + + void access::view_traits_impl< ::brep::build_package_version, 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:352:32 + ::brep::upstream_version v; + + composite_value_traits< ::brep::upstream_version, id_pgsql >::init ( + v, + i.version_value, + db); + + // From build-package.hxx:352:32 + o.version.init (o.id.version, (v)); + } + } + + access::view_traits_impl< ::brep::build_package_version, id_pgsql >::query_base_type + access::view_traits_impl< ::brep::build_package_version, 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\" "); + + r += "FROM \"build_package\""; + + if (!q.empty ()) + { + r += " "; + r += q.clause_prefix (); + r += q; + } + + return r; + } + + result< access::view_traits_impl< ::brep::build_package_version, id_pgsql >::view_type > + access::view_traits_impl< ::brep::build_package_version, id_pgsql >:: + query (database& db, const query_base_type& q) + { + using namespace pgsql; + using odb::details::shared; + using odb::details::shared_ptr; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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::build_package_version, 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::build_package_version, 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::transaction& tr (pgsql::transaction::current ()); + ODB_POTENTIALLY_UNUSED (tr); + + // The connection used by the current transaction and the + // one used to prepare this statement must be the same. + // + assert (q.verify_connection (tr)); + + statements_type& sts ( + st->connection ().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 + // + + 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); + + // package + // + if (object_traits_impl< ::brep::build_package, id_pgsql >::grow ( + i.package_value, t + 0UL)) + grew = true; + + // archived + // + t[19UL] = 0; + + // interactive + // + if (t[20UL]) + { + i.interactive_value.capacity (i.interactive_size); + grew = true; + } + + 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); + + // package + // + object_traits_impl< ::brep::build_package, id_pgsql >::bind ( + b + n, i.package_value, sk); + n += 19UL; + + // archived + // + b[n].type = pgsql::bind::boolean_; + b[n].buffer = &i.archived_value; + b[n].is_null = &i.archived_null; + n++; + + // interactive + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.interactive_value.data_ptr (); + b[n].capacity = i.interactive_value.capacity (); + b[n].size = &i.interactive_size; + b[n].is_null = &i.interactive_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); + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (*db)); + + // package pre + // + typedef ::brep::build_package package_object_type; + typedef object_traits_impl<package_object_type, id_pgsql> package_object_traits; + typedef package_object_traits::pointer_type package_pointer_type; + typedef package_object_traits::pointer_traits package_pointer_traits; + typedef package_object_traits::pointer_cache_traits package_cache_traits; + + package_object_traits::id_type package_id; + package_pointer_type package_p; + package_pointer_traits::guard package_pg; + package_cache_traits::insert_guard package_ig; + package_object_type* package_o (0); + + { + if (!composite_value_traits< package_object_traits::id_type, id_pgsql >::get_null ( + i.package_value.id_value)) + { + package_id = package_object_traits::id (i.package_value); + package_p = package_cache_traits::find (*db, package_id); + + if (package_pointer_traits::null_ptr (package_p)) + { + package_p = object_factory<package_object_type, package_pointer_type>::create (); + package_pg.reset (package_p); + package_ig.reset (package_cache_traits::insert (*db, package_id, package_p)); + package_o = package_pointer_traits::get_ptr (package_p); + } + } + } + + // package + // + { + if (package_o != 0) + { + package_object_traits::callback (*db, *package_o, callback_event::pre_load); + package_object_traits::init (*package_o, i.package_value, db); + package_object_traits::statements_type& sts ( + conn.statement_cache ().find_object<package_object_type> ()); + package_object_traits::statements_type::auto_lock l (sts); + assert (l.locked ()) /* Must be a top-level call. */; + + package_object_traits::id_image_type& i (sts.id_image ()); + package_object_traits::init (i, package_id); + pgsql::binding& idb (sts.id_image_binding ()); + if (i.version != sts.id_image_version () || idb.version == 0) + { + package_object_traits::bind (idb.bind, i); + sts.id_image_version (i.version); + idb.version++; + } + + package_object_traits::load_ (sts, *package_o, false); + sts.load_delayed (0); + l.unlock (); + } + } + + // archived + // + { + bool& v = + o.archived; + + pgsql::value_traits< + bool, + pgsql::id_boolean >::set_value ( + v, + i.archived_value, + i.archived_null); + } + + // interactive + // + { + ::butl::optional< ::std::basic_string< char > >& v = + o.interactive; + + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_value ( + v, + i.interactive_value, + i.interactive_size, + i.interactive_null); + } + + // package post + // + { + if (package_o != 0) + { + package_object_traits::callback (*db, *package_o, callback_event::post_load); + package_cache_traits::load (package_ig.position ()); + package_ig.release (); + package_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.package = ::std::shared_ptr< ::brep::build_package > ( + std::move (package_p)); + } + } + + 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_package\".\"project\"::TEXT, " + "\"build_package\".\"build_email\", " + "\"build_package\".\"build_email_comment\", " + "\"build_package\".\"build_warning_email\", " + "\"build_package\".\"build_warning_email_comment\", " + "\"build_package\".\"build_error_email\", " + "\"build_package\".\"build_error_email_comment\", " + "\"build_package\".\"internal_repository_tenant\", " + "\"build_package\".\"internal_repository_canonical_name\", " + "\"build_package\".\"buildable\", " + "\"build_package\".\"custom_bot\", " + "\"build_tenant\".\"archived\", " + "\"build_tenant\".\"interactive\" "); + + r += "FROM \"build_package\""; + + r += " INNER JOIN \"build_repository\" ON"; + // From build-package.hxx:362: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:366: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& db, const query_base_type& q) + { + using namespace pgsql; + using odb::details::shared; + using odb::details::shared_ptr; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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::transaction& tr (pgsql::transaction::current ()); + ODB_POTENTIALLY_UNUSED (tr); + + // The connection used by the current transaction and the + // one used to prepare this statement must be the same. + // + assert (q.verify_connection (tr)); + + statements_type& sts ( + st->connection ().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:380: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:384: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& db, const query_base_type& q) + { + using namespace pgsql; + using odb::details::shared; + using odb::details::shared_ptr; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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::transaction& tr (pgsql::transaction::current ()); + ODB_POTENTIALLY_UNUSED (tr); + + // The connection used by the current transaction and the + // one used to prepare this statement must be the same. + // + assert (q.verify_connection (tr)); + + statements_type& sts ( + st->connection ().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..c8b59c7 --- /dev/null +++ b/libbrep/build-package-odb.hxx @@ -0,0 +1,4076 @@ +// -*- 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 != 20476UL +#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_public_key + // + template <> + struct class_traits< ::brep::build_public_key > + { + static const class_kind kind = class_object; + }; + + template <> + class access::object_traits< ::brep::build_public_key > + { + public: + typedef ::brep::build_public_key object_type; + typedef ::std::shared_ptr< ::brep::build_public_key > pointer_type; + typedef odb::pointer_traits<pointer_type> pointer_traits; + + static const bool polymorphic = false; + + typedef ::brep::public_key_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); + }; + + // build_package_version + // + template <> + struct class_traits< ::brep::build_package_version > + { + static const class_kind kind = class_view; + }; + + template <> + class access::view_traits< ::brep::build_package_version > + { + public: + typedef ::brep::build_package_version view_type; + typedef ::brep::build_package_version* pointer_type; + + static void + callback (database&, view_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; + + // private_ + // + typedef + pgsql::query_column< + pgsql::value_traits< + bool, + pgsql::id_boolean >::query_type, + pgsql::id_boolean > + private__type_; + + static const private__type_ private_; + + // interactive + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::basic_string< char >, + pgsql::id_string >::query_type, + pgsql::id_string > + interactive_type_; + + static const interactive_type_ interactive; + + // creation_timestamp + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::uint64_t, + pgsql::id_bigint >::query_type, + pgsql::id_bigint > + creation_timestamp_type_; + + static const creation_timestamp_type_ creation_timestamp; + + // archived + // + typedef + pgsql::query_column< + pgsql::value_traits< + bool, + pgsql::id_boolean >::query_type, + pgsql::id_boolean > + archived_type_; + + static const archived_type_ archived; + + // service + // + struct service_class_ + { + service_class_ () + { + } + + // 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; + + // 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; + + // data + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::basic_string< char >, + pgsql::id_string >::query_type, + pgsql::id_string > + data_type_; + + static const data_type_ data; + }; + + static const service_class_ service; + + // loaded_timestamp + // + typedef + pgsql::query_column< + pgsql::value_traits< + long unsigned int, + pgsql::id_bigint >::query_type, + pgsql::id_bigint > + loaded_timestamp_type_; + + static const loaded_timestamp_type_ loaded_timestamp; + + // queued_timestamp + // + typedef + pgsql::query_column< + pgsql::value_traits< + long unsigned int, + pgsql::id_bigint >::query_type, + pgsql::id_bigint > + queued_timestamp_type_; + + static const queued_timestamp_type_ queued_timestamp; + + // toolchain + // + struct toolchain_class_ + { + toolchain_class_ () + { + } + + // name + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + 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< + short unsigned int, + pgsql::id_integer >::query_type, + pgsql::id_integer > + revision_type_; + + static const revision_type_ revision; + + // 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_1_ version; + }; + + static const toolchain_class_ toolchain; + }; + + 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 >::private__type_ + query_columns< ::brep::build_tenant, id_pgsql, A >:: + private_ (A::table_name, "\"private\"", 0); + + template <typename A> + const typename query_columns< ::brep::build_tenant, id_pgsql, A >::interactive_type_ + query_columns< ::brep::build_tenant, id_pgsql, A >:: + interactive (A::table_name, "\"interactive\"", 0); + + template <typename A> + const typename query_columns< ::brep::build_tenant, id_pgsql, A >::creation_timestamp_type_ + query_columns< ::brep::build_tenant, id_pgsql, A >:: + creation_timestamp (A::table_name, "\"creation_timestamp\"", 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> + const typename query_columns< ::brep::build_tenant, id_pgsql, A >::service_class_::id_type_ + query_columns< ::brep::build_tenant, id_pgsql, A >::service_class_:: + id (A::table_name, "\"service_id\"", 0); + + template <typename A> + const typename query_columns< ::brep::build_tenant, id_pgsql, A >::service_class_::type_type_ + query_columns< ::brep::build_tenant, id_pgsql, A >::service_class_:: + type (A::table_name, "\"service_type\"", 0); + + template <typename A> + const typename query_columns< ::brep::build_tenant, id_pgsql, A >::service_class_::data_type_ + query_columns< ::brep::build_tenant, id_pgsql, A >::service_class_:: + data (A::table_name, "\"service_data\"", 0); + + template <typename A> + const typename query_columns< ::brep::build_tenant, id_pgsql, A >::service_class_ + query_columns< ::brep::build_tenant, id_pgsql, A >::service; + + template <typename A> + const typename query_columns< ::brep::build_tenant, id_pgsql, A >::loaded_timestamp_type_ + query_columns< ::brep::build_tenant, id_pgsql, A >:: + loaded_timestamp (A::table_name, "\"loaded_timestamp\"", 0); + + template <typename A> + const typename query_columns< ::brep::build_tenant, id_pgsql, A >::queued_timestamp_type_ + query_columns< ::brep::build_tenant, id_pgsql, A >:: + queued_timestamp (A::table_name, "\"queued_timestamp\"", 0); + + template <typename A> + const typename query_columns< ::brep::build_tenant, id_pgsql, A >::toolchain_class_::name_type_ + query_columns< ::brep::build_tenant, id_pgsql, A >::toolchain_class_:: + name (A::table_name, "\"toolchain_name\"", 0); + + template <typename A> + const typename query_columns< ::brep::build_tenant, id_pgsql, A >::toolchain_class_::version_class_1_::epoch_type_ + query_columns< ::brep::build_tenant, id_pgsql, A >::toolchain_class_::version_class_1_:: + epoch (A::table_name, "\"toolchain_version_epoch\"", 0); + + template <typename A> + const typename query_columns< ::brep::build_tenant, id_pgsql, A >::toolchain_class_::version_class_1_::canonical_upstream_type_ + query_columns< ::brep::build_tenant, id_pgsql, A >::toolchain_class_::version_class_1_:: + canonical_upstream (A::table_name, "\"toolchain_version_canonical_upstream\"", 0); + + template <typename A> + const typename query_columns< ::brep::build_tenant, id_pgsql, A >::toolchain_class_::version_class_1_::canonical_release_type_ + query_columns< ::brep::build_tenant, id_pgsql, A >::toolchain_class_::version_class_1_:: + canonical_release (A::table_name, "\"toolchain_version_canonical_release\"", 0); + + template <typename A> + const typename query_columns< ::brep::build_tenant, id_pgsql, A >::toolchain_class_::version_class_1_::revision_type_ + query_columns< ::brep::build_tenant, id_pgsql, A >::toolchain_class_::version_class_1_:: + revision (A::table_name, "\"toolchain_version_revision\"", 0); + + template <typename A> + const typename query_columns< ::brep::build_tenant, id_pgsql, A >::toolchain_class_::version_class_1_::upstream_type_ + query_columns< ::brep::build_tenant, id_pgsql, A >::toolchain_class_::version_class_1_:: + upstream (A::table_name, "\"toolchain_version_upstream\"", 0); + + template <typename A> + const typename query_columns< ::brep::build_tenant, id_pgsql, A >::toolchain_class_::version_class_1_::release_type_ + query_columns< ::brep::build_tenant, id_pgsql, A >::toolchain_class_::version_class_1_:: + release (A::table_name, "\"toolchain_version_release\"", 0); + + template <typename A> + const typename query_columns< ::brep::build_tenant, id_pgsql, A >::toolchain_class_::version_class_1_ + query_columns< ::brep::build_tenant, id_pgsql, A >::toolchain_class_::version; + + template <typename A> + const typename query_columns< ::brep::build_tenant, id_pgsql, A >::toolchain_class_ + query_columns< ::brep::build_tenant, id_pgsql, A >::toolchain; + + 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; + + // private_ + // + bool private_value; + bool private_null; + + // interactive + // + details::buffer interactive_value; + std::size_t interactive_size; + bool interactive_null; + + // creation_timestamp + // + long long creation_timestamp_value; + bool creation_timestamp_null; + + // archived + // + bool archived_value; + bool archived_null; + + // service + // + composite_value_traits< ::brep::tenant_service, id_pgsql >::image_type service_value; + + // loaded_timestamp + // + long long loaded_timestamp_value; + bool loaded_timestamp_null; + + // queued_timestamp + // + long long queued_timestamp_value; + bool queued_timestamp_null; + + // toolchain + // + composite_value_traits< ::brep::build_toolchain, id_pgsql >::image_type toolchain_value; + + 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 = 17UL; + static const std::size_t id_column_count = 1UL; + static const std::size_t inverse_column_count = 0UL; + static const std::size_t readonly_column_count = 0UL; + static const std::size_t managed_optimistic_column_count = 0UL; + + static const std::size_t separate_load_column_count = 0UL; + static const std::size_t separate_update_column_count = 0UL; + + static const bool versioned = false; + + static const char persist_statement[]; + static const char find_statement[]; + static const char update_statement[]; + static const char erase_statement[]; + static const char query_statement[]; + static const char erase_query_statement[]; + + static const char table_name[]; + + static void + persist (database&, 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[]; + + static const std::size_t batch = 1UL; + + 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[]; + + static const std::size_t batch = 1UL; + + 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_public_key + // + template <typename A> + struct query_columns< ::brep::build_public_key, 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; + + // fingerprint + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + fingerprint_type_; + + static const fingerprint_type_ fingerprint; + }; + + static const id_class_ id; + + // data + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + data_type_; + + static const data_type_ data; + }; + + template <typename A> + const typename query_columns< ::brep::build_public_key, id_pgsql, A >::id_class_::tenant_type_ + query_columns< ::brep::build_public_key, id_pgsql, A >::id_class_:: + tenant (A::table_name, "\"tenant\"", 0); + + template <typename A> + const typename query_columns< ::brep::build_public_key, id_pgsql, A >::id_class_::fingerprint_type_ + query_columns< ::brep::build_public_key, id_pgsql, A >::id_class_:: + fingerprint (A::table_name, "\"fingerprint\"", 0); + + template <typename A> + const typename query_columns< ::brep::build_public_key, id_pgsql, A >::id_class_ + query_columns< ::brep::build_public_key, id_pgsql, A >::id; + + template <typename A> + const typename query_columns< ::brep::build_public_key, id_pgsql, A >::data_type_ + query_columns< ::brep::build_public_key, id_pgsql, A >:: + data (A::table_name, "\"data\"", 0); + + template <typename A> + struct pointer_query_columns< ::brep::build_public_key, id_pgsql, A >: + query_columns< ::brep::build_public_key, id_pgsql, A > + { + }; + + template <> + class access::object_traits_impl< ::brep::build_public_key, id_pgsql >: + public access::object_traits< ::brep::build_public_key > + { + public: + struct id_image_type + { + composite_value_traits< ::brep::public_key_id, id_pgsql >::image_type id_value; + + std::size_t version; + }; + + struct image_type + { + // id + // + composite_value_traits< ::brep::public_key_id, id_pgsql >::image_type id_value; + + // data + // + details::buffer data_value; + std::size_t data_size; + bool data_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 = 3UL; + 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 = 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[]; + + static const std::size_t batch = 1UL; + + 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_public_key, id_common >: + public access::object_traits_impl< ::brep::build_public_key, id_pgsql > + { + }; + + // build_package_config + // + template <> + class access::composite_value_traits< ::brep::build_package_config, id_pgsql > + { + public: + typedef ::brep::build_package_config value_type; + + struct image_type + { + // name + // + details::buffer name_value; + std::size_t name_size; + bool name_null; + + // arguments + // + details::buffer arguments_value; + std::size_t arguments_size; + bool arguments_null; + + // comment + // + details::buffer comment_value; + std::size_t comment_size; + bool comment_null; + + // email + // + composite_value_traits< ::bpkg::email, id_pgsql >::image_type email_value; + + // warning_email + // + composite_value_traits< ::bpkg::email, id_pgsql >::image_type warning_email_value; + + // error_email + // + composite_value_traits< ::bpkg::email, id_pgsql >::image_type error_email_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 = 9UL; + }; + + // build_package_bot_key_key + // + template <> + class access::composite_value_traits< ::brep::build_package_bot_key_key, id_pgsql > + { + public: + typedef ::brep::build_package_bot_key_key value_type; + + struct image_type + { + // outer + // + long long outer_value; + bool outer_null; + + // inner + // + long long inner_value; + bool inner_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; + }; + + // build_dependency + // + template <> + class access::composite_value_traits< ::brep::build_dependency, id_pgsql > + { + public: + typedef ::brep::build_dependency value_type; + + struct image_type + { + // name + // + details::buffer name_value; + std::size_t name_size; + bool name_null; + + // constraint + // + composite_value_traits< ::bpkg::version_constraint, id_pgsql >::image_type constraint_value; + + // 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 = 21UL; + }; + + // 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: composite_value_traits< ::brep::build_dependency, id_pgsql >::image_type + { + // type + // + details::buffer type_value; + std::size_t type_size; + bool type_null; + + // buildtime + // + bool buildtime_value; + bool buildtime_null; + + // enable + // + details::buffer enable_value; + std::size_t enable_size; + bool enable_null; + + // reflect + // + details::buffer reflect_value; + std::size_t reflect_size; + bool reflect_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 = 25UL; + }; + + // 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; + + // project + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::bpkg::package_name, + pgsql::id_string >::query_type, + pgsql::id_string > + project_type_; + + static const project_type_ project; + + // build_email + // + struct build_email_class_ + { + build_email_class_ () + { + } + + // value + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + value_type_; + + static const value_type_ value; + + // comment + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + comment_type_; + + static const comment_type_ comment; + }; + + static const build_email_class_ build_email; + + // build_warning_email + // + struct build_warning_email_class_ + { + build_warning_email_class_ () + { + } + + // value + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + value_type_; + + static const value_type_ value; + + // comment + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + comment_type_; + + static const comment_type_ comment; + }; + + static const build_warning_email_class_ build_warning_email; + + // build_error_email + // + struct build_error_email_class_ + { + build_error_email_class_ () + { + } + + // value + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + value_type_; + + static const value_type_ value; + + // comment + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + comment_type_; + + static const comment_type_ comment; + }; + + static const build_error_email_class_ build_error_email; + + // 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; + + // custom_bot + // + typedef + pgsql::query_column< + pgsql::value_traits< + bool, + pgsql::id_boolean >::query_type, + pgsql::id_boolean > + custom_bot_type_; + + static const custom_bot_type_ custom_bot; + }; + + 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 >::project_type_ + pointer_query_columns< ::brep::build_package, id_pgsql, A >:: + project (A::table_name, "\"project\"", "(?)::CITEXT"); + + template <typename A> + const typename pointer_query_columns< ::brep::build_package, id_pgsql, A >::build_email_class_::value_type_ + pointer_query_columns< ::brep::build_package, id_pgsql, A >::build_email_class_:: + value (A::table_name, "\"build_email\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::build_package, id_pgsql, A >::build_email_class_::comment_type_ + pointer_query_columns< ::brep::build_package, id_pgsql, A >::build_email_class_:: + comment (A::table_name, "\"build_email_comment\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::build_package, id_pgsql, A >::build_email_class_ + pointer_query_columns< ::brep::build_package, id_pgsql, A >::build_email; + + template <typename A> + const typename pointer_query_columns< ::brep::build_package, id_pgsql, A >::build_warning_email_class_::value_type_ + pointer_query_columns< ::brep::build_package, id_pgsql, A >::build_warning_email_class_:: + value (A::table_name, "\"build_warning_email\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::build_package, id_pgsql, A >::build_warning_email_class_::comment_type_ + pointer_query_columns< ::brep::build_package, id_pgsql, A >::build_warning_email_class_:: + comment (A::table_name, "\"build_warning_email_comment\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::build_package, id_pgsql, A >::build_warning_email_class_ + pointer_query_columns< ::brep::build_package, id_pgsql, A >::build_warning_email; + + template <typename A> + const typename pointer_query_columns< ::brep::build_package, id_pgsql, A >::build_error_email_class_::value_type_ + pointer_query_columns< ::brep::build_package, id_pgsql, A >::build_error_email_class_:: + value (A::table_name, "\"build_error_email\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::build_package, id_pgsql, A >::build_error_email_class_::comment_type_ + pointer_query_columns< ::brep::build_package, id_pgsql, A >::build_error_email_class_:: + comment (A::table_name, "\"build_error_email_comment\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::build_package, id_pgsql, A >::build_error_email_class_ + pointer_query_columns< ::brep::build_package, id_pgsql, A >::build_error_email; + + 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 <typename A> + const typename pointer_query_columns< ::brep::build_package, id_pgsql, A >::custom_bot_type_ + pointer_query_columns< ::brep::build_package, id_pgsql, A >:: + custom_bot (A::table_name, "\"custom_bot\"", 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; + + // project + // + details::buffer project_value; + std::size_t project_size; + bool project_null; + + // build_email + // + composite_value_traits< ::bpkg::email, id_pgsql >::image_type build_email_value; + + // build_warning_email + // + composite_value_traits< ::bpkg::email, id_pgsql >::image_type build_warning_email_value; + + // build_error_email + // + composite_value_traits< ::bpkg::email, id_pgsql >::image_type build_error_email_value; + + // internal_repository + // + composite_value_traits< ::brep::repository_id, id_pgsql >::image_type internal_repository_value; + + // buildable + // + bool buildable_value; + bool buildable_null; + + // custom_bot + // + bool custom_bot_value; + bool custom_bot_null; + + std::size_t version; + }; + + struct extra_statement_cache_type; + + // requirements + // + struct requirements_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_package::requirements_type 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< requirements_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&); + }; + + // requirement_alternatives + // + struct requirement_alternatives_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 = 10UL; + + static const bool versioned = false; + + static const char insert_statement[]; + static const char select_statement[]; + static const char delete_statement[]; + + typedef ::brep::requirement_alternatives_map container_type; + typedef + odb::access::container_traits<container_type> + container_traits_type; + typedef container_traits_type::key_type key_type; + typedef container_traits_type::value_type value_type; + + typedef map_functions<key_type, value_type> functions_type; + typedef pgsql::container_statements< requirement_alternatives_traits > statements_type; + + struct data_image_type + { + // key + // + composite_value_traits< key_type, id_pgsql >::image_type key_value; + + // 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&, + const key_type*, + const value_type&); + + static void + init (key_type&, + value_type&, + const data_image_type&, + database*); + + static void + insert (const key_type&, const value_type&, void*); + + static bool + select (key_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&); + }; + + // requirement_alternative_requirements + // + struct requirement_alternative_requirements_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 = 10UL; + + static const bool versioned = false; + + static const char insert_statement[]; + static const char select_statement[]; + static const char delete_statement[]; + + typedef ::brep::requirement_alternative_requirements_map container_type; + typedef + odb::access::container_traits<container_type> + container_traits_type; + typedef container_traits_type::key_type key_type; + typedef container_traits_type::value_type value_type; + + typedef map_functions<key_type, value_type> functions_type; + typedef pgsql::container_statements< requirement_alternative_requirements_traits > statements_type; + + struct data_image_type + { + // key + // + composite_value_traits< key_type, id_pgsql >::image_type key_value; + + // value + // + details::buffer value_value; + std::size_t value_size; + bool value_null; + + 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&, + const key_type*, + const value_type&); + + static void + init (key_type&, + value_type&, + const data_image_type&, + database*); + + static void + insert (const key_type&, const value_type&, void*); + + static bool + select (key_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&); + }; + + // 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 = 32UL; + + 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&); + }; + + // auxiliaries + // + struct auxiliaries_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 = 10UL; + + static const bool versioned = false; + + static const char insert_statement[]; + static const char select_statement[]; + static const char delete_statement[]; + + typedef ::brep::build_auxiliaries 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< auxiliaries_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&); + }; + + // bot_keys + // + struct bot_keys_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_package_bot_keys 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< bot_keys_traits > statements_type; + + struct data_image_type + { + // index + // + long long index_value; + bool index_null; + + // value + // + composite_value_traits< ::brep::public_key_id, 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&); + }; + + // configs + // + struct configs_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 = 16UL; + + static const bool versioned = false; + + static const char insert_statement[]; + static const char select_statement[]; + static const char delete_statement[]; + + typedef ::brep::build_package_configs 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< configs_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&); + }; + + // config_builds + // + struct config_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 = 10UL; + + 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_map container_type; + typedef + odb::access::container_traits<container_type> + container_traits_type; + typedef container_traits_type::key_type key_type; + typedef container_traits_type::value_type value_type; + + typedef map_functions<key_type, value_type> functions_type; + typedef pgsql::container_statements< config_builds_traits > statements_type; + + struct data_image_type + { + // key + // + composite_value_traits< key_type, id_pgsql >::image_type key_value; + + // 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&, + const key_type*, + const value_type&); + + static void + init (key_type&, + value_type&, + const data_image_type&, + database*); + + static void + insert (const key_type&, const value_type&, void*); + + static bool + select (key_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&); + }; + + // config_constraints + // + struct config_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 = 12UL; + + static const bool versioned = false; + + static const char insert_statement[]; + static const char select_statement[]; + static const char delete_statement[]; + + typedef ::brep::build_constraints_map container_type; + typedef + odb::access::container_traits<container_type> + container_traits_type; + typedef container_traits_type::key_type key_type; + typedef container_traits_type::value_type value_type; + + typedef map_functions<key_type, value_type> functions_type; + typedef pgsql::container_statements< config_constraints_traits > statements_type; + + struct data_image_type + { + // key + // + composite_value_traits< key_type, id_pgsql >::image_type key_value; + + // 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&, + const key_type*, + const value_type&); + + static void + init (key_type&, + value_type&, + const data_image_type&, + database*); + + static void + insert (const key_type&, const value_type&, void*); + + static bool + select (key_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&); + }; + + // config_auxiliaries + // + struct config_auxiliaries_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_auxiliaries_map container_type; + typedef + odb::access::container_traits<container_type> + container_traits_type; + typedef container_traits_type::key_type key_type; + typedef container_traits_type::value_type value_type; + + typedef map_functions<key_type, value_type> functions_type; + typedef pgsql::container_statements< config_auxiliaries_traits > statements_type; + + struct data_image_type + { + // key + // + composite_value_traits< key_type, id_pgsql >::image_type key_value; + + // 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&, + const key_type*, + const value_type&); + + static void + init (key_type&, + value_type&, + const data_image_type&, + database*); + + static void + insert (const key_type&, const value_type&, void*); + + static bool + select (key_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&); + }; + + // config_bot_keys + // + struct config_bot_keys_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 = 10UL; + + static const bool versioned = false; + + static const char insert_statement[]; + static const char select_statement[]; + static const char delete_statement[]; + + typedef ::brep::build_package_bot_keys_map container_type; + typedef + odb::access::container_traits<container_type> + container_traits_type; + typedef container_traits_type::key_type key_type; + typedef container_traits_type::value_type value_type; + + typedef map_functions<key_type, value_type> functions_type; + typedef pgsql::container_statements< config_bot_keys_traits > statements_type; + + struct data_image_type + { + // key + // + composite_value_traits< key_type, id_pgsql >::image_type key_value; + + // value + // + composite_value_traits< ::brep::public_key_id, 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&, + const key_type*, + const value_type&); + + static void + init (key_type&, + value_type&, + const data_image_type&, + database*); + + static void + insert (const key_type&, const value_type&, void*); + + static bool + select (key_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&); + }; + + // requirements_tests_section + // + struct requirements_tests_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 = 6UL; + 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&); + }; + + // constraints_section + // + struct constraints_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 = 6UL; + 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&); + }; + + // auxiliaries_section + // + struct auxiliaries_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 = 6UL; + 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&); + }; + + // bot_keys_section + // + struct bot_keys_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 = 6UL; + 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&); + }; + + 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 = 19UL; + 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 = 13UL; + 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 bool + load (connection&, object_type&, 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 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 std::size_t batch = 1UL; + + 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 > + { + }; + + // build_package_version + // + template <> + class access::view_traits_impl< ::brep::build_package_version, id_pgsql >: + public access::view_traits< ::brep::build_package_version > + { + 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; + + 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 = 8UL; + + 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::build_package_version, id_common >: + public access::view_traits_impl< ::brep::build_package_version, 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 + { + // package + // + object_traits_impl< ::brep::build_package, id_pgsql >::image_type package_value; + + // archived + // + bool archived_value; + bool archived_null; + + // interactive + // + details::buffer interactive_value; + std::size_t interactive_size; + bool interactive_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 = 21UL; + + 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_public_key + // + // 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; + + // project + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::bpkg::package_name, + pgsql::id_string >::query_type, + pgsql::id_string > + project_type_; + + static const project_type_ project; + + // build_email + // + struct build_email_class_ + { + build_email_class_ () + { + } + + // value + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + value_type_; + + static const value_type_ value; + + // comment + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + comment_type_; + + static const comment_type_ comment; + }; + + static const build_email_class_ build_email; + + // build_warning_email + // + struct build_warning_email_class_ + { + build_warning_email_class_ () + { + } + + // value + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + value_type_; + + static const value_type_ value; + + // comment + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + comment_type_; + + static const comment_type_ comment; + }; + + static const build_warning_email_class_ build_warning_email; + + // build_error_email + // + struct build_error_email_class_ + { + build_error_email_class_ () + { + } + + // value + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + value_type_; + + static const value_type_ value; + + // comment + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + comment_type_; + + static const comment_type_ comment; + }; + + static const build_error_email_class_ build_error_email; + + // 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; + + // custom_bot + // + typedef + pgsql::query_column< + pgsql::value_traits< + bool, + pgsql::id_boolean >::query_type, + pgsql::id_boolean > + custom_bot_type_; + + static const custom_bot_type_ custom_bot; + }; + + 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 >::project_type_ + query_columns< ::brep::build_package, id_pgsql, A >:: + project (A::table_name, "\"project\"", "(?)::CITEXT"); + + template <typename A> + const typename query_columns< ::brep::build_package, id_pgsql, A >::build_email_class_::value_type_ + query_columns< ::brep::build_package, id_pgsql, A >::build_email_class_:: + value (A::table_name, "\"build_email\"", 0); + + template <typename A> + const typename query_columns< ::brep::build_package, id_pgsql, A >::build_email_class_::comment_type_ + query_columns< ::brep::build_package, id_pgsql, A >::build_email_class_:: + comment (A::table_name, "\"build_email_comment\"", 0); + + template <typename A> + const typename query_columns< ::brep::build_package, id_pgsql, A >::build_email_class_ + query_columns< ::brep::build_package, id_pgsql, A >::build_email; + + template <typename A> + const typename query_columns< ::brep::build_package, id_pgsql, A >::build_warning_email_class_::value_type_ + query_columns< ::brep::build_package, id_pgsql, A >::build_warning_email_class_:: + value (A::table_name, "\"build_warning_email\"", 0); + + template <typename A> + const typename query_columns< ::brep::build_package, id_pgsql, A >::build_warning_email_class_::comment_type_ + query_columns< ::brep::build_package, id_pgsql, A >::build_warning_email_class_:: + comment (A::table_name, "\"build_warning_email_comment\"", 0); + + template <typename A> + const typename query_columns< ::brep::build_package, id_pgsql, A >::build_warning_email_class_ + query_columns< ::brep::build_package, id_pgsql, A >::build_warning_email; + + template <typename A> + const typename query_columns< ::brep::build_package, id_pgsql, A >::build_error_email_class_::value_type_ + query_columns< ::brep::build_package, id_pgsql, A >::build_error_email_class_:: + value (A::table_name, "\"build_error_email\"", 0); + + template <typename A> + const typename query_columns< ::brep::build_package, id_pgsql, A >::build_error_email_class_::comment_type_ + query_columns< ::brep::build_package, id_pgsql, A >::build_error_email_class_:: + comment (A::table_name, "\"build_error_email_comment\"", 0); + + template <typename A> + const typename query_columns< ::brep::build_package, id_pgsql, A >::build_error_email_class_ + query_columns< ::brep::build_package, id_pgsql, A >::build_error_email; + + 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); + + template <typename A> + const typename query_columns< ::brep::build_package, id_pgsql, A >::custom_bot_type_ + query_columns< ::brep::build_package, id_pgsql, A >:: + custom_bot (A::table_name, "\"custom_bot\"", 0); + + // build_package_version + // + struct access::view_traits_impl< ::brep::build_package_version, id_pgsql >::query_columns: + odb::pointer_query_columns< + ::brep::build_package, + id_pgsql, + odb::access::object_traits_impl< ::brep::build_package, id_pgsql > > + { + }; + + // 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..de5df94 --- /dev/null +++ b/libbrep/build-package-odb.ixx @@ -0,0 +1,371 @@ +// -*- 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_public_key + // + + inline + access::object_traits< ::brep::build_public_key >::id_type + access::object_traits< ::brep::build_public_key >:: + id (const object_type& o) + { + return o.id; + } + + inline + void access::object_traits< ::brep::build_public_key >:: + 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_public_key >:: + 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); + } + + // build_package_version + // + + inline + void access::view_traits< ::brep::build_package_version >:: + callback (database& db, view_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_public_key + // + + inline + void access::object_traits_impl< ::brep::build_public_key, 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_public_key, id_pgsql >:: + load_ (statements_type& sts, + object_type& obj, + bool) + { + ODB_POTENTIALLY_UNUSED (sts); + ODB_POTENTIALLY_UNUSED (obj); + } + + // build_package_config + // + + inline + bool access::composite_value_traits< ::brep::build_package_config, id_pgsql >:: + get_null (const image_type& i) + { + bool r (true); + r = r && i.name_null; + r = r && i.arguments_null; + r = r && i.comment_null; + r = r && composite_value_traits< ::bpkg::email, id_pgsql >::get_null (i.email_value); + r = r && composite_value_traits< ::bpkg::email, id_pgsql >::get_null (i.warning_email_value); + r = r && composite_value_traits< ::bpkg::email, id_pgsql >::get_null (i.error_email_value); + return r; + } + + inline + void access::composite_value_traits< ::brep::build_package_config, id_pgsql >:: + set_null (image_type& i, + pgsql::statement_kind sk) + { + ODB_POTENTIALLY_UNUSED (sk); + + using namespace pgsql; + + i.name_null = true; + i.arguments_null = true; + i.comment_null = true; + composite_value_traits< ::bpkg::email, id_pgsql >::set_null (i.email_value, sk); + composite_value_traits< ::bpkg::email, id_pgsql >::set_null (i.warning_email_value, sk); + composite_value_traits< ::bpkg::email, id_pgsql >::set_null (i.error_email_value, sk); + } + + // build_package_bot_key_key + // + + inline + bool access::composite_value_traits< ::brep::build_package_bot_key_key, id_pgsql >:: + get_null (const image_type& i) + { + bool r (true); + r = r && i.outer_null; + r = r && i.inner_null; + return r; + } + + inline + void access::composite_value_traits< ::brep::build_package_bot_key_key, id_pgsql >:: + set_null (image_type& i, + pgsql::statement_kind sk) + { + ODB_POTENTIALLY_UNUSED (sk); + + using namespace pgsql; + + i.outer_null = true; + i.inner_null = true; + } + + // build_dependency + // + + inline + bool access::composite_value_traits< ::brep::build_dependency, id_pgsql >:: + get_null (const image_type& i) + { + bool r (true); + r = r && i.name_null; + r = r && composite_value_traits< ::bpkg::version_constraint, id_pgsql >::get_null (i.constraint_value); + 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_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< ::bpkg::version_constraint, id_pgsql >::set_null (i.constraint_value, sk); + composite_value_traits< ::brep::package_id, id_pgsql >::set_null (i.package_value, sk); + } + + // 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 && composite_value_traits< ::brep::build_dependency, id_pgsql >::get_null (i); + r = r && i.type_null; + r = r && i.buildtime_null; + r = r && i.enable_null; + r = r && i.reflect_null; + 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; + + composite_value_traits< ::brep::build_dependency, id_pgsql >::set_null (i, sk); + i.type_null = true; + i.buildtime_null = true; + i.enable_null = true; + i.reflect_null = true; + } + + // 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); + } + + // build_package_version + // + + // buildable_package + // + + // buildable_package_count + // +} + diff --git a/libbrep/build.sql b/libbrep/build.sql new file mode 100644 index 0000000..0b93e83 --- /dev/null +++ b/libbrep/build.sql @@ -0,0 +1,252 @@ +/* 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_auxiliary_machines" 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, + "target" TEXT NOT NULL, + "target_config_name" TEXT NOT NULL, + "package_config_name" 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, + "interactive" TEXT NULL, + "timestamp" BIGINT NOT NULL, + "force" TEXT NOT NULL, + "status" TEXT NULL, + "soft_timestamp" BIGINT NOT NULL, + "hard_timestamp" BIGINT NOT NULL, + "agent_fingerprint" TEXT NULL, + "agent_challenge" TEXT NULL, + "controller_checksum" TEXT NOT NULL, + "machine_checksum" TEXT NOT NULL, + "agent_checksum" TEXT NULL, + "worker_checksum" TEXT NULL, + "dependency_checksum" TEXT NULL, + "machine" TEXT NOT NULL, + "machine_summary" TEXT NOT NULL, + PRIMARY KEY ("package_tenant", + "package_name", + "package_version_epoch", + "package_version_canonical_upstream", + "package_version_canonical_release", + "package_version_revision", + "target", + "target_config_name", + "package_config_name", + "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_auxiliary_machines" ( + "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, + "target" TEXT NOT NULL, + "target_config_name" TEXT NOT NULL, + "package_config_name" 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, + "name" TEXT NOT NULL, + "summary" 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", + "target", + "target_config_name", + "package_config_name", + "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", + "target", + "target_config_name", + "package_config_name", + "toolchain_name", + "toolchain_version_epoch", + "toolchain_version_canonical_upstream", + "toolchain_version_canonical_release", + "toolchain_version_revision") + ON DELETE CASCADE); + +CREATE INDEX "build_auxiliary_machines_object_id_i" + ON "build_auxiliary_machines" ( + "package_tenant", + "package_name", + "package_version_epoch", + "package_version_canonical_upstream", + "package_version_canonical_release", + "package_version_revision", + "target", + "target_config_name", + "package_config_name", + "toolchain_name", + "toolchain_version_epoch", + "toolchain_version_canonical_upstream", + "toolchain_version_canonical_release", + "toolchain_version_revision"); + +CREATE INDEX "build_auxiliary_machines_index_i" + ON "build_auxiliary_machines" ("index"); + +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, + "target" TEXT NOT NULL, + "target_config_name" TEXT NOT NULL, + "package_config_name" 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", + "target", + "target_config_name", + "package_config_name", + "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", + "target", + "target_config_name", + "package_config_name", + "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", + "target", + "target_config_name", + "package_config_name", + "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, + "target" TEXT NOT NULL, + "target_config_name" TEXT NOT NULL, + "package_config_name" 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_soft_timestamp" BIGINT NOT NULL, + "report_hard_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", + "target", + "target_config_name", + "package_config_name", + "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', 28, FALSE); + diff --git a/libbrep/common-odb.cxx b/libbrep/common-odb.cxx new file mode 100644 index 0000000..5409043 --- /dev/null +++ b/libbrep/common-odb.cxx @@ -0,0 +1,3946 @@ +// -*- 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_ptr (); + 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_ptr (); + 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_ptr (); + 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_ptr (); + 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); + } + } + + // 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_ptr (); + 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_ptr (); + 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 common.hxx:384: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 common.hxx:384: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:79: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:79: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:79: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:79: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_alternative + // + + bool access::composite_value_traits< ::bpkg::requirement_alternative, id_pgsql >:: + grow (image_type& i, + bool* t) + { + ODB_POTENTIALLY_UNUSED (i); + ODB_POTENTIALLY_UNUSED (t); + + bool grew (false); + + // enable + // + if (t[0UL]) + { + i.enable_value.capacity (i.enable_size); + grew = true; + } + + // reflect + // + if (t[1UL]) + { + i.reflect_value.capacity (i.reflect_size); + grew = true; + } + + return grew; + } + + void access::composite_value_traits< ::bpkg::requirement_alternative, 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); + + // enable + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.enable_value.data_ptr (); + b[n].capacity = i.enable_value.capacity (); + b[n].size = &i.enable_size; + b[n].is_null = &i.enable_null; + n++; + + // reflect + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.reflect_value.data_ptr (); + b[n].capacity = i.reflect_value.capacity (); + b[n].size = &i.reflect_size; + b[n].is_null = &i.reflect_null; + n++; + } + + bool access::composite_value_traits< ::bpkg::requirement_alternative, 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); + + // enable + // + { + ::butl::optional< ::std::basic_string< char > > const& v = + o.enable; + + bool is_null (true); + std::size_t size (0); + std::size_t cap (i.enable_value.capacity ()); + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_image ( + i.enable_value, + size, + is_null, + v); + i.enable_null = is_null; + i.enable_size = size; + grew = grew || (cap != i.enable_value.capacity ()); + } + + // reflect + // + { + ::butl::optional< ::std::basic_string< char > > const& v = + o.reflect; + + bool is_null (true); + std::size_t size (0); + std::size_t cap (i.reflect_value.capacity ()); + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_image ( + i.reflect_value, + size, + is_null, + v); + i.reflect_null = is_null; + i.reflect_size = size; + grew = grew || (cap != i.reflect_value.capacity ()); + } + + return grew; + } + + void access::composite_value_traits< ::bpkg::requirement_alternative, id_pgsql >:: + init (value_type& o, + const image_type& i, + database* db) + { + ODB_POTENTIALLY_UNUSED (o); + ODB_POTENTIALLY_UNUSED (i); + ODB_POTENTIALLY_UNUSED (db); + + // enable + // + { + ::butl::optional< ::std::basic_string< char > >& v = + o.enable; + + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_value ( + v, + i.enable_value, + i.enable_size, + i.enable_null); + } + + // reflect + // + { + ::butl::optional< ::std::basic_string< char > >& v = + o.reflect; + + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_value ( + v, + i.reflect_value, + i.reflect_size, + i.reflect_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); + + // buildtime + // + t[0UL] = 0; + + // comment + // + if (t[1UL]) + { + 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); + + // 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_ptr (); + 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); + + // 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); + + // 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); + } + } + + // 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_ptr (); + 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_ptr (); + 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_ptr (); + 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_ptr (); + 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_ptr (); + 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:353: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:354: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:354: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); + } + } + + // build_auxiliary + // + + bool access::composite_value_traits< ::bpkg::build_auxiliary, id_pgsql >:: + grow (image_type& i, + bool* t) + { + ODB_POTENTIALLY_UNUSED (i); + ODB_POTENTIALLY_UNUSED (t); + + bool grew (false); + + // environment_name + // + if (t[0UL]) + { + i.environment_name_value.capacity (i.environment_name_size); + grew = true; + } + + // config + // + if (t[1UL]) + { + i.config_value.capacity (i.config_size); + grew = true; + } + + // comment + // + if (t[2UL]) + { + i.comment_value.capacity (i.comment_size); + grew = true; + } + + return grew; + } + + void access::composite_value_traits< ::bpkg::build_auxiliary, 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); + + // environment_name + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.environment_name_value.data_ptr (); + b[n].capacity = i.environment_name_value.capacity (); + b[n].size = &i.environment_name_size; + b[n].is_null = &i.environment_name_null; + n++; + + // config + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.config_value.data_ptr (); + b[n].capacity = i.config_value.capacity (); + b[n].size = &i.config_size; + b[n].is_null = &i.config_null; + n++; + + // comment + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.comment_value.data_ptr (); + 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_auxiliary, 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); + + // environment_name + // + { + ::std::string const& v = + o.environment_name; + + bool is_null (false); + std::size_t size (0); + std::size_t cap (i.environment_name_value.capacity ()); + pgsql::value_traits< + ::std::string, + pgsql::id_string >::set_image ( + i.environment_name_value, + size, + is_null, + v); + i.environment_name_null = is_null; + i.environment_name_size = size; + grew = grew || (cap != i.environment_name_value.capacity ()); + } + + // 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 ()); + } + + // 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_auxiliary, id_pgsql >:: + init (value_type& o, + const image_type& i, + database* db) + { + ODB_POTENTIALLY_UNUSED (o); + ODB_POTENTIALLY_UNUSED (i); + ODB_POTENTIALLY_UNUSED (db); + + // environment_name + // + { + ::std::string& v = + o.environment_name; + + pgsql::value_traits< + ::std::string, + pgsql::id_string >::set_value ( + v, + i.environment_name_value, + i.environment_name_size, + i.environment_name_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); + } + + // 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_ptr (); + 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_ptr (); + 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_ptr (); + 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_ptr (); + 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:211: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:216: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:212: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:212:7 + o = brep::version (0, std::move (v), std::string (), brep::nullopt, 0); + } + + // release_ + // + { + // From common.hxx:217: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:217: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_ptr (); + 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_ptr (); + 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_ptr (); + 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_ptr (); + 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:292: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:284: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:292: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:284: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_ptr (); + 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_ptr (); + 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); + } + } + + // public_key_id + // + + bool access::composite_value_traits< ::brep::public_key_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; + } + + // fingerprint + // + if (t[1UL]) + { + i.fingerprint_value.capacity (i.fingerprint_size); + grew = true; + } + + return grew; + } + + void access::composite_value_traits< ::brep::public_key_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_ptr (); + b[n].capacity = i.tenant_value.capacity (); + b[n].size = &i.tenant_size; + b[n].is_null = &i.tenant_null; + n++; + + // fingerprint + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.fingerprint_value.data_ptr (); + b[n].capacity = i.fingerprint_value.capacity (); + b[n].size = &i.fingerprint_size; + b[n].is_null = &i.fingerprint_null; + n++; + } + + bool access::composite_value_traits< ::brep::public_key_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 ()); + } + + // 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 ()); + } + + return grew; + } + + void access::composite_value_traits< ::brep::public_key_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); + } + + // 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); + } + } + + // build_toolchain + // + + bool access::composite_value_traits< ::brep::build_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; + } + + // version + // + if (composite_value_traits< ::brep::_version, id_pgsql >::grow ( + i.version_value, t + 1UL)) + grew = true; + + return grew; + } + + void access::composite_value_traits< ::brep::build_toolchain, 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_ptr (); + 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::_version, id_pgsql >::bind ( + b + n, i.version_value, sk); + n += 6UL; + } + + bool access::composite_value_traits< ::brep::build_toolchain, 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 + // + { + ::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 ()); + } + + // version + // + { + ::bpkg::version const& v = + o.version; + + // From common.hxx:66:12 + ::brep::_version const& vt = + brep::_version + { + (v).epoch, (v).canonical_upstream, (v).canonical_release, (v).revision, (v).upstream, (v).release + }; + + + if (composite_value_traits< ::brep::_version, id_pgsql >::init ( + i.version_value, + vt, + sk)) + grew = true; + } + + return grew; + } + + void access::composite_value_traits< ::brep::build_toolchain, 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 + // + { + ::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); + } + + // version + // + { + ::bpkg::version& v = + o.version; + + ::brep::_version vt; + + composite_value_traits< ::brep::_version, id_pgsql >::init ( + vt, + i.version_value, + db); + + // From common.hxx:66:12 + v = bpkg::version ((vt).epoch, std::move ((vt).upstream), std::move ((vt).release), (vt).revision, 0); + } + } + + // build_class_expr_key + // + + bool access::composite_value_traits< ::brep::build_class_expr_key, id_pgsql >:: + grow (image_type& i, + bool* t) + { + ODB_POTENTIALLY_UNUSED (i); + ODB_POTENTIALLY_UNUSED (t); + + bool grew (false); + + // outer + // + t[0UL] = 0; + + // inner + // + t[1UL] = 0; + + return grew; + } + + void access::composite_value_traits< ::brep::build_class_expr_key, 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); + + // outer + // + b[n].type = pgsql::bind::bigint; + b[n].buffer = &i.outer_value; + b[n].is_null = &i.outer_null; + n++; + + // inner + // + b[n].type = pgsql::bind::bigint; + b[n].buffer = &i.inner_value; + b[n].is_null = &i.inner_null; + n++; + } + + bool access::composite_value_traits< ::brep::build_class_expr_key, 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); + + // outer + // + { + ::brep::build_class_expr_key::outer_type const& v = + o.outer; + + bool is_null (false); + pgsql::value_traits< + ::brep::build_class_expr_key::outer_type, + pgsql::id_bigint >::set_image ( + i.outer_value, is_null, v); + i.outer_null = is_null; + } + + // inner + // + { + ::brep::build_class_expr_key::inner_type const& v = + o.inner; + + bool is_null (false); + pgsql::value_traits< + ::brep::build_class_expr_key::inner_type, + pgsql::id_bigint >::set_image ( + i.inner_value, is_null, v); + i.inner_null = is_null; + } + + return grew; + } + + void access::composite_value_traits< ::brep::build_class_expr_key, id_pgsql >:: + init (value_type& o, + const image_type& i, + database* db) + { + ODB_POTENTIALLY_UNUSED (o); + ODB_POTENTIALLY_UNUSED (i); + ODB_POTENTIALLY_UNUSED (db); + + // outer + // + { + ::brep::build_class_expr_key::outer_type& v = + o.outer; + + pgsql::value_traits< + ::brep::build_class_expr_key::outer_type, + pgsql::id_bigint >::set_value ( + v, + i.outer_value, + i.outer_null); + } + + // inner + // + { + ::brep::build_class_expr_key::inner_type& v = + o.inner; + + pgsql::value_traits< + ::brep::build_class_expr_key::inner_type, + pgsql::id_bigint >::set_value ( + v, + i.inner_value, + i.inner_null); + } + } + + // build_constraint_key + // + + bool access::composite_value_traits< ::brep::build_constraint_key, id_pgsql >:: + grow (image_type& i, + bool* t) + { + ODB_POTENTIALLY_UNUSED (i); + ODB_POTENTIALLY_UNUSED (t); + + bool grew (false); + + // outer + // + t[0UL] = 0; + + // inner + // + t[1UL] = 0; + + return grew; + } + + void access::composite_value_traits< ::brep::build_constraint_key, 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); + + // outer + // + b[n].type = pgsql::bind::bigint; + b[n].buffer = &i.outer_value; + b[n].is_null = &i.outer_null; + n++; + + // inner + // + b[n].type = pgsql::bind::bigint; + b[n].buffer = &i.inner_value; + b[n].is_null = &i.inner_null; + n++; + } + + bool access::composite_value_traits< ::brep::build_constraint_key, 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); + + // outer + // + { + ::brep::build_constraint_key::outer_type const& v = + o.outer; + + bool is_null (false); + pgsql::value_traits< + ::brep::build_constraint_key::outer_type, + pgsql::id_bigint >::set_image ( + i.outer_value, is_null, v); + i.outer_null = is_null; + } + + // inner + // + { + ::brep::build_constraint_key::inner_type const& v = + o.inner; + + bool is_null (false); + pgsql::value_traits< + ::brep::build_constraint_key::inner_type, + pgsql::id_bigint >::set_image ( + i.inner_value, is_null, v); + i.inner_null = is_null; + } + + return grew; + } + + void access::composite_value_traits< ::brep::build_constraint_key, id_pgsql >:: + init (value_type& o, + const image_type& i, + database* db) + { + ODB_POTENTIALLY_UNUSED (o); + ODB_POTENTIALLY_UNUSED (i); + ODB_POTENTIALLY_UNUSED (db); + + // outer + // + { + ::brep::build_constraint_key::outer_type& v = + o.outer; + + pgsql::value_traits< + ::brep::build_constraint_key::outer_type, + pgsql::id_bigint >::set_value ( + v, + i.outer_value, + i.outer_null); + } + + // inner + // + { + ::brep::build_constraint_key::inner_type& v = + o.inner; + + pgsql::value_traits< + ::brep::build_constraint_key::inner_type, + pgsql::id_bigint >::set_value ( + v, + i.inner_value, + i.inner_null); + } + } + + // build_auxiliary_key + // + + bool access::composite_value_traits< ::brep::build_auxiliary_key, id_pgsql >:: + grow (image_type& i, + bool* t) + { + ODB_POTENTIALLY_UNUSED (i); + ODB_POTENTIALLY_UNUSED (t); + + bool grew (false); + + // outer + // + t[0UL] = 0; + + // inner + // + t[1UL] = 0; + + return grew; + } + + void access::composite_value_traits< ::brep::build_auxiliary_key, 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); + + // outer + // + b[n].type = pgsql::bind::bigint; + b[n].buffer = &i.outer_value; + b[n].is_null = &i.outer_null; + n++; + + // inner + // + b[n].type = pgsql::bind::bigint; + b[n].buffer = &i.inner_value; + b[n].is_null = &i.inner_null; + n++; + } + + bool access::composite_value_traits< ::brep::build_auxiliary_key, 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); + + // outer + // + { + ::brep::build_auxiliary_key::outer_type const& v = + o.outer; + + bool is_null (false); + pgsql::value_traits< + ::brep::build_auxiliary_key::outer_type, + pgsql::id_bigint >::set_image ( + i.outer_value, is_null, v); + i.outer_null = is_null; + } + + // inner + // + { + ::brep::build_auxiliary_key::inner_type const& v = + o.inner; + + bool is_null (false); + pgsql::value_traits< + ::brep::build_auxiliary_key::inner_type, + pgsql::id_bigint >::set_image ( + i.inner_value, is_null, v); + i.inner_null = is_null; + } + + return grew; + } + + void access::composite_value_traits< ::brep::build_auxiliary_key, id_pgsql >:: + init (value_type& o, + const image_type& i, + database* db) + { + ODB_POTENTIALLY_UNUSED (o); + ODB_POTENTIALLY_UNUSED (i); + ODB_POTENTIALLY_UNUSED (db); + + // outer + // + { + ::brep::build_auxiliary_key::outer_type& v = + o.outer; + + pgsql::value_traits< + ::brep::build_auxiliary_key::outer_type, + pgsql::id_bigint >::set_value ( + v, + i.outer_value, + i.outer_null); + } + + // inner + // + { + ::brep::build_auxiliary_key::inner_type& v = + o.inner; + + pgsql::value_traits< + ::brep::build_auxiliary_key::inner_type, + pgsql::id_bigint >::set_value ( + v, + i.inner_value, + i.inner_null); + } + } + + // requirement_alternative_key + // + + bool access::composite_value_traits< ::brep::requirement_alternative_key, id_pgsql >:: + grow (image_type& i, + bool* t) + { + ODB_POTENTIALLY_UNUSED (i); + ODB_POTENTIALLY_UNUSED (t); + + bool grew (false); + + // outer + // + t[0UL] = 0; + + // inner + // + t[1UL] = 0; + + return grew; + } + + void access::composite_value_traits< ::brep::requirement_alternative_key, 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); + + // outer + // + b[n].type = pgsql::bind::bigint; + b[n].buffer = &i.outer_value; + b[n].is_null = &i.outer_null; + n++; + + // inner + // + b[n].type = pgsql::bind::bigint; + b[n].buffer = &i.inner_value; + b[n].is_null = &i.inner_null; + n++; + } + + bool access::composite_value_traits< ::brep::requirement_alternative_key, 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); + + // outer + // + { + ::brep::requirement_alternative_key::outer_type const& v = + o.outer; + + bool is_null (false); + pgsql::value_traits< + ::brep::requirement_alternative_key::outer_type, + pgsql::id_bigint >::set_image ( + i.outer_value, is_null, v); + i.outer_null = is_null; + } + + // inner + // + { + ::brep::requirement_alternative_key::inner_type const& v = + o.inner; + + bool is_null (false); + pgsql::value_traits< + ::brep::requirement_alternative_key::inner_type, + pgsql::id_bigint >::set_image ( + i.inner_value, is_null, v); + i.inner_null = is_null; + } + + return grew; + } + + void access::composite_value_traits< ::brep::requirement_alternative_key, id_pgsql >:: + init (value_type& o, + const image_type& i, + database* db) + { + ODB_POTENTIALLY_UNUSED (o); + ODB_POTENTIALLY_UNUSED (i); + ODB_POTENTIALLY_UNUSED (db); + + // outer + // + { + ::brep::requirement_alternative_key::outer_type& v = + o.outer; + + pgsql::value_traits< + ::brep::requirement_alternative_key::outer_type, + pgsql::id_bigint >::set_value ( + v, + i.outer_value, + i.outer_null); + } + + // inner + // + { + ::brep::requirement_alternative_key::inner_type& v = + o.inner; + + pgsql::value_traits< + ::brep::requirement_alternative_key::inner_type, + pgsql::id_bigint >::set_value ( + v, + i.inner_value, + i.inner_null); + } + } + + // requirement_key + // + + bool access::composite_value_traits< ::brep::requirement_key, id_pgsql >:: + grow (image_type& i, + bool* t) + { + ODB_POTENTIALLY_UNUSED (i); + ODB_POTENTIALLY_UNUSED (t); + + bool grew (false); + + // outer + // + t[0UL] = 0; + + // middle + // + t[1UL] = 0; + + // inner + // + t[2UL] = 0; + + return grew; + } + + void access::composite_value_traits< ::brep::requirement_key, 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); + + // outer + // + b[n].type = pgsql::bind::bigint; + b[n].buffer = &i.outer_value; + b[n].is_null = &i.outer_null; + n++; + + // middle + // + b[n].type = pgsql::bind::bigint; + b[n].buffer = &i.middle_value; + b[n].is_null = &i.middle_null; + n++; + + // inner + // + b[n].type = pgsql::bind::bigint; + b[n].buffer = &i.inner_value; + b[n].is_null = &i.inner_null; + n++; + } + + bool access::composite_value_traits< ::brep::requirement_key, 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); + + // outer + // + { + ::brep::requirement_key::outer_type const& v = + o.outer; + + bool is_null (false); + pgsql::value_traits< + ::brep::requirement_key::outer_type, + pgsql::id_bigint >::set_image ( + i.outer_value, is_null, v); + i.outer_null = is_null; + } + + // middle + // + { + ::brep::requirement_key::middle_type const& v = + o.middle; + + bool is_null (false); + pgsql::value_traits< + ::brep::requirement_key::middle_type, + pgsql::id_bigint >::set_image ( + i.middle_value, is_null, v); + i.middle_null = is_null; + } + + // inner + // + { + ::brep::requirement_key::inner_type const& v = + o.inner; + + bool is_null (false); + pgsql::value_traits< + ::brep::requirement_key::inner_type, + pgsql::id_bigint >::set_image ( + i.inner_value, is_null, v); + i.inner_null = is_null; + } + + return grew; + } + + void access::composite_value_traits< ::brep::requirement_key, id_pgsql >:: + init (value_type& o, + const image_type& i, + database* db) + { + ODB_POTENTIALLY_UNUSED (o); + ODB_POTENTIALLY_UNUSED (i); + ODB_POTENTIALLY_UNUSED (db); + + // outer + // + { + ::brep::requirement_key::outer_type& v = + o.outer; + + pgsql::value_traits< + ::brep::requirement_key::outer_type, + pgsql::id_bigint >::set_value ( + v, + i.outer_value, + i.outer_null); + } + + // middle + // + { + ::brep::requirement_key::middle_type& v = + o.middle; + + pgsql::value_traits< + ::brep::requirement_key::middle_type, + pgsql::id_bigint >::set_value ( + v, + i.middle_value, + i.middle_null); + } + + // inner + // + { + ::brep::requirement_key::inner_type& v = + o.inner; + + pgsql::value_traits< + ::brep::requirement_key::inner_type, + pgsql::id_bigint >::set_value ( + v, + i.inner_value, + i.inner_null); + } + } + + // tenant_service + // + + bool access::composite_value_traits< ::brep::tenant_service, 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; + } + + // type + // + if (t[1UL]) + { + i.type_value.capacity (i.type_size); + grew = true; + } + + // data + // + if (t[2UL]) + { + i.data_value.capacity (i.data_size); + grew = true; + } + + return grew; + } + + void access::composite_value_traits< ::brep::tenant_service, 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); + + // id + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.id_value.data_ptr (); + b[n].capacity = i.id_value.capacity (); + b[n].size = &i.id_size; + b[n].is_null = &i.id_null; + n++; + + // type + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.type_value.data_ptr (); + b[n].capacity = i.type_value.capacity (); + b[n].size = &i.type_size; + b[n].is_null = &i.type_null; + n++; + + // data + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.data_value.data_ptr (); + b[n].capacity = i.data_value.capacity (); + b[n].size = &i.data_size; + b[n].is_null = &i.data_null; + n++; + } + + bool access::composite_value_traits< ::brep::tenant_service, 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); + + // 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 ()); + } + + // type + // + { + ::std::string const& v = + o.type; + + 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, + v); + i.type_null = is_null; + i.type_size = size; + grew = grew || (cap != i.type_value.capacity ()); + } + + // data + // + { + ::butl::optional< ::std::basic_string< char > > const& v = + o.data; + + bool is_null (true); + std::size_t size (0); + std::size_t cap (i.data_value.capacity ()); + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_image ( + i.data_value, + size, + is_null, + v); + i.data_null = is_null; + i.data_size = size; + grew = grew || (cap != i.data_value.capacity ()); + } + + return grew; + } + + void access::composite_value_traits< ::brep::tenant_service, id_pgsql >:: + init (value_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); + } + + // type + // + { + ::std::string& v = + o.type; + + pgsql::value_traits< + ::std::string, + pgsql::id_string >::set_value ( + v, + i.type_value, + i.type_size, + i.type_null); + } + + // data + // + { + ::butl::optional< ::std::basic_string< char > >& v = + o.data; + + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_value ( + v, + i.data_value, + i.data_size, + i.data_null); + } + } +} + +#include <odb/post.hxx> diff --git a/libbrep/common-odb.hxx b/libbrep/common-odb.hxx new file mode 100644 index 0000000..177f731 --- /dev/null +++ b/libbrep/common-odb.hxx @@ -0,0 +1,1212 @@ +// -*- 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 != 20476UL +#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; + }; + + // email + // + template <> + class access::composite_value_traits< ::bpkg::email, id_pgsql > + { + public: + typedef ::bpkg::email value_type; + + struct image_type + { + // value + // + details::buffer value_value; + std::size_t value_size; + bool value_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; + }; + + // version_constraint + // + template <> + class access::composite_value_traits< ::bpkg::version_constraint, id_pgsql > + { + public: + typedef ::bpkg::version_constraint value_type; + + struct image_type + { + // min_version + // + composite_value_traits< ::brep::_version, id_pgsql >::image_type min_version_value; + + // max_version + // + composite_value_traits< ::brep::_version, id_pgsql >::image_type max_version_value; + + // min_open + // + bool min_open_value; + bool min_open_null; + + // max_open + // + bool max_open_value; + bool max_open_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 = 14UL; + }; + + // requirement_alternative + // + template <> + class access::composite_value_traits< ::bpkg::requirement_alternative, id_pgsql > + { + public: + typedef ::bpkg::requirement_alternative value_type; + + struct image_type + { + // enable + // + details::buffer enable_value; + std::size_t enable_size; + bool enable_null; + + // reflect + // + details::buffer reflect_value; + std::size_t reflect_size; + bool reflect_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; + }; + + // requirement_alternatives + // + template <> + class access::composite_value_traits< ::bpkg::requirement_alternatives, id_pgsql > + { + public: + typedef ::bpkg::requirement_alternatives value_type; + + struct image_type + { + // buildtime + // + bool buildtime_value; + bool buildtime_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; + }; + + // 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; + }; + + // build_auxiliary + // + template <> + class access::composite_value_traits< ::bpkg::build_auxiliary, id_pgsql > + { + public: + typedef ::bpkg::build_auxiliary value_type; + + struct image_type + { + // environment_name + // + details::buffer environment_name_value; + std::size_t environment_name_size; + bool environment_name_null; + + // config + // + details::buffer config_value; + std::size_t config_size; + bool config_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 = 3UL; + }; + + // 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; + }; + + // public_key_id + // + template <> + class access::composite_value_traits< ::brep::public_key_id, id_pgsql > + { + public: + typedef ::brep::public_key_id value_type; + + struct image_type + { + // tenant + // + details::buffer tenant_value; + std::size_t tenant_size; + bool tenant_null; + + // fingerprint + // + details::buffer fingerprint_value; + std::size_t fingerprint_size; + bool fingerprint_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; + }; + + // build_toolchain + // + template <> + class access::composite_value_traits< ::brep::build_toolchain, id_pgsql > + { + public: + typedef ::brep::build_toolchain value_type; + + struct image_type + { + // name + // + details::buffer name_value; + std::size_t name_size; + bool name_null; + + // version + // + composite_value_traits< ::brep::_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 = 7UL; + }; + + // build_class_expr_key + // + template <> + class access::composite_value_traits< ::brep::build_class_expr_key, id_pgsql > + { + public: + typedef ::brep::build_class_expr_key value_type; + + struct image_type + { + // outer + // + long long outer_value; + bool outer_null; + + // inner + // + long long inner_value; + bool inner_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; + }; + + // build_constraint_key + // + template <> + class access::composite_value_traits< ::brep::build_constraint_key, id_pgsql > + { + public: + typedef ::brep::build_constraint_key value_type; + + struct image_type + { + // outer + // + long long outer_value; + bool outer_null; + + // inner + // + long long inner_value; + bool inner_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; + }; + + // build_auxiliary_key + // + template <> + class access::composite_value_traits< ::brep::build_auxiliary_key, id_pgsql > + { + public: + typedef ::brep::build_auxiliary_key value_type; + + struct image_type + { + // outer + // + long long outer_value; + bool outer_null; + + // inner + // + long long inner_value; + bool inner_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; + }; + + // requirement_alternative_key + // + template <> + class access::composite_value_traits< ::brep::requirement_alternative_key, id_pgsql > + { + public: + typedef ::brep::requirement_alternative_key value_type; + + struct image_type + { + // outer + // + long long outer_value; + bool outer_null; + + // inner + // + long long inner_value; + bool inner_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; + }; + + // requirement_key + // + template <> + class access::composite_value_traits< ::brep::requirement_key, id_pgsql > + { + public: + typedef ::brep::requirement_key value_type; + + struct image_type + { + // outer + // + long long outer_value; + bool outer_null; + + // middle + // + long long middle_value; + bool middle_null; + + // inner + // + long long inner_value; + bool inner_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; + }; + + // tenant_service + // + template <> + class access::composite_value_traits< ::brep::tenant_service, id_pgsql > + { + public: + typedef ::brep::tenant_service value_type; + + struct image_type + { + // id + // + details::buffer id_value; + std::size_t id_size; + bool id_null; + + // type + // + details::buffer type_value; + std::size_t type_size; + bool type_null; + + // data + // + details::buffer data_value; + std::size_t data_size; + bool data_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; + }; +} + +#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..ce8fe1c --- /dev/null +++ b/libbrep/common-odb.ixx @@ -0,0 +1,587 @@ +// -*- 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; + } + + // email + // + + inline + bool access::composite_value_traits< ::bpkg::email, id_pgsql >:: + get_null (const image_type& i) + { + bool r (true); + r = r && i.value_null; + r = r && i.comment_null; + return r; + } + + inline + void access::composite_value_traits< ::bpkg::email, id_pgsql >:: + set_null (image_type& i, + pgsql::statement_kind sk) + { + ODB_POTENTIALLY_UNUSED (sk); + + using namespace pgsql; + + i.value_null = true; + i.comment_null = true; + } + + // version_constraint + // + + inline + bool access::composite_value_traits< ::bpkg::version_constraint, id_pgsql >:: + get_null (const image_type& i) + { + bool r (true); + r = r && composite_value_traits< ::brep::_version, id_pgsql >::get_null (i.min_version_value); + r = r && composite_value_traits< ::brep::_version, id_pgsql >::get_null (i.max_version_value); + r = r && i.min_open_null; + r = r && i.max_open_null; + return r; + } + + inline + void access::composite_value_traits< ::bpkg::version_constraint, id_pgsql >:: + set_null (image_type& i, + pgsql::statement_kind sk) + { + ODB_POTENTIALLY_UNUSED (sk); + + using namespace pgsql; + + composite_value_traits< ::brep::_version, id_pgsql >::set_null (i.min_version_value, sk); + composite_value_traits< ::brep::_version, id_pgsql >::set_null (i.max_version_value, sk); + i.min_open_null = true; + i.max_open_null = true; + } + + // requirement_alternative + // + + inline + bool access::composite_value_traits< ::bpkg::requirement_alternative, id_pgsql >:: + get_null (const image_type& i) + { + bool r (true); + r = r && i.enable_null; + r = r && i.reflect_null; + return r; + } + + inline + void access::composite_value_traits< ::bpkg::requirement_alternative, id_pgsql >:: + set_null (image_type& i, + pgsql::statement_kind sk) + { + ODB_POTENTIALLY_UNUSED (sk); + + using namespace pgsql; + + i.enable_null = true; + i.reflect_null = true; + } + + // requirement_alternatives + // + + inline + bool access::composite_value_traits< ::bpkg::requirement_alternatives, id_pgsql >:: + get_null (const image_type& i) + { + bool r (true); + r = r && i.buildtime_null; + r = r && i.comment_null; + return r; + } + + inline + void access::composite_value_traits< ::bpkg::requirement_alternatives, id_pgsql >:: + set_null (image_type& i, + pgsql::statement_kind sk) + { + ODB_POTENTIALLY_UNUSED (sk); + + using namespace pgsql; + + i.buildtime_null = true; + i.comment_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; + } + + // build_auxiliary + // + + inline + bool access::composite_value_traits< ::bpkg::build_auxiliary, id_pgsql >:: + get_null (const image_type& i) + { + bool r (true); + r = r && i.environment_name_null; + r = r && i.config_null; + r = r && i.comment_null; + return r; + } + + inline + void access::composite_value_traits< ::bpkg::build_auxiliary, id_pgsql >:: + set_null (image_type& i, + pgsql::statement_kind sk) + { + ODB_POTENTIALLY_UNUSED (sk); + + using namespace pgsql; + + i.environment_name_null = true; + i.config_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; + } + + // public_key_id + // + + inline + bool access::composite_value_traits< ::brep::public_key_id, id_pgsql >:: + get_null (const image_type& i) + { + bool r (true); + r = r && i.tenant_null; + r = r && i.fingerprint_null; + return r; + } + + inline + void access::composite_value_traits< ::brep::public_key_id, id_pgsql >:: + set_null (image_type& i, + pgsql::statement_kind sk) + { + ODB_POTENTIALLY_UNUSED (sk); + + using namespace pgsql; + + i.tenant_null = true; + i.fingerprint_null = true; + } + + // build_toolchain + // + + inline + bool access::composite_value_traits< ::brep::build_toolchain, id_pgsql >:: + get_null (const image_type& i) + { + bool r (true); + r = r && i.name_null; + r = r && composite_value_traits< ::brep::_version, id_pgsql >::get_null (i.version_value); + return r; + } + + inline + void access::composite_value_traits< ::brep::build_toolchain, 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::_version, id_pgsql >::set_null (i.version_value, sk); + } + + // build_class_expr_key + // + + inline + bool access::composite_value_traits< ::brep::build_class_expr_key, id_pgsql >:: + get_null (const image_type& i) + { + bool r (true); + r = r && i.outer_null; + r = r && i.inner_null; + return r; + } + + inline + void access::composite_value_traits< ::brep::build_class_expr_key, id_pgsql >:: + set_null (image_type& i, + pgsql::statement_kind sk) + { + ODB_POTENTIALLY_UNUSED (sk); + + using namespace pgsql; + + i.outer_null = true; + i.inner_null = true; + } + + // build_constraint_key + // + + inline + bool access::composite_value_traits< ::brep::build_constraint_key, id_pgsql >:: + get_null (const image_type& i) + { + bool r (true); + r = r && i.outer_null; + r = r && i.inner_null; + return r; + } + + inline + void access::composite_value_traits< ::brep::build_constraint_key, id_pgsql >:: + set_null (image_type& i, + pgsql::statement_kind sk) + { + ODB_POTENTIALLY_UNUSED (sk); + + using namespace pgsql; + + i.outer_null = true; + i.inner_null = true; + } + + // build_auxiliary_key + // + + inline + bool access::composite_value_traits< ::brep::build_auxiliary_key, id_pgsql >:: + get_null (const image_type& i) + { + bool r (true); + r = r && i.outer_null; + r = r && i.inner_null; + return r; + } + + inline + void access::composite_value_traits< ::brep::build_auxiliary_key, id_pgsql >:: + set_null (image_type& i, + pgsql::statement_kind sk) + { + ODB_POTENTIALLY_UNUSED (sk); + + using namespace pgsql; + + i.outer_null = true; + i.inner_null = true; + } + + // requirement_alternative_key + // + + inline + bool access::composite_value_traits< ::brep::requirement_alternative_key, id_pgsql >:: + get_null (const image_type& i) + { + bool r (true); + r = r && i.outer_null; + r = r && i.inner_null; + return r; + } + + inline + void access::composite_value_traits< ::brep::requirement_alternative_key, id_pgsql >:: + set_null (image_type& i, + pgsql::statement_kind sk) + { + ODB_POTENTIALLY_UNUSED (sk); + + using namespace pgsql; + + i.outer_null = true; + i.inner_null = true; + } + + // requirement_key + // + + inline + bool access::composite_value_traits< ::brep::requirement_key, id_pgsql >:: + get_null (const image_type& i) + { + bool r (true); + r = r && i.outer_null; + r = r && i.middle_null; + r = r && i.inner_null; + return r; + } + + inline + void access::composite_value_traits< ::brep::requirement_key, id_pgsql >:: + set_null (image_type& i, + pgsql::statement_kind sk) + { + ODB_POTENTIALLY_UNUSED (sk); + + using namespace pgsql; + + i.outer_null = true; + i.middle_null = true; + i.inner_null = true; + } + + // tenant_service + // + + inline + bool access::composite_value_traits< ::brep::tenant_service, id_pgsql >:: + get_null (const image_type& i) + { + bool r (true); + r = r && i.id_null; + r = r && i.type_null; + r = r && i.data_null; + return r; + } + + inline + void access::composite_value_traits< ::brep::tenant_service, id_pgsql >:: + set_null (image_type& i, + pgsql::statement_kind sk) + { + ODB_POTENTIALLY_UNUSED (sk); + + using namespace pgsql; + + i.id_null = true; + i.type_null = true; + i.data_null = true; + } +} + diff --git a/libbrep/package-028-post.sql b/libbrep/package-028-post.sql new file mode 100644 index 0000000..9f587f3 --- /dev/null +++ b/libbrep/package-028-post.sql @@ -0,0 +1,8 @@ +/* This file was generated by ODB, object-relational mapping (ORM) + * compiler for C++. + */ + +UPDATE "schema_version" + SET "migration" = FALSE + WHERE "name" = 'package'; + diff --git a/libbrep/package-028-pre.sql b/libbrep/package-028-pre.sql new file mode 100644 index 0000000..205dd55 --- /dev/null +++ b/libbrep/package-028-pre.sql @@ -0,0 +1,16 @@ +/* This file was generated by ODB, object-relational mapping (ORM) + * compiler for C++. + */ + +ALTER TABLE "package_build_configs" + ADD COLUMN "config_email" TEXT NULL, + ADD COLUMN "config_email_comment" TEXT NULL, + ADD COLUMN "config_warning_email" TEXT NULL, + ADD COLUMN "config_warning_email_comment" TEXT NULL, + ADD COLUMN "config_error_email" TEXT NULL, + ADD COLUMN "config_error_email_comment" TEXT NULL; + +UPDATE "schema_version" + SET "version" = 28, "migration" = TRUE + WHERE "name" = 'package'; + diff --git a/libbrep/package-029-post.sql b/libbrep/package-029-post.sql new file mode 100644 index 0000000..9f587f3 --- /dev/null +++ b/libbrep/package-029-post.sql @@ -0,0 +1,8 @@ +/* This file was generated by ODB, object-relational mapping (ORM) + * compiler for C++. + */ + +UPDATE "schema_version" + SET "migration" = FALSE + WHERE "name" = 'package'; + diff --git a/libbrep/package-029-pre.sql b/libbrep/package-029-pre.sql new file mode 100644 index 0000000..29ef25e --- /dev/null +++ b/libbrep/package-029-pre.sql @@ -0,0 +1,11 @@ +/* This file was generated by ODB, object-relational mapping (ORM) + * compiler for C++. + */ + +ALTER TABLE "package_tests" + ADD COLUMN "test_enable" TEXT NULL; + +UPDATE "schema_version" + SET "version" = 29, "migration" = TRUE + WHERE "name" = 'package'; + diff --git a/libbrep/package-030-post.sql b/libbrep/package-030-post.sql new file mode 100644 index 0000000..274833a --- /dev/null +++ b/libbrep/package-030-post.sql @@ -0,0 +1,13 @@ +/* This file was generated by ODB, object-relational mapping (ORM) + * compiler for C++. + */ + +CREATE UNIQUE INDEX "tenant_service_i" + ON "tenant" ( + "service_id", + "service_type"); + +UPDATE "schema_version" + SET "migration" = FALSE + WHERE "name" = 'package'; + diff --git a/libbrep/package-030-pre.sql b/libbrep/package-030-pre.sql new file mode 100644 index 0000000..8cfa823 --- /dev/null +++ b/libbrep/package-030-pre.sql @@ -0,0 +1,17 @@ +/* This file was generated by ODB, object-relational mapping (ORM) + * compiler for C++. + */ + +ALTER TABLE "tenant" + ADD COLUMN "service_id" TEXT NULL, + ADD COLUMN "service_type" TEXT NULL, + ADD COLUMN "service_data" TEXT NULL, + ADD COLUMN "queued_timestamp" BIGINT NULL; + +CREATE INDEX "tenant_service_id_i" + ON "tenant" ("service_id"); + +UPDATE "schema_version" + SET "version" = 30, "migration" = TRUE + WHERE "name" = 'package'; + diff --git a/libbrep/package-031-post.sql b/libbrep/package-031-post.sql new file mode 100644 index 0000000..9f587f3 --- /dev/null +++ b/libbrep/package-031-post.sql @@ -0,0 +1,8 @@ +/* This file was generated by ODB, object-relational mapping (ORM) + * compiler for C++. + */ + +UPDATE "schema_version" + SET "migration" = FALSE + WHERE "name" = 'package'; + diff --git a/libbrep/package-031-pre.sql b/libbrep/package-031-pre.sql new file mode 100644 index 0000000..36a6bbf --- /dev/null +++ b/libbrep/package-031-pre.sql @@ -0,0 +1,94 @@ +/* This file was generated by ODB, object-relational mapping (ORM) + * compiler for C++. + */ + +CREATE TABLE "package_build_auxiliaries" ( + "tenant" TEXT NOT NULL, + "name" CITEXT NOT NULL, + "version_epoch" INTEGER NOT NULL, + "version_canonical_upstream" TEXT NOT NULL, + "version_canonical_release" TEXT NOT NULL COLLATE "C", + "version_revision" INTEGER NOT NULL, + "index" BIGINT NOT NULL, + "environment_name" TEXT NOT NULL, + "config" TEXT NOT NULL, + "comment" TEXT NOT NULL); + +CREATE INDEX "package_build_auxiliaries_object_id_i" + ON "package_build_auxiliaries" ( + "tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision"); + +CREATE INDEX "package_build_auxiliaries_index_i" + ON "package_build_auxiliaries" ("index"); + +CREATE TABLE "package_build_config_auxiliaries" ( + "tenant" TEXT NOT NULL, + "name" CITEXT NOT NULL, + "version_epoch" INTEGER NOT NULL, + "version_canonical_upstream" TEXT NOT NULL, + "version_canonical_release" TEXT NOT NULL COLLATE "C", + "version_revision" INTEGER NOT NULL, + "config_index" BIGINT NOT NULL, + "index" BIGINT NOT NULL, + "environment_name" TEXT NOT NULL, + "config" TEXT NOT NULL, + "comment" TEXT NOT NULL); + +CREATE INDEX "package_build_config_auxiliaries_object_id_i" + ON "package_build_config_auxiliaries" ( + "tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision"); + +ALTER TABLE "package_build_auxiliaries" + ADD CONSTRAINT "tenant_fk" + FOREIGN KEY ("tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + ADD CONSTRAINT "object_id_fk" + FOREIGN KEY ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + REFERENCES "package" ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + ON DELETE CASCADE; + +ALTER TABLE "package_build_config_auxiliaries" + ADD CONSTRAINT "tenant_fk" + FOREIGN KEY ("tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + ADD CONSTRAINT "object_id_fk" + FOREIGN KEY ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + REFERENCES "package" ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + ON DELETE CASCADE; + +UPDATE "schema_version" + SET "version" = 31, "migration" = TRUE + WHERE "name" = 'package'; + diff --git a/libbrep/package-032-post.sql b/libbrep/package-032-post.sql new file mode 100644 index 0000000..9f587f3 --- /dev/null +++ b/libbrep/package-032-post.sql @@ -0,0 +1,8 @@ +/* This file was generated by ODB, object-relational mapping (ORM) + * compiler for C++. + */ + +UPDATE "schema_version" + SET "migration" = FALSE + WHERE "name" = 'package'; + diff --git a/libbrep/package-032-pre.sql b/libbrep/package-032-pre.sql new file mode 100644 index 0000000..f0842cf --- /dev/null +++ b/libbrep/package-032-pre.sql @@ -0,0 +1,17 @@ +/* This file was generated by ODB, object-relational mapping (ORM) + * compiler for C++. + */ + +ALTER TABLE "tenant" + ADD COLUMN "build_toolchain_name" TEXT NULL, + ADD COLUMN "build_toolchain_version_epoch" INTEGER NULL, + ADD COLUMN "build_toolchain_version_canonical_upstream" TEXT NULL, + ADD COLUMN "build_toolchain_version_canonical_release" TEXT NULL, + ADD COLUMN "build_toolchain_version_revision" INTEGER NULL, + ADD COLUMN "build_toolchain_version_upstream" TEXT NULL, + ADD COLUMN "build_toolchain_version_release" TEXT NULL; + +UPDATE "schema_version" + SET "version" = 32, "migration" = TRUE + WHERE "name" = 'package'; + diff --git a/libbrep/package-033-post.sql b/libbrep/package-033-post.sql new file mode 100644 index 0000000..9f587f3 --- /dev/null +++ b/libbrep/package-033-post.sql @@ -0,0 +1,8 @@ +/* This file was generated by ODB, object-relational mapping (ORM) + * compiler for C++. + */ + +UPDATE "schema_version" + SET "migration" = FALSE + WHERE "name" = 'package'; + diff --git a/libbrep/package-033-pre.sql b/libbrep/package-033-pre.sql new file mode 100644 index 0000000..7f4393c --- /dev/null +++ b/libbrep/package-033-pre.sql @@ -0,0 +1,128 @@ +/* This file was generated by ODB, object-relational mapping (ORM) + * compiler for C++. + */ + +CREATE TABLE "public_key" ( + "tenant" TEXT NOT NULL, + "fingerprint" TEXT NOT NULL, + "data" TEXT NOT NULL, + PRIMARY KEY ("tenant", + "fingerprint")); + +ALTER TABLE "package" + ADD COLUMN "custom_bot" BOOLEAN NULL; + +CREATE TABLE "package_build_bot_keys" ( + "tenant" TEXT NOT NULL, + "name" CITEXT NOT NULL, + "version_epoch" INTEGER NOT NULL, + "version_canonical_upstream" TEXT NOT NULL, + "version_canonical_release" TEXT NOT NULL COLLATE "C", + "version_revision" INTEGER NOT NULL, + "index" BIGINT NOT NULL, + "key_tenant" TEXT NOT NULL, + "key_fingerprint" TEXT NOT NULL); + +CREATE INDEX "package_build_bot_keys_object_id_i" + ON "package_build_bot_keys" ( + "tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision"); + +CREATE INDEX "package_build_bot_keys_index_i" + ON "package_build_bot_keys" ("index"); + +CREATE TABLE "package_build_config_bot_keys" ( + "tenant" TEXT NOT NULL, + "name" CITEXT NOT NULL, + "version_epoch" INTEGER NOT NULL, + "version_canonical_upstream" TEXT NOT NULL, + "version_canonical_release" TEXT NOT NULL COLLATE "C", + "version_revision" INTEGER NOT NULL, + "config_index" BIGINT NOT NULL, + "index" BIGINT NOT NULL, + "key_tenant" TEXT NOT NULL, + "key_fingerprint" TEXT NOT NULL); + +CREATE INDEX "package_build_config_bot_keys_object_id_i" + ON "package_build_config_bot_keys" ( + "tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision"); + +ALTER TABLE "public_key" + ADD CONSTRAINT "tenant_fk" + FOREIGN KEY ("tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED; + +ALTER TABLE "package_build_bot_keys" + ADD CONSTRAINT "tenant_fk" + FOREIGN KEY ("tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + ADD CONSTRAINT "object_id_fk" + FOREIGN KEY ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + REFERENCES "package" ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + ON DELETE CASCADE, + ADD CONSTRAINT "key_tenant_fk" + FOREIGN KEY ("key_tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + ADD CONSTRAINT "key_fk" + FOREIGN KEY ("key_tenant", + "key_fingerprint") + REFERENCES "public_key" ("tenant", + "fingerprint") + INITIALLY DEFERRED; + +ALTER TABLE "package_build_config_bot_keys" + ADD CONSTRAINT "tenant_fk" + FOREIGN KEY ("tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + ADD CONSTRAINT "object_id_fk" + FOREIGN KEY ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + REFERENCES "package" ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + ON DELETE CASCADE, + ADD CONSTRAINT "key_tenant_fk" + FOREIGN KEY ("key_tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + ADD CONSTRAINT "key_fk" + FOREIGN KEY ("key_tenant", + "key_fingerprint") + REFERENCES "public_key" ("tenant", + "fingerprint") + INITIALLY DEFERRED; + +UPDATE "schema_version" + SET "version" = 33, "migration" = TRUE + WHERE "name" = 'package'; + diff --git a/libbrep/package-034-post.sql b/libbrep/package-034-post.sql new file mode 100644 index 0000000..9f587f3 --- /dev/null +++ b/libbrep/package-034-post.sql @@ -0,0 +1,8 @@ +/* This file was generated by ODB, object-relational mapping (ORM) + * compiler for C++. + */ + +UPDATE "schema_version" + SET "migration" = FALSE + WHERE "name" = 'package'; + diff --git a/libbrep/package-034-pre.sql b/libbrep/package-034-pre.sql new file mode 100644 index 0000000..6229da0 --- /dev/null +++ b/libbrep/package-034-pre.sql @@ -0,0 +1,14 @@ +/* This file was generated by ODB, object-relational mapping (ORM) + * compiler for C++. + */ + +ALTER TABLE "tenant" + ADD COLUMN "loaded_timestamp" BIGINT NULL; + +CREATE INDEX "tenant_loaded_timestamp_i" + ON "tenant" ("loaded_timestamp"); + +UPDATE "schema_version" + SET "version" = 34, "migration" = TRUE + WHERE "name" = 'package'; + diff --git a/libbrep/package-extra.hxx b/libbrep/package-extra.hxx new file mode 100644 index 0000000..0459446 --- /dev/null +++ b/libbrep/package-extra.hxx @@ -0,0 +1,574 @@ + 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, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 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, 0x0a, 0x20, 0x20, 0x20, 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, 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, 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, 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, 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, 0x20, 0x20, 0x4a, 0x4f, 0x49, 0x4e, 0x20, 0x74, 0x65, 0x6e, + 0x61, 0x6e, 0x74, 0x20, 0x74, 0x20, 0x4f, 0x4e, 0x20, 0x28, 0x70, 0x31, + 0x2e, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x20, 0x3d, 0x20, 0x74, 0x2e, + 0x69, 0x64, 0x29, 0x0a, 0x20, 0x20, 0x57, 0x48, 0x45, 0x52, 0x45, 0x0a, + 0x20, 0x20, 0x20, 0x20, 0x43, 0x41, 0x53, 0x45, 0x0a, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x57, 0x48, 0x45, 0x4e, 0x20, 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, 0x54, 0x48, 0x45, 0x4e, 0x20, 0x4e, 0x4f, 0x54, 0x20, + 0x74, 0x2e, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x0a, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x45, 0x4c, 0x53, 0x45, 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, 0x0a, 0x20, 0x20, 0x20, 0x20, + 0x45, 0x4e, 0x44, 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, 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, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x0a, 0x2d, 0x2d, + 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, 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, 0x70, 0x75, + 0x62, 0x6c, 0x69, 0x63, 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, 0x70, 0x2e, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x2c, 0x20, + 0x70, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x20, 0x70, 0x2e, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x2c, + 0x20, 0x70, 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, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x70, 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, 0x2c, 0x20, 0x70, 0x2e, 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, 0x20, 0x70, 0x20, 0x4a, 0x4f, + 0x49, 0x4e, 0x20, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x20, 0x74, 0x20, + 0x4f, 0x4e, 0x20, 0x28, 0x70, 0x2e, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, + 0x20, 0x3d, 0x20, 0x74, 0x2e, 0x69, 0x64, 0x29, 0x0a, 0x20, 0x20, 0x57, + 0x48, 0x45, 0x52, 0x45, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x43, 0x41, 0x53, + 0x45, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x57, 0x48, 0x45, 0x4e, + 0x20, 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, 0x54, 0x48, 0x45, 0x4e, + 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x74, 0x2e, 0x70, 0x72, 0x69, 0x76, 0x61, + 0x74, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x45, 0x4c, 0x53, + 0x45, 0x20, 0x70, 0x2e, 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, 0x0a, + 0x20, 0x20, 0x20, 0x20, 0x45, 0x4e, 0x44, 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, 0x41, 0x4e, 0x44, 0x0a, 0x20, 0x20, 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, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x41, 0x4e, + 0x44, 0x0a, 0x20, 0x20, 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, 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..29863df --- /dev/null +++ b/libbrep/package-odb.cxx @@ -0,0 +1,20409 @@ +// -*- 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_ptr (); + 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_ptr (); + 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_ptr (); + 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_ptr (); + 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:71: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:72: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:72: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); + } + } + + // 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_ptr (); + 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_alternative + // + + bool access::composite_value_traits< ::brep::dependency_alternative, id_pgsql >:: + grow (image_type& i, + bool* t) + { + ODB_POTENTIALLY_UNUSED (i); + ODB_POTENTIALLY_UNUSED (t); + + bool grew (false); + + // enable + // + if (t[0UL]) + { + i.enable_value.capacity (i.enable_size); + grew = true; + } + + // reflect + // + if (t[1UL]) + { + i.reflect_value.capacity (i.reflect_size); + grew = true; + } + + // prefer + // + if (t[2UL]) + { + i.prefer_value.capacity (i.prefer_size); + grew = true; + } + + // accept + // + if (t[3UL]) + { + i.accept_value.capacity (i.accept_size); + grew = true; + } + + // require + // + if (t[4UL]) + { + i.require_value.capacity (i.require_size); + grew = true; + } + + return grew; + } + + void access::composite_value_traits< ::brep::dependency_alternative, 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); + + // enable + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.enable_value.data_ptr (); + b[n].capacity = i.enable_value.capacity (); + b[n].size = &i.enable_size; + b[n].is_null = &i.enable_null; + n++; + + // reflect + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.reflect_value.data_ptr (); + b[n].capacity = i.reflect_value.capacity (); + b[n].size = &i.reflect_size; + b[n].is_null = &i.reflect_null; + n++; + + // prefer + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.prefer_value.data_ptr (); + b[n].capacity = i.prefer_value.capacity (); + b[n].size = &i.prefer_size; + b[n].is_null = &i.prefer_null; + n++; + + // accept + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.accept_value.data_ptr (); + b[n].capacity = i.accept_value.capacity (); + b[n].size = &i.accept_size; + b[n].is_null = &i.accept_null; + n++; + + // require + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.require_value.data_ptr (); + b[n].capacity = i.require_value.capacity (); + b[n].size = &i.require_size; + b[n].is_null = &i.require_null; + n++; + } + + bool access::composite_value_traits< ::brep::dependency_alternative, 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); + + // enable + // + { + ::butl::optional< ::std::basic_string< char > > const& v = + o.enable; + + bool is_null (true); + std::size_t size (0); + std::size_t cap (i.enable_value.capacity ()); + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_image ( + i.enable_value, + size, + is_null, + v); + i.enable_null = is_null; + i.enable_size = size; + grew = grew || (cap != i.enable_value.capacity ()); + } + + // reflect + // + { + ::butl::optional< ::std::basic_string< char > > const& v = + o.reflect; + + bool is_null (true); + std::size_t size (0); + std::size_t cap (i.reflect_value.capacity ()); + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_image ( + i.reflect_value, + size, + is_null, + v); + i.reflect_null = is_null; + i.reflect_size = size; + grew = grew || (cap != i.reflect_value.capacity ()); + } + + // prefer + // + { + ::butl::optional< ::std::basic_string< char > > const& v = + o.prefer; + + bool is_null (true); + std::size_t size (0); + std::size_t cap (i.prefer_value.capacity ()); + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_image ( + i.prefer_value, + size, + is_null, + v); + i.prefer_null = is_null; + i.prefer_size = size; + grew = grew || (cap != i.prefer_value.capacity ()); + } + + // accept + // + { + ::butl::optional< ::std::basic_string< char > > const& v = + o.accept; + + bool is_null (true); + std::size_t size (0); + std::size_t cap (i.accept_value.capacity ()); + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_image ( + i.accept_value, + size, + is_null, + v); + i.accept_null = is_null; + i.accept_size = size; + grew = grew || (cap != i.accept_value.capacity ()); + } + + // require + // + { + ::butl::optional< ::std::basic_string< char > > const& v = + o.require; + + bool is_null (true); + std::size_t size (0); + std::size_t cap (i.require_value.capacity ()); + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_image ( + i.require_value, + size, + is_null, + v); + i.require_null = is_null; + i.require_size = size; + grew = grew || (cap != i.require_value.capacity ()); + } + + return grew; + } + + void access::composite_value_traits< ::brep::dependency_alternative, id_pgsql >:: + init (value_type& o, + const image_type& i, + database* db) + { + ODB_POTENTIALLY_UNUSED (o); + ODB_POTENTIALLY_UNUSED (i); + ODB_POTENTIALLY_UNUSED (db); + + // enable + // + { + ::butl::optional< ::std::basic_string< char > >& v = + o.enable; + + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_value ( + v, + i.enable_value, + i.enable_size, + i.enable_null); + } + + // reflect + // + { + ::butl::optional< ::std::basic_string< char > >& v = + o.reflect; + + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_value ( + v, + i.reflect_value, + i.reflect_size, + i.reflect_null); + } + + // prefer + // + { + ::butl::optional< ::std::basic_string< char > >& v = + o.prefer; + + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_value ( + v, + i.prefer_value, + i.prefer_size, + i.prefer_null); + } + + // accept + // + { + ::butl::optional< ::std::basic_string< char > >& v = + o.accept; + + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_value ( + v, + i.accept_value, + i.accept_size, + i.accept_null); + } + + // require + // + { + ::butl::optional< ::std::basic_string< char > >& v = + o.require; + + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_value ( + v, + i.require_value, + i.require_size, + i.require_null); + } + } + + // 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); + + // buildtime + // + t[0UL] = 0; + + // comment + // + if (t[1UL]) + { + 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); + + // 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_ptr (); + 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); + + // 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); + + // 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; + } + + // buildtime + // + t[22UL] = 0; + + // enable + // + if (t[23UL]) + { + i.enable_value.capacity (i.enable_size); + grew = true; + } + + // reflect + // + if (t[24UL]) + { + i.reflect_value.capacity (i.reflect_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_ptr (); + b[n].capacity = i.type_value.capacity (); + b[n].size = &i.type_size; + b[n].is_null = &i.type_null; + n++; + + // buildtime + // + b[n].type = pgsql::bind::boolean_; + b[n].buffer = &i.buildtime_value; + b[n].is_null = &i.buildtime_null; + n++; + + // enable + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.enable_value.data_ptr (); + b[n].capacity = i.enable_value.capacity (); + b[n].size = &i.enable_size; + b[n].is_null = &i.enable_null; + n++; + + // reflect + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.reflect_value.data_ptr (); + b[n].capacity = i.reflect_value.capacity (); + b[n].size = &i.reflect_size; + b[n].is_null = &i.reflect_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 common.hxx:623: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 ()); + } + + // 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; + } + + // enable + // + { + ::butl::optional< ::std::basic_string< char > > const& v = + o.enable; + + bool is_null (true); + std::size_t size (0); + std::size_t cap (i.enable_value.capacity ()); + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_image ( + i.enable_value, + size, + is_null, + v); + i.enable_null = is_null; + i.enable_size = size; + grew = grew || (cap != i.enable_value.capacity ()); + } + + // reflect + // + { + ::butl::optional< ::std::basic_string< char > > const& v = + o.reflect; + + bool is_null (true); + std::size_t size (0); + std::size_t cap (i.reflect_value.capacity ()); + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_image ( + i.reflect_value, + size, + is_null, + v); + i.reflect_null = is_null; + i.reflect_size = size; + grew = grew || (cap != i.reflect_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 common.hxx:623:14 + v = brep::to_test_dependency_type (vt); + } + + // buildtime + // + { + bool& v = + o.buildtime; + + pgsql::value_traits< + bool, + pgsql::id_boolean >::set_value ( + v, + i.buildtime_value, + i.buildtime_null); + } + + // enable + // + { + ::butl::optional< ::std::basic_string< char > >& v = + o.enable; + + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_value ( + v, + i.enable_value, + i.enable_size, + i.enable_null); + } + + // reflect + // + { + ::butl::optional< ::std::basic_string< char > >& v = + o.reflect; + + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_value ( + v, + i.reflect_value, + i.reflect_size, + i.reflect_null); + } + } + + // 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_ptr (); + 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_ptr (); + 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_ptr (); + 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_ptr (); + 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_ptr (); + 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::bool_oid, + pgsql::text_oid, + pgsql::int8_oid, + pgsql::bool_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::int8_oid, + pgsql::int8_oid, + pgsql::text_oid, + pgsql::int4_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::int4_oid, + pgsql::text_oid, + pgsql::text_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::bool_oid, + pgsql::text_oid, + pgsql::int8_oid, + pgsql::bool_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::int8_oid, + pgsql::int8_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 + }; + + 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; + } + + // private_ + // + t[1UL] = 0; + + // interactive + // + if (t[2UL]) + { + i.interactive_value.capacity (i.interactive_size); + grew = true; + } + + // creation_timestamp + // + t[3UL] = 0; + + // archived + // + t[4UL] = 0; + + // service + // + if (composite_value_traits< ::brep::tenant_service, id_pgsql >::grow ( + i.service_value, t + 5UL)) + grew = true; + + // loaded_timestamp + // + t[8UL] = 0; + + // queued_timestamp + // + t[9UL] = 0; + + // build_toolchain + // + if (composite_value_traits< ::brep::build_toolchain, id_pgsql >::grow ( + i.build_toolchain_value, t + 10UL)) + grew = true; + + 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_ptr (); + b[n].capacity = i.id_value.capacity (); + b[n].size = &i.id_size; + b[n].is_null = &i.id_null; + n++; + } + + // private_ + // + b[n].type = pgsql::bind::boolean_; + b[n].buffer = &i.private_value; + b[n].is_null = &i.private_null; + n++; + + // interactive + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.interactive_value.data_ptr (); + b[n].capacity = i.interactive_value.capacity (); + b[n].size = &i.interactive_size; + b[n].is_null = &i.interactive_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++; + + // service + // + composite_value_traits< ::brep::tenant_service, id_pgsql >::bind ( + b + n, i.service_value, sk); + n += 3UL; + + // loaded_timestamp + // + b[n].type = pgsql::bind::bigint; + b[n].buffer = &i.loaded_timestamp_value; + b[n].is_null = &i.loaded_timestamp_null; + n++; + + // queued_timestamp + // + b[n].type = pgsql::bind::bigint; + b[n].buffer = &i.queued_timestamp_value; + b[n].is_null = &i.queued_timestamp_null; + n++; + + // build_toolchain + // + composite_value_traits< ::brep::build_toolchain, id_pgsql >::bind ( + b + n, i.build_toolchain_value, sk); + n += 7UL; + } + + 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_ptr (); + 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 ()); + } + + // private_ + // + { + bool const& v = + o.private_; + + bool is_null (false); + pgsql::value_traits< + bool, + pgsql::id_boolean >::set_image ( + i.private_value, is_null, v); + i.private_null = is_null; + } + + // interactive + // + { + ::butl::optional< ::std::basic_string< char > > const& v = + o.interactive; + + bool is_null (true); + std::size_t size (0); + std::size_t cap (i.interactive_value.capacity ()); + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_image ( + i.interactive_value, + size, + is_null, + v); + i.interactive_null = is_null; + i.interactive_size = size; + grew = grew || (cap != i.interactive_value.capacity ()); + } + + // creation_timestamp + // + { + ::butl::timestamp const& v = + o.creation_timestamp; + + // From common.hxx:123: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; + } + + // service + // + { + ::butl::optional< ::brep::tenant_service > const& v = + o.service; + + if (wrapper_traits< ::butl::optional< ::brep::tenant_service > >::get_null (v)) + composite_value_traits< ::brep::tenant_service, id_pgsql >::set_null ( + i.service_value, sk); + else + { + const::brep::tenant_service& vw = + wrapper_traits< ::butl::optional< ::brep::tenant_service > >::get_ref (v); + + if (composite_value_traits< ::brep::tenant_service, id_pgsql >::init ( + i.service_value, + vw, + sk)) + grew = true; + } + } + + // loaded_timestamp + // + { + ::butl::optional< ::std::chrono::time_point< ::std::chrono::system_clock, ::std::chrono::duration< long int, ::std::ratio< 1, 1000000000 > > > > const& v = + o.loaded_timestamp; + + // From common.hxx:133:14 + ::brep::optional_uint64 const& vt = + (v) ? std::chrono::duration_cast < std::chrono::nanoseconds > ((v)->time_since_epoch ()).count () : brep::optional_uint64 (); + + bool is_null (true); + pgsql::value_traits< + ::brep::optional_uint64, + pgsql::id_bigint >::set_image ( + i.loaded_timestamp_value, is_null, vt); + i.loaded_timestamp_null = is_null; + } + + // queued_timestamp + // + { + ::butl::optional< ::std::chrono::time_point< ::std::chrono::system_clock, ::std::chrono::duration< long int, ::std::ratio< 1, 1000000000 > > > > const& v = + o.queued_timestamp; + + // From common.hxx:133:14 + ::brep::optional_uint64 const& vt = + (v) ? std::chrono::duration_cast < std::chrono::nanoseconds > ((v)->time_since_epoch ()).count () : brep::optional_uint64 (); + + bool is_null (true); + pgsql::value_traits< + ::brep::optional_uint64, + pgsql::id_bigint >::set_image ( + i.queued_timestamp_value, is_null, vt); + i.queued_timestamp_null = is_null; + } + + // build_toolchain + // + { + ::butl::optional< ::brep::build_toolchain > const& v = + o.build_toolchain; + + if (wrapper_traits< ::butl::optional< ::brep::build_toolchain > >::get_null (v)) + composite_value_traits< ::brep::build_toolchain, id_pgsql >::set_null ( + i.build_toolchain_value, sk); + else + { + const::brep::build_toolchain& vw = + wrapper_traits< ::butl::optional< ::brep::build_toolchain > >::get_ref (v); + + if (composite_value_traits< ::brep::build_toolchain, id_pgsql >::init ( + i.build_toolchain_value, + vw, + sk)) + grew = true; + } + } + + 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); + } + + // private_ + // + { + bool& v = + o.private_; + + pgsql::value_traits< + bool, + pgsql::id_boolean >::set_value ( + v, + i.private_value, + i.private_null); + } + + // interactive + // + { + ::butl::optional< ::std::basic_string< char > >& v = + o.interactive; + + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_value ( + v, + i.interactive_value, + i.interactive_size, + i.interactive_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:123: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); + } + + // service + // + { + ::butl::optional< ::brep::tenant_service >& v = + o.service; + + if (composite_value_traits< ::brep::tenant_service, id_pgsql >::get_null ( + i.service_value)) + wrapper_traits< ::butl::optional< ::brep::tenant_service > >::set_null (v); + else + { + ::brep::tenant_service& vw = + wrapper_traits< ::butl::optional< ::brep::tenant_service > >::set_ref (v); + + composite_value_traits< ::brep::tenant_service, id_pgsql >::init ( + vw, + i.service_value, + db); + } + } + + // loaded_timestamp + // + { + ::butl::optional< ::std::chrono::time_point< ::std::chrono::system_clock, ::std::chrono::duration< long int, ::std::ratio< 1, 1000000000 > > > >& v = + o.loaded_timestamp; + + ::brep::optional_uint64 vt; + + pgsql::value_traits< + ::brep::optional_uint64, + pgsql::id_bigint >::set_value ( + vt, + i.loaded_timestamp_value, + i.loaded_timestamp_null); + + // From common.hxx:133:14 + v = (vt) ? brep::timestamp (std::chrono::duration_cast < brep::timestamp::duration > (std::chrono::nanoseconds ( * (vt)))) : brep::optional_timestamp (); + } + + // queued_timestamp + // + { + ::butl::optional< ::std::chrono::time_point< ::std::chrono::system_clock, ::std::chrono::duration< long int, ::std::ratio< 1, 1000000000 > > > >& v = + o.queued_timestamp; + + ::brep::optional_uint64 vt; + + pgsql::value_traits< + ::brep::optional_uint64, + pgsql::id_bigint >::set_value ( + vt, + i.queued_timestamp_value, + i.queued_timestamp_null); + + // From common.hxx:133:14 + v = (vt) ? brep::timestamp (std::chrono::duration_cast < brep::timestamp::duration > (std::chrono::nanoseconds ( * (vt)))) : brep::optional_timestamp (); + } + + // build_toolchain + // + { + ::butl::optional< ::brep::build_toolchain >& v = + o.build_toolchain; + + if (composite_value_traits< ::brep::build_toolchain, id_pgsql >::get_null ( + i.build_toolchain_value)) + wrapper_traits< ::butl::optional< ::brep::build_toolchain > >::set_null (v); + else + { + ::brep::build_toolchain& vw = + wrapper_traits< ::butl::optional< ::brep::build_toolchain > >::set_ref (v); + + composite_value_traits< ::brep::build_toolchain, id_pgsql >::init ( + vw, + i.build_toolchain_value, + db); + } + } + } + + 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\", " + "\"private\", " + "\"interactive\", " + "\"creation_timestamp\", " + "\"archived\", " + "\"service_id\", " + "\"service_type\", " + "\"service_data\", " + "\"loaded_timestamp\", " + "\"queued_timestamp\", " + "\"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\") " + "VALUES " + "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17)"; + + const char access::object_traits_impl< ::brep::tenant, id_pgsql >::find_statement[] = + "SELECT " + "\"tenant\".\"id\", " + "\"tenant\".\"private\", " + "\"tenant\".\"interactive\", " + "\"tenant\".\"creation_timestamp\", " + "\"tenant\".\"archived\", " + "\"tenant\".\"service_id\", " + "\"tenant\".\"service_type\", " + "\"tenant\".\"service_data\", " + "\"tenant\".\"loaded_timestamp\", " + "\"tenant\".\"queued_timestamp\", " + "\"tenant\".\"build_toolchain_name\", " + "\"tenant\".\"build_toolchain_version_epoch\", " + "\"tenant\".\"build_toolchain_version_canonical_upstream\", " + "\"tenant\".\"build_toolchain_version_canonical_release\", " + "\"tenant\".\"build_toolchain_version_revision\", " + "\"tenant\".\"build_toolchain_version_upstream\", " + "\"tenant\".\"build_toolchain_version_release\" " + "FROM \"tenant\" " + "WHERE \"tenant\".\"id\"=$1"; + + const char access::object_traits_impl< ::brep::tenant, id_pgsql >::update_statement[] = + "UPDATE \"tenant\" " + "SET " + "\"private\"=$1, " + "\"interactive\"=$2, " + "\"creation_timestamp\"=$3, " + "\"archived\"=$4, " + "\"service_id\"=$5, " + "\"service_type\"=$6, " + "\"service_data\"=$7, " + "\"loaded_timestamp\"=$8, " + "\"queued_timestamp\"=$9, " + "\"build_toolchain_name\"=$10, " + "\"build_toolchain_version_epoch\"=$11, " + "\"build_toolchain_version_canonical_upstream\"=$12, " + "\"build_toolchain_version_canonical_release\"=$13, " + "\"build_toolchain_version_revision\"=$14, " + "\"build_toolchain_version_upstream\"=$15, " + "\"build_toolchain_version_release\"=$16 " + "WHERE \"id\"=$17"; + + const char access::object_traits_impl< ::brep::tenant, id_pgsql >::erase_statement[] = + "DELETE FROM \"tenant\" " + "WHERE \"id\"=$1"; + + const char access::object_traits_impl< ::brep::tenant, id_pgsql >::query_statement[] = + "SELECT " + "\"tenant\".\"id\", " + "\"tenant\".\"private\", " + "\"tenant\".\"interactive\", " + "\"tenant\".\"creation_timestamp\", " + "\"tenant\".\"archived\", " + "\"tenant\".\"service_id\", " + "\"tenant\".\"service_type\", " + "\"tenant\".\"service_data\", " + "\"tenant\".\"loaded_timestamp\", " + "\"tenant\".\"queued_timestamp\", " + "\"tenant\".\"build_toolchain_name\", " + "\"tenant\".\"build_toolchain_version_epoch\", " + "\"tenant\".\"build_toolchain_version_canonical_upstream\", " + "\"tenant\".\"build_toolchain_version_canonical_release\", " + "\"tenant\".\"build_toolchain_version_revision\", " + "\"tenant\".\"build_toolchain_version_upstream\", " + "\"tenant\".\"build_toolchain_version_release\" " + "FROM \"tenant\""; + + const char access::object_traits_impl< ::brep::tenant, id_pgsql >::erase_query_statement[] = + "DELETE FROM \"tenant\""; + + const char access::object_traits_impl< ::brep::tenant, id_pgsql >::table_name[] = + "\"tenant\""; + + void access::object_traits_impl< ::brep::tenant, id_pgsql >:: + persist (database& db, const object_type& obj) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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::tenant, 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 (db)); + 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::tenant, id_pgsql >:: + erase (database& db, const id_type& id) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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::tenant, id_pgsql >::pointer_type + access::object_traits_impl< ::brep::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 (db)); + 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::tenant, id_pgsql >:: + find (database& db, const id_type& id, object_type& obj) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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::tenant, id_pgsql >:: + reload (database& db, object_type& obj) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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::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::tenant, id_pgsql >::object_type > + access::object_traits_impl< ::brep::tenant, id_pgsql >:: + query (database& db, const query_base_type& q) + { + using namespace pgsql; + using odb::details::shared; + using odb::details::shared_ptr; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + + 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::tenant, id_pgsql >:: + erase_query (database& db, const query_base_type& q) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + + 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::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::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::transaction& tr (pgsql::transaction::current ()); + ODB_POTENTIALLY_UNUSED (tr); + + // The connection used by the current transaction and the + // one used to prepare this statement must be the same. + // + assert (q.verify_connection (tr)); + + statements_type& sts ( + st->connection ().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)); + } + + // tenant_id + // + + const char access::view_traits_impl< ::brep::tenant_id, id_pgsql >:: + query_statement_name[] = "query_brep_tenant_id"; + + bool access::view_traits_impl< ::brep::tenant_id, 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; + } + + return grew; + } + + void access::view_traits_impl< ::brep::tenant_id, 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); + + // value + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.value_value.data_ptr (); + b[n].capacity = i.value_value.capacity (); + b[n].size = &i.value_size; + b[n].is_null = &i.value_null; + n++; + } + + void access::view_traits_impl< ::brep::tenant_id, id_pgsql >:: + init (view_type& o, + const image_type& i, + database* db) + { + ODB_POTENTIALLY_UNUSED (o); + ODB_POTENTIALLY_UNUSED (i); + ODB_POTENTIALLY_UNUSED (db); + + // value + // + { + ::std::string& v = + o.value; + + pgsql::value_traits< + ::std::string, + pgsql::id_string >::set_value ( + v, + i.value_value, + i.value_size, + i.value_null); + } + } + + access::view_traits_impl< ::brep::tenant_id, id_pgsql >::query_base_type + access::view_traits_impl< ::brep::tenant_id, id_pgsql >:: + query_statement (const query_base_type& q) + { + query_base_type r ( + "SELECT " + "\"id\" "); + + r += "FROM \"tenant\""; + + if (!q.empty ()) + { + r += " "; + r += q.clause_prefix (); + r += q; + } + + return r; + } + + result< access::view_traits_impl< ::brep::tenant_id, id_pgsql >::view_type > + access::view_traits_impl< ::brep::tenant_id, id_pgsql >:: + query (database& db, const query_base_type& q) + { + using namespace pgsql; + using odb::details::shared; + using odb::details::shared_ptr; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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::tenant_id, 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::tenant_id, 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::transaction& tr (pgsql::transaction::current ()); + ODB_POTENTIALLY_UNUSED (tr); + + // The connection used by the current transaction and the + // one used to prepare this statement must be the same. + // + assert (q.verify_connection (tr)); + + statements_type& sts ( + st->connection ().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)); + } + + // repository + // + + const char access::object_traits_impl< ::brep::repository, id_pgsql >:: + persist_statement_name[] = "persist_brep_repository"; + + const char access::object_traits_impl< ::brep::repository, id_pgsql >:: + find_statement_name[] = "find_brep_repository"; + + const char access::object_traits_impl< ::brep::repository, id_pgsql >:: + update_statement_name[] = "update_brep_repository"; + + const char access::object_traits_impl< ::brep::repository, id_pgsql >:: + erase_statement_name[] = "erase_brep_repository"; + + const char access::object_traits_impl< ::brep::repository, id_pgsql >:: + query_statement_name[] = "query_brep_repository"; + + const char access::object_traits_impl< ::brep::repository, id_pgsql >:: + erase_query_statement_name[] = "erase_query_brep_repository"; + + const unsigned int access::object_traits_impl< ::brep::repository, id_pgsql >:: + persist_statement_types[] = + { + 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::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::int8_oid, + pgsql::int8_oid, + pgsql::bool_oid, + pgsql::bool_oid + }; + + const unsigned int access::object_traits_impl< ::brep::repository, id_pgsql >:: + find_statement_types[] = + { + pgsql::text_oid, + pgsql::text_oid + }; + + const unsigned int access::object_traits_impl< ::brep::repository, id_pgsql >:: + update_statement_types[] = + { + pgsql::text_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::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::int8_oid, + pgsql::int8_oid, + pgsql::bool_oid, + pgsql::bool_oid, + pgsql::text_oid, + pgsql::text_oid + }; + + struct access::object_traits_impl< ::brep::repository, id_pgsql >::extra_statement_cache_type + { + pgsql::container_statements_impl< complements_traits > complements; + pgsql::container_statements_impl< prerequisites_traits > prerequisites; + + 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) + : complements (c, id, idn, idt), + prerequisites (c, id, idn, idt) + { + } + }; + + // complements + // + + const char access::object_traits_impl< ::brep::repository, id_pgsql >::complements_traits:: + select_name[] = "select_brep_repository_complements"; + + const char access::object_traits_impl< ::brep::repository, id_pgsql >::complements_traits:: + insert_name[] = "insert_brep_repository_complements"; + + const char access::object_traits_impl< ::brep::repository, id_pgsql >::complements_traits:: + delete_name[] = "delete_brep_repository_complements"; + + const unsigned int access::object_traits_impl< ::brep::repository, id_pgsql >::complements_traits:: + insert_types[] = + { + pgsql::text_oid, + pgsql::text_oid, + pgsql::int8_oid, + pgsql::text_oid, + pgsql::text_oid + }; + + const char access::object_traits_impl< ::brep::repository, id_pgsql >::complements_traits:: + select_statement[] = + "SELECT " + "\"repository_complements\".\"index\", " + "\"repository_complements\".\"complement_tenant\", " + "\"repository_complements\".\"complement_canonical_name\" " + "FROM \"repository_complements\" " + "WHERE \"repository_complements\".\"repository_tenant\"=$1 AND \"repository_complements\".\"repository_canonical_name\"=$2 ORDER BY \"repository_complements\".\"index\""; + + const char access::object_traits_impl< ::brep::repository, id_pgsql >::complements_traits:: + insert_statement[] = + "INSERT INTO \"repository_complements\" " + "(\"repository_tenant\", " + "\"repository_canonical_name\", " + "\"index\", " + "\"complement_tenant\", " + "\"complement_canonical_name\") " + "VALUES " + "($1, $2, $3, $4, $5)"; + + const char access::object_traits_impl< ::brep::repository, id_pgsql >::complements_traits:: + delete_statement[] = + "DELETE FROM \"repository_complements\" " + "WHERE \"repository_tenant\"=$1 AND \"repository_canonical_name\"=$2"; + + void access::object_traits_impl< ::brep::repository, id_pgsql >::complements_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< ::brep::repository_id, id_pgsql >::bind ( + b + n, d.value_value, sk); + } + + void access::object_traits_impl< ::brep::repository, id_pgsql >::complements_traits:: + grow (data_image_type& i, + bool* t) + { + bool grew (false); + + // index + // + t[0UL] = 0; + + // value + // + if (composite_value_traits< ::brep::repository_id, id_pgsql >::grow ( + i.value_value, t + 1UL)) + grew = true; + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::repository, id_pgsql >::complements_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 + // + { + typedef object_traits< ::brep::repository > obj_traits; + typedef odb::pointer_traits< value_type > wptr_traits; + typedef odb::pointer_traits< wptr_traits::strong_pointer_type > ptr_traits; + + wptr_traits::strong_pointer_type sp (wptr_traits::lock (v)); + bool is_null (ptr_traits::null_ptr (sp)); + if (!is_null) + { + const obj_traits::id_type& ptr_id ( + ptr_traits::object_id< ptr_traits::element_type > (sp)); + + if (composite_value_traits< obj_traits::id_type, id_pgsql >::init ( + i.value_value, + ptr_id, + sk)) + grew = true; + } + else + throw null_pointer (); + } + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::repository, id_pgsql >::complements_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 + // + { + typedef object_traits< ::brep::repository > obj_traits; + typedef odb::pointer_traits< value_type > ptr_traits; + + if (composite_value_traits< obj_traits::id_type, id_pgsql >::get_null ( + i.value_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.value_value, + db); + + v = ptr_traits::pointer_type ( + *static_cast<pgsql::database*> (db), ptr_id); + } + } + } + + void access::object_traits_impl< ::brep::repository, id_pgsql >::complements_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::repository, id_pgsql >::complements_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::repository, id_pgsql >::complements_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::repository, id_pgsql >::complements_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::repository, id_pgsql >::complements_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::repository, id_pgsql >::complements_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::repository, id_pgsql >::complements_traits:: + erase (statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + fs.ordered_ = true; + container_traits_type::erase (fs); + } + + // prerequisites + // + + const char access::object_traits_impl< ::brep::repository, id_pgsql >::prerequisites_traits:: + select_name[] = "select_brep_repository_prerequisites"; + + const char access::object_traits_impl< ::brep::repository, id_pgsql >::prerequisites_traits:: + insert_name[] = "insert_brep_repository_prerequisites"; + + const char access::object_traits_impl< ::brep::repository, id_pgsql >::prerequisites_traits:: + delete_name[] = "delete_brep_repository_prerequisites"; + + const unsigned int access::object_traits_impl< ::brep::repository, id_pgsql >::prerequisites_traits:: + insert_types[] = + { + pgsql::text_oid, + pgsql::text_oid, + pgsql::int8_oid, + pgsql::text_oid, + pgsql::text_oid + }; + + const char access::object_traits_impl< ::brep::repository, id_pgsql >::prerequisites_traits:: + select_statement[] = + "SELECT " + "\"repository_prerequisites\".\"index\", " + "\"repository_prerequisites\".\"prerequisite_tenant\", " + "\"repository_prerequisites\".\"prerequisite_canonical_name\" " + "FROM \"repository_prerequisites\" " + "WHERE \"repository_prerequisites\".\"repository_tenant\"=$1 AND \"repository_prerequisites\".\"repository_canonical_name\"=$2 ORDER BY \"repository_prerequisites\".\"index\""; + + const char access::object_traits_impl< ::brep::repository, id_pgsql >::prerequisites_traits:: + insert_statement[] = + "INSERT INTO \"repository_prerequisites\" " + "(\"repository_tenant\", " + "\"repository_canonical_name\", " + "\"index\", " + "\"prerequisite_tenant\", " + "\"prerequisite_canonical_name\") " + "VALUES " + "($1, $2, $3, $4, $5)"; + + const char access::object_traits_impl< ::brep::repository, id_pgsql >::prerequisites_traits:: + delete_statement[] = + "DELETE FROM \"repository_prerequisites\" " + "WHERE \"repository_tenant\"=$1 AND \"repository_canonical_name\"=$2"; + + void access::object_traits_impl< ::brep::repository, id_pgsql >::prerequisites_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< ::brep::repository_id, id_pgsql >::bind ( + b + n, d.value_value, sk); + } + + void access::object_traits_impl< ::brep::repository, id_pgsql >::prerequisites_traits:: + grow (data_image_type& i, + bool* t) + { + bool grew (false); + + // index + // + t[0UL] = 0; + + // value + // + if (composite_value_traits< ::brep::repository_id, id_pgsql >::grow ( + i.value_value, t + 1UL)) + grew = true; + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::repository, id_pgsql >::prerequisites_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 + // + { + typedef object_traits< ::brep::repository > obj_traits; + typedef odb::pointer_traits< value_type > wptr_traits; + typedef odb::pointer_traits< wptr_traits::strong_pointer_type > ptr_traits; + + wptr_traits::strong_pointer_type sp (wptr_traits::lock (v)); + bool is_null (ptr_traits::null_ptr (sp)); + if (!is_null) + { + const obj_traits::id_type& ptr_id ( + ptr_traits::object_id< ptr_traits::element_type > (sp)); + + if (composite_value_traits< obj_traits::id_type, id_pgsql >::init ( + i.value_value, + ptr_id, + sk)) + grew = true; + } + else + throw null_pointer (); + } + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::repository, id_pgsql >::prerequisites_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 + // + { + typedef object_traits< ::brep::repository > obj_traits; + typedef odb::pointer_traits< value_type > ptr_traits; + + if (composite_value_traits< obj_traits::id_type, id_pgsql >::get_null ( + i.value_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.value_value, + db); + + v = ptr_traits::pointer_type ( + *static_cast<pgsql::database*> (db), ptr_id); + } + } + } + + void access::object_traits_impl< ::brep::repository, id_pgsql >::prerequisites_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::repository, id_pgsql >::prerequisites_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::repository, id_pgsql >::prerequisites_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::repository, id_pgsql >::prerequisites_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::repository, id_pgsql >::prerequisites_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::repository, id_pgsql >::prerequisites_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::repository, id_pgsql >::prerequisites_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::repository, id_pgsql >::id_type + access::object_traits_impl< ::brep::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::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; + + // display_name + // + if (t[4UL]) + { + i.display_name_value.capacity (i.display_name_size); + grew = true; + } + + // priority + // + t[5UL] = 0; + + // interface_url + // + if (t[6UL]) + { + i.interface_url_value.capacity (i.interface_url_size); + grew = true; + } + + // email + // + if (composite_value_traits< ::bpkg::email, id_pgsql >::grow ( + i.email_value, t + 7UL)) + grew = true; + + // summary + // + if (t[9UL]) + { + i.summary_value.capacity (i.summary_size); + grew = true; + } + + // description + // + if (t[10UL]) + { + i.description_value.capacity (i.description_size); + grew = true; + } + + // cache_location + // + if (composite_value_traits< ::brep::_repository_location, id_pgsql >::grow ( + i.cache_location_value, t + 11UL)) + grew = true; + + // certificate + // + if (composite_value_traits< ::brep::certificate, id_pgsql >::grow ( + i.certificate_value, t + 13UL)) + grew = true; + + // packages_timestamp + // + t[18UL] = 0; + + // repositories_timestamp + // + t[19UL] = 0; + + // internal + // + t[20UL] = 0; + + // buildable + // + t[21UL] = 0; + + return grew; + } + + void access::object_traits_impl< ::brep::repository, 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::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; + + // display_name + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.display_name_value.data_ptr (); + b[n].capacity = i.display_name_value.capacity (); + b[n].size = &i.display_name_size; + b[n].is_null = &i.display_name_null; + n++; + + // priority + // + b[n].type = pgsql::bind::integer; + b[n].buffer = &i.priority_value; + b[n].is_null = &i.priority_null; + n++; + + // interface_url + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.interface_url_value.data_ptr (); + b[n].capacity = i.interface_url_value.capacity (); + b[n].size = &i.interface_url_size; + b[n].is_null = &i.interface_url_null; + n++; + + // email + // + composite_value_traits< ::bpkg::email, id_pgsql >::bind ( + b + n, i.email_value, sk); + n += 2UL; + + // summary + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.summary_value.data_ptr (); + b[n].capacity = i.summary_value.capacity (); + b[n].size = &i.summary_size; + b[n].is_null = &i.summary_null; + n++; + + // description + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.description_value.data_ptr (); + b[n].capacity = i.description_value.capacity (); + b[n].size = &i.description_size; + b[n].is_null = &i.description_null; + n++; + + // cache_location + // + composite_value_traits< ::brep::_repository_location, id_pgsql >::bind ( + b + n, i.cache_location_value, sk); + n += 2UL; + + // certificate + // + composite_value_traits< ::brep::certificate, id_pgsql >::bind ( + b + n, i.certificate_value, sk); + n += 5UL; + + // packages_timestamp + // + b[n].type = pgsql::bind::bigint; + b[n].buffer = &i.packages_timestamp_value; + b[n].is_null = &i.packages_timestamp_null; + n++; + + // repositories_timestamp + // + b[n].type = pgsql::bind::bigint; + b[n].buffer = &i.repositories_timestamp_value; + b[n].is_null = &i.repositories_timestamp_null; + n++; + + // internal + // + b[n].type = pgsql::bind::boolean_; + b[n].buffer = &i.internal_value; + b[n].is_null = &i.internal_null; + n++; + + // 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::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::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; + + bool grew (false); + + // id + // + if (sk == statement_insert) + { + ::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:309: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; + } + + // display_name + // + { + ::std::string const& v = + o.display_name; + + bool is_null (false); + std::size_t size (0); + std::size_t cap (i.display_name_value.capacity ()); + pgsql::value_traits< + ::std::string, + pgsql::id_string >::set_image ( + i.display_name_value, + size, + is_null, + v); + i.display_name_null = is_null; + i.display_name_size = size; + grew = grew || (cap != i.display_name_value.capacity ()); + } + + // priority + // + { + ::uint16_t const& v = + o.priority; + + bool is_null (false); + pgsql::value_traits< + ::uint16_t, + pgsql::id_integer >::set_image ( + i.priority_value, is_null, v); + i.priority_null = is_null; + } + + // interface_url + // + { + ::butl::optional< ::std::basic_string< char > > const& v = + o.interface_url; + + bool is_null (true); + std::size_t size (0); + std::size_t cap (i.interface_url_value.capacity ()); + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_image ( + i.interface_url_value, + size, + is_null, + v); + i.interface_url_null = is_null; + i.interface_url_size = size; + grew = grew || (cap != i.interface_url_value.capacity ()); + } + + // email + // + { + ::butl::optional< ::bpkg::email > const& v = + o.email; + + if (wrapper_traits< ::butl::optional< ::bpkg::email > >::get_null (v)) + composite_value_traits< ::bpkg::email, id_pgsql >::set_null ( + i.email_value, sk); + else + { + const::bpkg::email& vw = + wrapper_traits< ::butl::optional< ::bpkg::email > >::get_ref (v); + + if (composite_value_traits< ::bpkg::email, id_pgsql >::init ( + i.email_value, + vw, + sk)) + grew = true; + } + } + + // summary + // + { + ::butl::optional< ::std::basic_string< char > > const& v = + o.summary; + + bool is_null (true); + std::size_t size (0); + std::size_t cap (i.summary_value.capacity ()); + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_image ( + i.summary_value, + size, + is_null, + v); + i.summary_null = is_null; + i.summary_size = size; + grew = grew || (cap != i.summary_value.capacity ()); + } + + // description + // + { + ::butl::optional< ::std::basic_string< char > > const& v = + o.description; + + bool is_null (true); + std::size_t size (0); + std::size_t cap (i.description_value.capacity ()); + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_image ( + i.description_value, + size, + is_null, + v); + i.description_null = is_null; + i.description_size = size; + grew = grew || (cap != i.description_value.capacity ()); + } + + // cache_location + // + { + ::bpkg::repository_location const& v = + o.cache_location; + + // From common.hxx:309: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.cache_location_value, + vt, + sk)) + grew = true; + } + + // certificate + // + { + ::butl::optional< ::brep::certificate > const& v = + o.certificate; + + if (wrapper_traits< ::butl::optional< ::brep::certificate > >::get_null (v)) + composite_value_traits< ::brep::certificate, id_pgsql >::set_null ( + i.certificate_value, sk); + else + { + const::brep::certificate& vw = + wrapper_traits< ::butl::optional< ::brep::certificate > >::get_ref (v); + + if (composite_value_traits< ::brep::certificate, id_pgsql >::init ( + i.certificate_value, + vw, + sk)) + grew = true; + } + } + + // packages_timestamp + // + { + ::butl::timestamp const& v = + o.packages_timestamp; + + // From common.hxx:123: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.packages_timestamp_value, is_null, vt); + i.packages_timestamp_null = is_null; + } + + // repositories_timestamp + // + { + ::butl::timestamp const& v = + o.repositories_timestamp; + + // From common.hxx:123: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.repositories_timestamp_value, is_null, vt); + i.repositories_timestamp_null = is_null; + } + + // internal + // + { + bool const& v = + o.internal; + + bool is_null (false); + pgsql::value_traits< + bool, + pgsql::id_boolean >::set_image ( + i.internal_value, is_null, v); + i.internal_null = is_null; + } + + // 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::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 package.hxx:426: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:309:14 + v = brep::repository_location (std::move ((vt).url), (vt).type); + // From package.hxx:426:7 + o.location = std::move (v); + assert (o.canonical_name == o.location.canonical_name ()); + } + + // display_name + // + { + ::std::string& v = + o.display_name; + + pgsql::value_traits< + ::std::string, + pgsql::id_string >::set_value ( + v, + i.display_name_value, + i.display_name_size, + i.display_name_null); + } + + // priority + // + { + ::uint16_t& v = + o.priority; + + pgsql::value_traits< + ::uint16_t, + pgsql::id_integer >::set_value ( + v, + i.priority_value, + i.priority_null); + } + + // interface_url + // + { + ::butl::optional< ::std::basic_string< char > >& v = + o.interface_url; + + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_value ( + v, + i.interface_url_value, + i.interface_url_size, + i.interface_url_null); + } + + // email + // + { + ::butl::optional< ::bpkg::email >& v = + o.email; + + if (composite_value_traits< ::bpkg::email, id_pgsql >::get_null ( + i.email_value)) + wrapper_traits< ::butl::optional< ::bpkg::email > >::set_null (v); + else + { + ::bpkg::email& vw = + wrapper_traits< ::butl::optional< ::bpkg::email > >::set_ref (v); + + composite_value_traits< ::bpkg::email, id_pgsql >::init ( + vw, + i.email_value, + db); + } + } + + // summary + // + { + ::butl::optional< ::std::basic_string< char > >& v = + o.summary; + + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_value ( + v, + i.summary_value, + i.summary_size, + i.summary_null); + } + + // description + // + { + ::butl::optional< ::std::basic_string< char > >& v = + o.description; + + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_value ( + v, + i.description_value, + i.description_size, + i.description_null); + } + + // cache_location + // + { + ::bpkg::repository_location& v = + o.cache_location; + + ::brep::_repository_location vt; + + composite_value_traits< ::brep::_repository_location, id_pgsql >::init ( + vt, + i.cache_location_value, + db); + + // From common.hxx:309:14 + v = brep::repository_location (std::move ((vt).url), (vt).type); + } + + // certificate + // + { + ::butl::optional< ::brep::certificate >& v = + o.certificate; + + if (composite_value_traits< ::brep::certificate, id_pgsql >::get_null ( + i.certificate_value)) + wrapper_traits< ::butl::optional< ::brep::certificate > >::set_null (v); + else + { + ::brep::certificate& vw = + wrapper_traits< ::butl::optional< ::brep::certificate > >::set_ref (v); + + composite_value_traits< ::brep::certificate, id_pgsql >::init ( + vw, + i.certificate_value, + db); + } + } + + // packages_timestamp + // + { + ::butl::timestamp& v = + o.packages_timestamp; + + ::uint64_t vt; + + pgsql::value_traits< + ::uint64_t, + pgsql::id_bigint >::set_value ( + vt, + i.packages_timestamp_value, + i.packages_timestamp_null); + + // From common.hxx:123:14 + v = brep::timestamp (std::chrono::duration_cast < brep::timestamp::duration > (std::chrono::nanoseconds (vt))); + } + + // repositories_timestamp + // + { + ::butl::timestamp& v = + o.repositories_timestamp; + + ::uint64_t vt; + + pgsql::value_traits< + ::uint64_t, + pgsql::id_bigint >::set_value ( + vt, + i.repositories_timestamp_value, + i.repositories_timestamp_null); + + // From common.hxx:123:14 + v = brep::timestamp (std::chrono::duration_cast < brep::timestamp::duration > (std::chrono::nanoseconds (vt))); + } + + // internal + // + { + bool& v = + o.internal; + + pgsql::value_traits< + bool, + pgsql::id_boolean >::set_value ( + v, + i.internal_value, + i.internal_null); + } + + // 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::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::repository, id_pgsql >::persist_statement[] = + "INSERT INTO \"repository\" " + "(\"tenant\", " + "\"canonical_name\", " + "\"location_url\", " + "\"location_type\", " + "\"display_name\", " + "\"priority\", " + "\"interface_url\", " + "\"email\", " + "\"email_comment\", " + "\"summary\", " + "\"description\", " + "\"cache_location_url\", " + "\"cache_location_type\", " + "\"certificate_fingerprint\", " + "\"certificate_name\", " + "\"certificate_organization\", " + "\"certificate_email\", " + "\"certificate_pem\", " + "\"packages_timestamp\", " + "\"repositories_timestamp\", " + "\"internal\", " + "\"buildable\") " + "VALUES " + "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22)"; + + const char access::object_traits_impl< ::brep::repository, id_pgsql >::find_statement[] = + "SELECT " + "\"repository\".\"tenant\", " + "\"repository\".\"canonical_name\", " + "\"repository\".\"location_url\", " + "\"repository\".\"location_type\", " + "\"repository\".\"display_name\", " + "\"repository\".\"priority\", " + "\"repository\".\"interface_url\", " + "\"repository\".\"email\", " + "\"repository\".\"email_comment\", " + "\"repository\".\"summary\", " + "\"repository\".\"description\", " + "\"repository\".\"cache_location_url\", " + "\"repository\".\"cache_location_type\", " + "\"repository\".\"certificate_fingerprint\", " + "\"repository\".\"certificate_name\", " + "\"repository\".\"certificate_organization\", " + "\"repository\".\"certificate_email\", " + "\"repository\".\"certificate_pem\", " + "\"repository\".\"packages_timestamp\", " + "\"repository\".\"repositories_timestamp\", " + "\"repository\".\"internal\", " + "\"repository\".\"buildable\" " + "FROM \"repository\" " + "WHERE \"repository\".\"tenant\"=$1 AND \"repository\".\"canonical_name\"=$2"; + + const char access::object_traits_impl< ::brep::repository, id_pgsql >::update_statement[] = + "UPDATE \"repository\" " + "SET " + "\"location_url\"=$1, " + "\"location_type\"=$2, " + "\"display_name\"=$3, " + "\"priority\"=$4, " + "\"interface_url\"=$5, " + "\"email\"=$6, " + "\"email_comment\"=$7, " + "\"summary\"=$8, " + "\"description\"=$9, " + "\"cache_location_url\"=$10, " + "\"cache_location_type\"=$11, " + "\"certificate_fingerprint\"=$12, " + "\"certificate_name\"=$13, " + "\"certificate_organization\"=$14, " + "\"certificate_email\"=$15, " + "\"certificate_pem\"=$16, " + "\"packages_timestamp\"=$17, " + "\"repositories_timestamp\"=$18, " + "\"internal\"=$19, " + "\"buildable\"=$20 " + "WHERE \"tenant\"=$21 AND \"canonical_name\"=$22"; + + const char access::object_traits_impl< ::brep::repository, id_pgsql >::erase_statement[] = + "DELETE FROM \"repository\" " + "WHERE \"tenant\"=$1 AND \"canonical_name\"=$2"; + + const char access::object_traits_impl< ::brep::repository, id_pgsql >::query_statement[] = + "SELECT " + "\"repository\".\"tenant\", " + "\"repository\".\"canonical_name\", " + "\"repository\".\"location_url\", " + "\"repository\".\"location_type\", " + "\"repository\".\"display_name\", " + "\"repository\".\"priority\", " + "\"repository\".\"interface_url\", " + "\"repository\".\"email\", " + "\"repository\".\"email_comment\", " + "\"repository\".\"summary\", " + "\"repository\".\"description\", " + "\"repository\".\"cache_location_url\", " + "\"repository\".\"cache_location_type\", " + "\"repository\".\"certificate_fingerprint\", " + "\"repository\".\"certificate_name\", " + "\"repository\".\"certificate_organization\", " + "\"repository\".\"certificate_email\", " + "\"repository\".\"certificate_pem\", " + "\"repository\".\"packages_timestamp\", " + "\"repository\".\"repositories_timestamp\", " + "\"repository\".\"internal\", " + "\"repository\".\"buildable\" " + "FROM \"repository\""; + + const char access::object_traits_impl< ::brep::repository, id_pgsql >::erase_query_statement[] = + "DELETE FROM \"repository\""; + + const char access::object_traits_impl< ::brep::repository, id_pgsql >::table_name[] = + "\"repository\""; + + void access::object_traits_impl< ::brep::repository, id_pgsql >:: + persist (database& db, const object_type& obj) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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 ()); + + // complements + // + { + ::std::vector< ::odb::lazy_weak_ptr< ::brep::repository > > const& v = + obj.complements; + + complements_traits::persist ( + v, + esc.complements); + } + + // prerequisites + // + { + ::std::vector< ::odb::lazy_weak_ptr< ::brep::repository > > const& v = + obj.prerequisites; + + prerequisites_traits::persist ( + v, + esc.prerequisites); + } + + callback (db, + obj, + callback_event::post_persist); + } + + void access::object_traits_impl< ::brep::repository, 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 (db)); + 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 ()); + + // complements + // + { + ::std::vector< ::odb::lazy_weak_ptr< ::brep::repository > > const& v = + obj.complements; + + complements_traits::update ( + v, + esc.complements); + } + + // prerequisites + // + { + ::std::vector< ::odb::lazy_weak_ptr< ::brep::repository > > const& v = + obj.prerequisites; + + prerequisites_traits::update ( + v, + esc.prerequisites); + } + + callback (db, obj, callback_event::post_update); + pointer_cache_traits::update (db, obj); + } + + void access::object_traits_impl< ::brep::repository, id_pgsql >:: + erase (database& db, const id_type& id) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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 ()); + + // complements + // + { + complements_traits::erase ( + esc.complements); + } + + // prerequisites + // + { + prerequisites_traits::erase ( + esc.prerequisites); + } + + if (sts.erase_statement ().execute () != 1) + throw object_not_persistent (); + + pointer_cache_traits::erase (db, id); + } + + access::object_traits_impl< ::brep::repository, id_pgsql >::pointer_type + access::object_traits_impl< ::brep::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 (db)); + 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::repository, id_pgsql >:: + find (database& db, const id_type& id, object_type& obj) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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::repository, id_pgsql >:: + reload (database& db, object_type& obj) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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::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; + } + + void access::object_traits_impl< ::brep::repository, id_pgsql >:: + load_ (statements_type& sts, + object_type& obj, + bool reload) + { + ODB_POTENTIALLY_UNUSED (reload); + + extra_statement_cache_type& esc (sts.extra_statement_cache ()); + + // complements + // + { + ::std::vector< ::odb::lazy_weak_ptr< ::brep::repository > >& v = + obj.complements; + + complements_traits::load ( + v, + esc.complements); + } + + // prerequisites + // + { + ::std::vector< ::odb::lazy_weak_ptr< ::brep::repository > >& v = + obj.prerequisites; + + prerequisites_traits::load ( + v, + esc.prerequisites); + } + } + + result< access::object_traits_impl< ::brep::repository, id_pgsql >::object_type > + access::object_traits_impl< ::brep::repository, id_pgsql >:: + query (database& db, const query_base_type& q) + { + using namespace pgsql; + using odb::details::shared; + using odb::details::shared_ptr; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + + 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::repository, id_pgsql >:: + erase_query (database& db, const query_base_type& q) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + + 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::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::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::transaction& tr (pgsql::transaction::current ()); + ODB_POTENTIALLY_UNUSED (tr); + + // The connection used by the current transaction and the + // one used to prepare this statement must be the same. + // + assert (q.verify_connection (tr)); + + statements_type& sts ( + st->connection ().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)); + } + + // repository_count + // + + const char access::view_traits_impl< ::brep::repository_count, id_pgsql >:: + query_statement_name[] = "query_brep_repository_count"; + + bool access::view_traits_impl< ::brep::repository_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::repository_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::repository_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::repository_count, id_pgsql >::query_base_type + access::view_traits_impl< ::brep::repository_count, id_pgsql >:: + query_statement (const query_base_type& q) + { + query_base_type r ( + "SELECT " + "count(\"repository\".\"tenant\") "); + + r += "FROM \"repository\""; + + if (!q.empty ()) + { + r += " "; + r += q.clause_prefix (); + r += q; + } + + return r; + } + + result< access::view_traits_impl< ::brep::repository_count, id_pgsql >::view_type > + access::view_traits_impl< ::brep::repository_count, id_pgsql >:: + query (database& db, const query_base_type& q) + { + using namespace pgsql; + using odb::details::shared; + using odb::details::shared_ptr; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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::repository_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::repository_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::transaction& tr (pgsql::transaction::current ()); + ODB_POTENTIALLY_UNUSED (tr); + + // The connection used by the current transaction and the + // one used to prepare this statement must be the same. + // + assert (q.verify_connection (tr)); + + statements_type& sts ( + st->connection ().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)); + } + + // typed_text + // + + bool access::composite_value_traits< ::brep::typed_text, id_pgsql >:: + grow (image_type& i, + bool* t) + { + ODB_POTENTIALLY_UNUSED (i); + ODB_POTENTIALLY_UNUSED (t); + + bool grew (false); + + // text + // + if (t[0UL]) + { + i.text_value.capacity (i.text_size); + grew = true; + } + + // type + // + if (t[1UL]) + { + i.type_value.capacity (i.type_size); + grew = true; + } + + return grew; + } + + void access::composite_value_traits< ::brep::typed_text, 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); + + // text + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.text_value.data_ptr (); + b[n].capacity = i.text_value.capacity (); + b[n].size = &i.text_size; + b[n].is_null = &i.text_null; + n++; + + // type + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.type_value.data_ptr (); + 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::typed_text, 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); + + // text + // + { + ::std::string const& v = + o.text; + + bool is_null (false); + std::size_t size (0); + std::size_t cap (i.text_value.capacity ()); + pgsql::value_traits< + ::std::string, + pgsql::id_string >::set_image ( + i.text_value, + size, + is_null, + v); + i.text_null = is_null; + i.text_size = size; + grew = grew || (cap != i.text_value.capacity ()); + } + + // type + // + { + ::bpkg::text_type const& v = + o.type; + + // From package.hxx:55: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::typed_text, id_pgsql >:: + init (value_type& o, + const image_type& i, + database* db) + { + ODB_POTENTIALLY_UNUSED (o); + ODB_POTENTIALLY_UNUSED (i); + ODB_POTENTIALLY_UNUSED (db); + + // text + // + { + ::std::string& v = + o.text; + + pgsql::value_traits< + ::std::string, + pgsql::id_string >::set_value ( + v, + i.text_value, + i.text_size, + i.text_null); + } + + // type + // + { + ::bpkg::text_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:55:14 + v = * brep::to_text_type (vt); + } + } + + // public_key + // + + const char access::object_traits_impl< ::brep::public_key, id_pgsql >:: + persist_statement_name[] = "persist_brep_public_key"; + + const char access::object_traits_impl< ::brep::public_key, id_pgsql >:: + find_statement_name[] = "find_brep_public_key"; + + const char access::object_traits_impl< ::brep::public_key, id_pgsql >:: + update_statement_name[] = "update_brep_public_key"; + + const char access::object_traits_impl< ::brep::public_key, id_pgsql >:: + erase_statement_name[] = "erase_brep_public_key"; + + const char access::object_traits_impl< ::brep::public_key, id_pgsql >:: + query_statement_name[] = "query_brep_public_key"; + + const char access::object_traits_impl< ::brep::public_key, id_pgsql >:: + erase_query_statement_name[] = "erase_query_brep_public_key"; + + const unsigned int access::object_traits_impl< ::brep::public_key, id_pgsql >:: + persist_statement_types[] = + { + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid + }; + + const unsigned int access::object_traits_impl< ::brep::public_key, id_pgsql >:: + find_statement_types[] = + { + pgsql::text_oid, + pgsql::text_oid + }; + + const unsigned int access::object_traits_impl< ::brep::public_key, id_pgsql >:: + update_statement_types[] = + { + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid + }; + + struct access::object_traits_impl< ::brep::public_key, 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::public_key, id_pgsql >::id_type + access::object_traits_impl< ::brep::public_key, id_pgsql >:: + id (const image_type& i) + { + pgsql::database* db (0); + ODB_POTENTIALLY_UNUSED (db); + + id_type id; + { + composite_value_traits< ::brep::public_key_id, id_pgsql >::init ( + id, + i.id_value, + db); + } + + return id; + } + + bool access::object_traits_impl< ::brep::public_key, 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::public_key_id, id_pgsql >::grow ( + i.id_value, t + 0UL)) + grew = true; + + // data + // + if (t[2UL]) + { + i.data_value.capacity (i.data_size); + grew = true; + } + + return grew; + } + + void access::object_traits_impl< ::brep::public_key, 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::public_key_id, id_pgsql >::bind ( + b + n, i.id_value, sk); + n += 2UL; + } + + // data + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.data_value.data_ptr (); + b[n].capacity = i.data_value.capacity (); + b[n].size = &i.data_size; + b[n].is_null = &i.data_null; + n++; + } + + void access::object_traits_impl< ::brep::public_key, 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::public_key_id, id_pgsql >::bind ( + b + n, i.id_value, sk); + } + + bool access::object_traits_impl< ::brep::public_key, 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::public_key_id const& v = + o.id; + + if (composite_value_traits< ::brep::public_key_id, id_pgsql >::init ( + i.id_value, + v, + sk)) + grew = true; + } + + // data + // + { + // From package.hxx:501:45 + ::std::string const& v = + o; + + bool is_null (false); + std::size_t size (0); + std::size_t cap (i.data_value.capacity ()); + pgsql::value_traits< + ::std::string, + pgsql::id_string >::set_image ( + i.data_value, + size, + is_null, + v); + i.data_null = is_null; + i.data_size = size; + grew = grew || (cap != i.data_value.capacity ()); + } + + return grew; + } + + void access::object_traits_impl< ::brep::public_key, 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::public_key_id& v = + o.id; + + composite_value_traits< ::brep::public_key_id, id_pgsql >::init ( + v, + i.id_value, + db); + } + + // data + // + { + // From package.hxx:501:45 + ::std::string& v = + o; + + pgsql::value_traits< + ::std::string, + pgsql::id_string >::set_value ( + v, + i.data_value, + i.data_size, + i.data_null); + } + } + + void access::object_traits_impl< ::brep::public_key, 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::public_key_id, id_pgsql >::init ( + i.id_value, + id, + sk)) + grew = true; + } + + if (grew) + i.version++; + } + + const char access::object_traits_impl< ::brep::public_key, id_pgsql >::persist_statement[] = + "INSERT INTO \"public_key\" " + "(\"tenant\", " + "\"fingerprint\", " + "\"data\") " + "VALUES " + "($1, $2, $3)"; + + const char access::object_traits_impl< ::brep::public_key, id_pgsql >::find_statement[] = + "SELECT " + "\"public_key\".\"tenant\", " + "\"public_key\".\"fingerprint\", " + "\"public_key\".\"data\" " + "FROM \"public_key\" " + "WHERE \"public_key\".\"tenant\"=$1 AND \"public_key\".\"fingerprint\"=$2"; + + const char access::object_traits_impl< ::brep::public_key, id_pgsql >::update_statement[] = + "UPDATE \"public_key\" " + "SET " + "\"data\"=$1 " + "WHERE \"tenant\"=$2 AND \"fingerprint\"=$3"; + + const char access::object_traits_impl< ::brep::public_key, id_pgsql >::erase_statement[] = + "DELETE FROM \"public_key\" " + "WHERE \"tenant\"=$1 AND \"fingerprint\"=$2"; + + const char access::object_traits_impl< ::brep::public_key, id_pgsql >::query_statement[] = + "SELECT " + "\"public_key\".\"tenant\", " + "\"public_key\".\"fingerprint\", " + "\"public_key\".\"data\" " + "FROM \"public_key\""; + + const char access::object_traits_impl< ::brep::public_key, id_pgsql >::erase_query_statement[] = + "DELETE FROM \"public_key\""; + + const char access::object_traits_impl< ::brep::public_key, id_pgsql >::table_name[] = + "\"public_key\""; + + void access::object_traits_impl< ::brep::public_key, id_pgsql >:: + persist (database& db, const object_type& obj) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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::public_key, 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 (db)); + 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::public_key, id_pgsql >:: + erase (database& db, const id_type& id) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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::public_key, id_pgsql >::pointer_type + access::object_traits_impl< ::brep::public_key, 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 (db)); + 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::public_key, id_pgsql >:: + find (database& db, const id_type& id, object_type& obj) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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::public_key, id_pgsql >:: + reload (database& db, object_type& obj) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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::public_key, 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::public_key, id_pgsql >::object_type > + access::object_traits_impl< ::brep::public_key, id_pgsql >:: + query (database& db, const query_base_type& q) + { + using namespace pgsql; + using odb::details::shared; + using odb::details::shared_ptr; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + + 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::public_key, id_pgsql >:: + erase_query (database& db, const query_base_type& q) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + + 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::public_key, 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::public_key, 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::transaction& tr (pgsql::transaction::current ()); + ODB_POTENTIALLY_UNUSED (tr); + + // The connection used by the current transaction and the + // one used to prepare this statement must be the same. + // + assert (q.verify_connection (tr)); + + statements_type& sts ( + st->connection ().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)); + } + + // package_build_config + // + + bool access::composite_value_traits< ::brep::package_build_config, 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; + } + + // arguments + // + if (t[1UL]) + { + i.arguments_value.capacity (i.arguments_size); + grew = true; + } + + // comment + // + if (t[2UL]) + { + i.comment_value.capacity (i.comment_size); + grew = true; + } + + // email + // + if (composite_value_traits< ::bpkg::email, id_pgsql >::grow ( + i.email_value, t + 3UL)) + grew = true; + + // warning_email + // + if (composite_value_traits< ::bpkg::email, id_pgsql >::grow ( + i.warning_email_value, t + 5UL)) + grew = true; + + // error_email + // + if (composite_value_traits< ::bpkg::email, id_pgsql >::grow ( + i.error_email_value, t + 7UL)) + grew = true; + + return grew; + } + + void access::composite_value_traits< ::brep::package_build_config, 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_ptr (); + b[n].capacity = i.name_value.capacity (); + b[n].size = &i.name_size; + b[n].is_null = &i.name_null; + n++; + + // arguments + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.arguments_value.data_ptr (); + b[n].capacity = i.arguments_value.capacity (); + b[n].size = &i.arguments_size; + b[n].is_null = &i.arguments_null; + n++; + + // comment + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.comment_value.data_ptr (); + b[n].capacity = i.comment_value.capacity (); + b[n].size = &i.comment_size; + b[n].is_null = &i.comment_null; + n++; + + // email + // + composite_value_traits< ::bpkg::email, id_pgsql >::bind ( + b + n, i.email_value, sk); + n += 2UL; + + // warning_email + // + composite_value_traits< ::bpkg::email, id_pgsql >::bind ( + b + n, i.warning_email_value, sk); + n += 2UL; + + // error_email + // + composite_value_traits< ::bpkg::email, id_pgsql >::bind ( + b + n, i.error_email_value, sk); + n += 2UL; + } + + bool access::composite_value_traits< ::brep::package_build_config, 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 + // + { + ::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 ()); + } + + // arguments + // + { + ::std::string const& v = + o.arguments; + + bool is_null (false); + std::size_t size (0); + std::size_t cap (i.arguments_value.capacity ()); + pgsql::value_traits< + ::std::string, + pgsql::id_string >::set_image ( + i.arguments_value, + size, + is_null, + v); + i.arguments_null = is_null; + i.arguments_size = size; + grew = grew || (cap != i.arguments_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 ()); + } + + // email + // + { + ::butl::optional< ::bpkg::email > const& v = + o.email; + + if (wrapper_traits< ::butl::optional< ::bpkg::email > >::get_null (v)) + composite_value_traits< ::bpkg::email, id_pgsql >::set_null ( + i.email_value, sk); + else + { + const::bpkg::email& vw = + wrapper_traits< ::butl::optional< ::bpkg::email > >::get_ref (v); + + if (composite_value_traits< ::bpkg::email, id_pgsql >::init ( + i.email_value, + vw, + sk)) + grew = true; + } + } + + // warning_email + // + { + ::butl::optional< ::bpkg::email > const& v = + o.warning_email; + + if (wrapper_traits< ::butl::optional< ::bpkg::email > >::get_null (v)) + composite_value_traits< ::bpkg::email, id_pgsql >::set_null ( + i.warning_email_value, sk); + else + { + const::bpkg::email& vw = + wrapper_traits< ::butl::optional< ::bpkg::email > >::get_ref (v); + + if (composite_value_traits< ::bpkg::email, id_pgsql >::init ( + i.warning_email_value, + vw, + sk)) + grew = true; + } + } + + // error_email + // + { + ::butl::optional< ::bpkg::email > const& v = + o.error_email; + + if (wrapper_traits< ::butl::optional< ::bpkg::email > >::get_null (v)) + composite_value_traits< ::bpkg::email, id_pgsql >::set_null ( + i.error_email_value, sk); + else + { + const::bpkg::email& vw = + wrapper_traits< ::butl::optional< ::bpkg::email > >::get_ref (v); + + if (composite_value_traits< ::bpkg::email, id_pgsql >::init ( + i.error_email_value, + vw, + sk)) + grew = true; + } + } + + return grew; + } + + void access::composite_value_traits< ::brep::package_build_config, 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 + // + { + ::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); + } + + // arguments + // + { + ::std::string& v = + o.arguments; + + pgsql::value_traits< + ::std::string, + pgsql::id_string >::set_value ( + v, + i.arguments_value, + i.arguments_size, + i.arguments_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); + } + + // email + // + { + ::butl::optional< ::bpkg::email >& v = + o.email; + + if (composite_value_traits< ::bpkg::email, id_pgsql >::get_null ( + i.email_value)) + wrapper_traits< ::butl::optional< ::bpkg::email > >::set_null (v); + else + { + ::bpkg::email& vw = + wrapper_traits< ::butl::optional< ::bpkg::email > >::set_ref (v); + + composite_value_traits< ::bpkg::email, id_pgsql >::init ( + vw, + i.email_value, + db); + } + } + + // warning_email + // + { + ::butl::optional< ::bpkg::email >& v = + o.warning_email; + + if (composite_value_traits< ::bpkg::email, id_pgsql >::get_null ( + i.warning_email_value)) + wrapper_traits< ::butl::optional< ::bpkg::email > >::set_null (v); + else + { + ::bpkg::email& vw = + wrapper_traits< ::butl::optional< ::bpkg::email > >::set_ref (v); + + composite_value_traits< ::bpkg::email, id_pgsql >::init ( + vw, + i.warning_email_value, + db); + } + } + + // error_email + // + { + ::butl::optional< ::bpkg::email >& v = + o.error_email; + + if (composite_value_traits< ::bpkg::email, id_pgsql >::get_null ( + i.error_email_value)) + wrapper_traits< ::butl::optional< ::bpkg::email > >::set_null (v); + else + { + ::bpkg::email& vw = + wrapper_traits< ::butl::optional< ::bpkg::email > >::set_ref (v); + + composite_value_traits< ::bpkg::email, id_pgsql >::init ( + vw, + i.error_email_value, + db); + } + } + } + + // package_build_bot_key_key + // + + bool access::composite_value_traits< ::brep::package_build_bot_key_key, id_pgsql >:: + grow (image_type& i, + bool* t) + { + ODB_POTENTIALLY_UNUSED (i); + ODB_POTENTIALLY_UNUSED (t); + + bool grew (false); + + // outer + // + t[0UL] = 0; + + // inner + // + t[1UL] = 0; + + return grew; + } + + void access::composite_value_traits< ::brep::package_build_bot_key_key, 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); + + // outer + // + b[n].type = pgsql::bind::bigint; + b[n].buffer = &i.outer_value; + b[n].is_null = &i.outer_null; + n++; + + // inner + // + b[n].type = pgsql::bind::bigint; + b[n].buffer = &i.inner_value; + b[n].is_null = &i.inner_null; + n++; + } + + bool access::composite_value_traits< ::brep::package_build_bot_key_key, 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); + + // outer + // + { + ::brep::package_build_bot_key_key::outer_type const& v = + o.outer; + + bool is_null (false); + pgsql::value_traits< + ::brep::package_build_bot_key_key::outer_type, + pgsql::id_bigint >::set_image ( + i.outer_value, is_null, v); + i.outer_null = is_null; + } + + // inner + // + { + ::brep::package_build_bot_key_key::inner_type const& v = + o.inner; + + bool is_null (false); + pgsql::value_traits< + ::brep::package_build_bot_key_key::inner_type, + pgsql::id_bigint >::set_image ( + i.inner_value, is_null, v); + i.inner_null = is_null; + } + + return grew; + } + + void access::composite_value_traits< ::brep::package_build_bot_key_key, id_pgsql >:: + init (value_type& o, + const image_type& i, + database* db) + { + ODB_POTENTIALLY_UNUSED (o); + ODB_POTENTIALLY_UNUSED (i); + ODB_POTENTIALLY_UNUSED (db); + + // outer + // + { + ::brep::package_build_bot_key_key::outer_type& v = + o.outer; + + pgsql::value_traits< + ::brep::package_build_bot_key_key::outer_type, + pgsql::id_bigint >::set_value ( + v, + i.outer_value, + i.outer_null); + } + + // inner + // + { + ::brep::package_build_bot_key_key::inner_type& v = + o.inner; + + pgsql::value_traits< + ::brep::package_build_bot_key_key::inner_type, + pgsql::id_bigint >::set_value ( + v, + i.inner_value, + i.inner_null); + } + } + + // _license_key + // + + bool access::composite_value_traits< ::brep::package::_license_key, id_pgsql >:: + grow (image_type& i, + bool* t) + { + ODB_POTENTIALLY_UNUSED (i); + ODB_POTENTIALLY_UNUSED (t); + + bool grew (false); + + // outer + // + t[0UL] = 0; + + // inner + // + t[1UL] = 0; + + return grew; + } + + void access::composite_value_traits< ::brep::package::_license_key, 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); + + // outer + // + b[n].type = pgsql::bind::bigint; + b[n].buffer = &i.outer_value; + b[n].is_null = &i.outer_null; + n++; + + // inner + // + b[n].type = pgsql::bind::bigint; + b[n].buffer = &i.inner_value; + b[n].is_null = &i.inner_null; + n++; + } + + bool access::composite_value_traits< ::brep::package::_license_key, 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); + + // outer + // + { + ::brep::package::_licenses_type::key_type::outer_type const& v = + o.outer; + + bool is_null (false); + pgsql::value_traits< + ::brep::package::_licenses_type::key_type::outer_type, + pgsql::id_bigint >::set_image ( + i.outer_value, is_null, v); + i.outer_null = is_null; + } + + // inner + // + { + ::brep::package::_licenses_type::key_type::inner_type const& v = + o.inner; + + bool is_null (false); + pgsql::value_traits< + ::brep::package::_licenses_type::key_type::inner_type, + pgsql::id_bigint >::set_image ( + i.inner_value, is_null, v); + i.inner_null = is_null; + } + + return grew; + } + + void access::composite_value_traits< ::brep::package::_license_key, id_pgsql >:: + init (value_type& o, + const image_type& i, + database* db) + { + ODB_POTENTIALLY_UNUSED (o); + ODB_POTENTIALLY_UNUSED (i); + ODB_POTENTIALLY_UNUSED (db); + + // outer + // + { + ::brep::package::_licenses_type::key_type::outer_type& v = + o.outer; + + pgsql::value_traits< + ::brep::package::_licenses_type::key_type::outer_type, + pgsql::id_bigint >::set_value ( + v, + i.outer_value, + i.outer_null); + } + + // inner + // + { + ::brep::package::_licenses_type::key_type::inner_type& v = + o.inner; + + pgsql::value_traits< + ::brep::package::_licenses_type::key_type::inner_type, + pgsql::id_bigint >::set_value ( + v, + i.inner_value, + i.inner_null); + } + } + + // _dependency_alternative_key + // + + bool access::composite_value_traits< ::brep::package::_dependency_alternative_key, id_pgsql >:: + grow (image_type& i, + bool* t) + { + ODB_POTENTIALLY_UNUSED (i); + ODB_POTENTIALLY_UNUSED (t); + + bool grew (false); + + // outer + // + t[0UL] = 0; + + // inner + // + t[1UL] = 0; + + return grew; + } + + void access::composite_value_traits< ::brep::package::_dependency_alternative_key, 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); + + // outer + // + b[n].type = pgsql::bind::bigint; + b[n].buffer = &i.outer_value; + b[n].is_null = &i.outer_null; + n++; + + // inner + // + b[n].type = pgsql::bind::bigint; + b[n].buffer = &i.inner_value; + b[n].is_null = &i.inner_null; + n++; + } + + bool access::composite_value_traits< ::brep::package::_dependency_alternative_key, 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); + + // outer + // + { + ::brep::package::_dependency_alternative_key::outer_type const& v = + o.outer; + + bool is_null (false); + pgsql::value_traits< + ::brep::package::_dependency_alternative_key::outer_type, + pgsql::id_bigint >::set_image ( + i.outer_value, is_null, v); + i.outer_null = is_null; + } + + // inner + // + { + ::brep::package::_dependency_alternative_key::inner_type const& v = + o.inner; + + bool is_null (false); + pgsql::value_traits< + ::brep::package::_dependency_alternative_key::inner_type, + pgsql::id_bigint >::set_image ( + i.inner_value, is_null, v); + i.inner_null = is_null; + } + + return grew; + } + + void access::composite_value_traits< ::brep::package::_dependency_alternative_key, id_pgsql >:: + init (value_type& o, + const image_type& i, + database* db) + { + ODB_POTENTIALLY_UNUSED (o); + ODB_POTENTIALLY_UNUSED (i); + ODB_POTENTIALLY_UNUSED (db); + + // outer + // + { + ::brep::package::_dependency_alternative_key::outer_type& v = + o.outer; + + pgsql::value_traits< + ::brep::package::_dependency_alternative_key::outer_type, + pgsql::id_bigint >::set_value ( + v, + i.outer_value, + i.outer_null); + } + + // inner + // + { + ::brep::package::_dependency_alternative_key::inner_type& v = + o.inner; + + pgsql::value_traits< + ::brep::package::_dependency_alternative_key::inner_type, + pgsql::id_bigint >::set_value ( + v, + i.inner_value, + i.inner_null); + } + } + + // _dependency_key + // + + bool access::composite_value_traits< ::brep::package::_dependency_key, id_pgsql >:: + grow (image_type& i, + bool* t) + { + ODB_POTENTIALLY_UNUSED (i); + ODB_POTENTIALLY_UNUSED (t); + + bool grew (false); + + // outer + // + t[0UL] = 0; + + // middle + // + t[1UL] = 0; + + // inner + // + t[2UL] = 0; + + return grew; + } + + void access::composite_value_traits< ::brep::package::_dependency_key, 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); + + // outer + // + b[n].type = pgsql::bind::bigint; + b[n].buffer = &i.outer_value; + b[n].is_null = &i.outer_null; + n++; + + // middle + // + b[n].type = pgsql::bind::bigint; + b[n].buffer = &i.middle_value; + b[n].is_null = &i.middle_null; + n++; + + // inner + // + b[n].type = pgsql::bind::bigint; + b[n].buffer = &i.inner_value; + b[n].is_null = &i.inner_null; + n++; + } + + bool access::composite_value_traits< ::brep::package::_dependency_key, 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); + + // outer + // + { + ::brep::package::_dependency_key::outer_type const& v = + o.outer; + + bool is_null (false); + pgsql::value_traits< + ::brep::package::_dependency_key::outer_type, + pgsql::id_bigint >::set_image ( + i.outer_value, is_null, v); + i.outer_null = is_null; + } + + // middle + // + { + ::brep::package::_dependency_key::middle_type const& v = + o.middle; + + bool is_null (false); + pgsql::value_traits< + ::brep::package::_dependency_key::middle_type, + pgsql::id_bigint >::set_image ( + i.middle_value, is_null, v); + i.middle_null = is_null; + } + + // inner + // + { + ::brep::package::_dependency_key::inner_type const& v = + o.inner; + + bool is_null (false); + pgsql::value_traits< + ::brep::package::_dependency_key::inner_type, + pgsql::id_bigint >::set_image ( + i.inner_value, is_null, v); + i.inner_null = is_null; + } + + return grew; + } + + void access::composite_value_traits< ::brep::package::_dependency_key, id_pgsql >:: + init (value_type& o, + const image_type& i, + database* db) + { + ODB_POTENTIALLY_UNUSED (o); + ODB_POTENTIALLY_UNUSED (i); + ODB_POTENTIALLY_UNUSED (db); + + // outer + // + { + ::brep::package::_dependency_key::outer_type& v = + o.outer; + + pgsql::value_traits< + ::brep::package::_dependency_key::outer_type, + pgsql::id_bigint >::set_value ( + v, + i.outer_value, + i.outer_null); + } + + // middle + // + { + ::brep::package::_dependency_key::middle_type& v = + o.middle; + + pgsql::value_traits< + ::brep::package::_dependency_key::middle_type, + pgsql::id_bigint >::set_value ( + v, + i.middle_value, + i.middle_null); + } + + // inner + // + { + ::brep::package::_dependency_key::inner_type& v = + o.inner; + + pgsql::value_traits< + ::brep::package::_dependency_key::inner_type, + pgsql::id_bigint >::set_value ( + v, + i.inner_value, + i.inner_null); + } + } + + // package + // + + const char access::object_traits_impl< ::brep::package, id_pgsql >:: + persist_statement_name[] = "persist_brep_package"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >:: + find_statement_name[] = "find_brep_package"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >:: + update_statement_name[] = "update_brep_package"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >:: + erase_statement_name[] = "erase_brep_package"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >:: + query_statement_name[] = "query_brep_package"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >:: + erase_query_statement_name[] = "erase_query_brep_package"; + + const unsigned int access::object_traits_impl< ::brep::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::int4_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::bool_oid, + pgsql::text_oid, + pgsql::bool_oid, + pgsql::text_oid + }; + + const unsigned int access::object_traits_impl< ::brep::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 unsigned int access::object_traits_impl< ::brep::package, id_pgsql >:: + update_statement_types[] = + { + pgsql::text_oid, + pgsql::text_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::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::bool_oid, + pgsql::text_oid, + pgsql::bool_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::int4_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::int4_oid + }; + + const char alias_traits< ::brep::repository, + id_pgsql, + access::object_traits_impl< ::brep::package, id_pgsql >::internal_repository_tag>:: + table_name[] = "\"internal_repository\""; + + struct access::object_traits_impl< ::brep::package, id_pgsql >::extra_statement_cache_type + { + pgsql::container_statements_impl< license_alternatives_traits > license_alternatives; + pgsql::container_statements_impl< licenses_traits > licenses; + pgsql::container_statements_impl< topics_traits > topics; + pgsql::container_statements_impl< keywords_traits > keywords; + pgsql::container_statements_impl< dependencies_traits > dependencies; + pgsql::container_statements_impl< dependency_alternatives_traits > dependency_alternatives; + pgsql::container_statements_impl< dependency_alternative_dependencies_traits > dependency_alternative_dependencies; + pgsql::container_statements_impl< requirements_traits > requirements; + pgsql::container_statements_impl< requirement_alternatives_traits > requirement_alternatives; + pgsql::container_statements_impl< requirement_alternative_requirements_traits > requirement_alternative_requirements; + pgsql::container_statements_impl< tests_traits > tests; + pgsql::container_statements_impl< builds_traits > builds; + pgsql::container_statements_impl< build_constraints_traits > build_constraints; + pgsql::container_statements_impl< build_auxiliaries_traits > build_auxiliaries; + pgsql::container_statements_impl< build_bot_keys_traits > build_bot_keys; + pgsql::container_statements_impl< build_configs_traits > build_configs; + pgsql::container_statements_impl< build_config_builds_traits > build_config_builds; + pgsql::container_statements_impl< build_config_constraints_traits > build_config_constraints; + pgsql::container_statements_impl< build_config_auxiliaries_traits > build_config_auxiliaries; + pgsql::container_statements_impl< build_config_bot_keys_traits > build_config_bot_keys; + pgsql::container_statements_impl< other_repositories_traits > other_repositories; + + pgsql::section_statements< ::brep::package, build_section_traits > build_section; + pgsql::section_statements< ::brep::package, unused_section_traits > unused_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) + : license_alternatives (c, id, idn, idt), + licenses (c, id, idn, idt), + topics (c, id, idn, idt), + keywords (c, id, idn, idt), + dependencies (c, id, idn, idt), + dependency_alternatives (c, id, idn, idt), + dependency_alternative_dependencies (c, id, idn, idt), + requirements (c, id, idn, idt), + requirement_alternatives (c, id, idn, idt), + requirement_alternative_requirements (c, id, idn, idt), + tests (c, id, idn, idt), + builds (c, id, idn, idt), + build_constraints (c, id, idn, idt), + build_auxiliaries (c, id, idn, idt), + build_bot_keys (c, id, idn, idt), + build_configs (c, id, idn, idt), + build_config_builds (c, id, idn, idt), + build_config_constraints (c, id, idn, idt), + build_config_auxiliaries (c, id, idn, idt), + build_config_bot_keys (c, id, idn, idt), + other_repositories (c, id, idn, idt), + build_section (c, im, idim, id, idv, idn, idt), + unused_section (c, im, idim, id, idv, idn, idt) + { + } + }; + + // license_alternatives + // + + const char access::object_traits_impl< ::brep::package, id_pgsql >::license_alternatives_traits:: + select_name[] = "select_brep_package_license_alternatives"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::license_alternatives_traits:: + insert_name[] = "insert_brep_package_license_alternatives"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::license_alternatives_traits:: + delete_name[] = "delete_brep_package_license_alternatives"; + + const unsigned int access::object_traits_impl< ::brep::package, id_pgsql >::license_alternatives_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 + }; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::license_alternatives_traits:: + select_statement[] = + "SELECT " + "\"package_license_alternatives\".\"index\", " + "\"package_license_alternatives\".\"comment\" " + "FROM \"package_license_alternatives\" " + "WHERE \"package_license_alternatives\".\"tenant\"=$1 AND \"package_license_alternatives\".\"name\"=$2::CITEXT AND \"package_license_alternatives\".\"version_epoch\"=$3 AND \"package_license_alternatives\".\"version_canonical_upstream\"=$4 AND \"package_license_alternatives\".\"version_canonical_release\"=$5 AND \"package_license_alternatives\".\"version_revision\"=$6 ORDER BY \"package_license_alternatives\".\"index\""; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::license_alternatives_traits:: + insert_statement[] = + "INSERT INTO \"package_license_alternatives\" " + "(\"tenant\", " + "\"name\", " + "\"version_epoch\", " + "\"version_canonical_upstream\", " + "\"version_canonical_release\", " + "\"version_revision\", " + "\"index\", " + "\"comment\") " + "VALUES " + "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8)"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::license_alternatives_traits:: + delete_statement[] = + "DELETE FROM \"package_license_alternatives\" " + "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::package, id_pgsql >::license_alternatives_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::package, id_pgsql >::license_alternatives_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::package, id_pgsql >::license_alternatives_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::package, id_pgsql >::license_alternatives_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::package, id_pgsql >::license_alternatives_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::package, id_pgsql >::license_alternatives_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::package, id_pgsql >::license_alternatives_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::package, id_pgsql >::license_alternatives_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::package, id_pgsql >::license_alternatives_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::package, id_pgsql >::license_alternatives_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::package, id_pgsql >::license_alternatives_traits:: + erase (statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + fs.ordered_ = true; + container_traits_type::erase (fs); + } + + // licenses + // + + const char access::object_traits_impl< ::brep::package, id_pgsql >::licenses_traits:: + select_name[] = "select_brep_package_licenses"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::licenses_traits:: + insert_name[] = "insert_brep_package_licenses"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::licenses_traits:: + delete_name[] = "delete_brep_package_licenses"; + + const unsigned int access::object_traits_impl< ::brep::package, id_pgsql >::licenses_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::int8_oid, + pgsql::text_oid + }; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::licenses_traits:: + select_statement[] = + "SELECT " + "\"package_licenses\".\"alternative_index\", " + "\"package_licenses\".\"index\", " + "\"package_licenses\".\"license\" " + "FROM \"package_licenses\" " + "WHERE \"package_licenses\".\"tenant\"=$1 AND \"package_licenses\".\"name\"=$2::CITEXT AND \"package_licenses\".\"version_epoch\"=$3 AND \"package_licenses\".\"version_canonical_upstream\"=$4 AND \"package_licenses\".\"version_canonical_release\"=$5 AND \"package_licenses\".\"version_revision\"=$6"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::licenses_traits:: + insert_statement[] = + "INSERT INTO \"package_licenses\" " + "(\"tenant\", " + "\"name\", " + "\"version_epoch\", " + "\"version_canonical_upstream\", " + "\"version_canonical_release\", " + "\"version_revision\", " + "\"alternative_index\", " + "\"index\", " + "\"license\") " + "VALUES " + "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8, $9)"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::licenses_traits:: + delete_statement[] = + "DELETE FROM \"package_licenses\" " + "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::package, id_pgsql >::licenses_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; + + // key + // + composite_value_traits< key_type, id_pgsql >::bind ( + b + n, d.key_value, sk); + n += 2UL; + + // value + // + b[n].type = pgsql::bind::text; + b[n].buffer = d.value_value.data_ptr (); + b[n].capacity = d.value_value.capacity (); + b[n].size = &d.value_size; + b[n].is_null = &d.value_null; + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::licenses_traits:: + grow (data_image_type& i, + bool* t) + { + bool grew (false); + + // key + // + if (composite_value_traits< key_type, id_pgsql >::grow ( + i.key_value, t + 0UL)) + grew = true; + + // value + // + if (t[2UL]) + { + i.value_value.capacity (i.value_size); + grew = true; + } + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::licenses_traits:: + init (data_image_type& i, + const key_type* k, + const value_type& v) + { + using namespace pgsql; + + statement_kind sk (statement_insert); + ODB_POTENTIALLY_UNUSED (sk); + + bool grew (false); + + // key + // + if (k != 0) + { + composite_value_traits< key_type, id_pgsql >::init ( + i.key_value, + *k, + sk); + } + + // value + // + { + bool is_null (false); + std::size_t size (0); + std::size_t cap (i.value_value.capacity ()); + pgsql::value_traits< + value_type, + 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 ()); + } + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::licenses_traits:: + init (key_type& k, + value_type& v, + const data_image_type& i, + database* db) + { + ODB_POTENTIALLY_UNUSED (db); + + // key + // + { + composite_value_traits< key_type, id_pgsql >::init ( + k, + i.key_value, + db); + } + + // value + // + { + pgsql::value_traits< + value_type, + pgsql::id_string >::set_value ( + v, + i.value_value, + i.value_size, + i.value_null); + } + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::licenses_traits:: + insert (const key_type& k, 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, &k, 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::package, id_pgsql >::licenses_traits:: + select (key_type& k, 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 (k, 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::package, id_pgsql >::licenses_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::package, id_pgsql >::licenses_traits:: + persist (const container_type& c, + statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::persist (c, fs); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::licenses_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 ()); + container_traits_type::load (c, more, fs); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::licenses_traits:: + update (const container_type& c, + statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::update (c, fs); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::licenses_traits:: + erase (statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::erase (fs); + } + + // topics + // + + const char access::object_traits_impl< ::brep::package, id_pgsql >::topics_traits:: + select_name[] = "select_brep_package_topics"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::topics_traits:: + insert_name[] = "insert_brep_package_topics"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::topics_traits:: + delete_name[] = "delete_brep_package_topics"; + + const unsigned int access::object_traits_impl< ::brep::package, id_pgsql >::topics_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 + }; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::topics_traits:: + select_statement[] = + "SELECT " + "\"package_topics\".\"index\", " + "\"package_topics\".\"topic\" " + "FROM \"package_topics\" " + "WHERE \"package_topics\".\"tenant\"=$1 AND \"package_topics\".\"name\"=$2::CITEXT AND \"package_topics\".\"version_epoch\"=$3 AND \"package_topics\".\"version_canonical_upstream\"=$4 AND \"package_topics\".\"version_canonical_release\"=$5 AND \"package_topics\".\"version_revision\"=$6 ORDER BY \"package_topics\".\"index\""; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::topics_traits:: + insert_statement[] = + "INSERT INTO \"package_topics\" " + "(\"tenant\", " + "\"name\", " + "\"version_epoch\", " + "\"version_canonical_upstream\", " + "\"version_canonical_release\", " + "\"version_revision\", " + "\"index\", " + "\"topic\") " + "VALUES " + "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8)"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::topics_traits:: + delete_statement[] = + "DELETE FROM \"package_topics\" " + "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::package, id_pgsql >::topics_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 + // + b[n].type = pgsql::bind::text; + b[n].buffer = d.value_value.data_ptr (); + b[n].capacity = d.value_value.capacity (); + b[n].size = &d.value_size; + b[n].is_null = &d.value_null; + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::topics_traits:: + grow (data_image_type& i, + bool* t) + { + bool grew (false); + + // index + // + t[0UL] = 0; + + // value + // + if (t[1UL]) + { + i.value_value.capacity (i.value_size); + grew = true; + } + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::topics_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 + // + { + bool is_null (false); + std::size_t size (0); + std::size_t cap (i.value_value.capacity ()); + pgsql::value_traits< + value_type, + 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 ()); + } + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::topics_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 + // + { + pgsql::value_traits< + value_type, + pgsql::id_string >::set_value ( + v, + i.value_value, + i.value_size, + i.value_null); + } + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::topics_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::package, id_pgsql >::topics_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::package, id_pgsql >::topics_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::package, id_pgsql >::topics_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::package, id_pgsql >::topics_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::package, id_pgsql >::topics_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::package, id_pgsql >::topics_traits:: + erase (statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + fs.ordered_ = true; + container_traits_type::erase (fs); + } + + // keywords + // + + const char access::object_traits_impl< ::brep::package, id_pgsql >::keywords_traits:: + select_name[] = "select_brep_package_keywords"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::keywords_traits:: + insert_name[] = "insert_brep_package_keywords"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::keywords_traits:: + delete_name[] = "delete_brep_package_keywords"; + + const unsigned int access::object_traits_impl< ::brep::package, id_pgsql >::keywords_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 + }; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::keywords_traits:: + select_statement[] = + "SELECT " + "\"package_keywords\".\"index\", " + "\"package_keywords\".\"keyword\" " + "FROM \"package_keywords\" " + "WHERE \"package_keywords\".\"tenant\"=$1 AND \"package_keywords\".\"name\"=$2::CITEXT AND \"package_keywords\".\"version_epoch\"=$3 AND \"package_keywords\".\"version_canonical_upstream\"=$4 AND \"package_keywords\".\"version_canonical_release\"=$5 AND \"package_keywords\".\"version_revision\"=$6 ORDER BY \"package_keywords\".\"index\""; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::keywords_traits:: + insert_statement[] = + "INSERT INTO \"package_keywords\" " + "(\"tenant\", " + "\"name\", " + "\"version_epoch\", " + "\"version_canonical_upstream\", " + "\"version_canonical_release\", " + "\"version_revision\", " + "\"index\", " + "\"keyword\") " + "VALUES " + "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8)"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::keywords_traits:: + delete_statement[] = + "DELETE FROM \"package_keywords\" " + "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::package, id_pgsql >::keywords_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 + // + b[n].type = pgsql::bind::text; + b[n].buffer = d.value_value.data_ptr (); + b[n].capacity = d.value_value.capacity (); + b[n].size = &d.value_size; + b[n].is_null = &d.value_null; + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::keywords_traits:: + grow (data_image_type& i, + bool* t) + { + bool grew (false); + + // index + // + t[0UL] = 0; + + // value + // + if (t[1UL]) + { + i.value_value.capacity (i.value_size); + grew = true; + } + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::keywords_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 + // + { + bool is_null (false); + std::size_t size (0); + std::size_t cap (i.value_value.capacity ()); + pgsql::value_traits< + value_type, + 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 ()); + } + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::keywords_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 + // + { + pgsql::value_traits< + value_type, + pgsql::id_string >::set_value ( + v, + i.value_value, + i.value_size, + i.value_null); + } + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::keywords_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::package, id_pgsql >::keywords_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::package, id_pgsql >::keywords_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::package, id_pgsql >::keywords_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::package, id_pgsql >::keywords_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::package, id_pgsql >::keywords_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::package, id_pgsql >::keywords_traits:: + erase (statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + fs.ordered_ = true; + container_traits_type::erase (fs); + } + + // dependencies + // + + const char access::object_traits_impl< ::brep::package, id_pgsql >::dependencies_traits:: + select_name[] = "select_brep_package_dependencies"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::dependencies_traits:: + insert_name[] = "insert_brep_package_dependencies"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::dependencies_traits:: + delete_name[] = "delete_brep_package_dependencies"; + + const unsigned int access::object_traits_impl< ::brep::package, id_pgsql >::dependencies_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 + }; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::dependencies_traits:: + select_statement[] = + "SELECT " + "\"package_dependencies\".\"index\", " + "\"package_dependencies\".\"buildtime\", " + "\"package_dependencies\".\"comment\" " + "FROM \"package_dependencies\" " + "WHERE \"package_dependencies\".\"tenant\"=$1 AND \"package_dependencies\".\"name\"=$2::CITEXT AND \"package_dependencies\".\"version_epoch\"=$3 AND \"package_dependencies\".\"version_canonical_upstream\"=$4 AND \"package_dependencies\".\"version_canonical_release\"=$5 AND \"package_dependencies\".\"version_revision\"=$6 ORDER BY \"package_dependencies\".\"index\""; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::dependencies_traits:: + insert_statement[] = + "INSERT INTO \"package_dependencies\" " + "(\"tenant\", " + "\"name\", " + "\"version_epoch\", " + "\"version_canonical_upstream\", " + "\"version_canonical_release\", " + "\"version_revision\", " + "\"index\", " + "\"buildtime\", " + "\"comment\") " + "VALUES " + "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8, $9)"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::dependencies_traits:: + delete_statement[] = + "DELETE FROM \"package_dependencies\" " + "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::package, id_pgsql >::dependencies_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::package, id_pgsql >::dependencies_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::package, id_pgsql >::dependencies_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::package, id_pgsql >::dependencies_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::package, id_pgsql >::dependencies_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::package, id_pgsql >::dependencies_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::package, id_pgsql >::dependencies_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::package, id_pgsql >::dependencies_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::package, id_pgsql >::dependencies_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::package, id_pgsql >::dependencies_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::package, id_pgsql >::dependencies_traits:: + erase (statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + fs.ordered_ = true; + container_traits_type::erase (fs); + } + + // dependency_alternatives + // + + const char access::object_traits_impl< ::brep::package, id_pgsql >::dependency_alternatives_traits:: + select_name[] = "select_brep_package_dependency_alternatives"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::dependency_alternatives_traits:: + insert_name[] = "insert_brep_package_dependency_alternatives"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::dependency_alternatives_traits:: + delete_name[] = "delete_brep_package_dependency_alternatives"; + + const unsigned int access::object_traits_impl< ::brep::package, id_pgsql >::dependency_alternatives_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::int8_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid + }; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::dependency_alternatives_traits:: + select_statement[] = + "SELECT " + "\"package_dependency_alternatives\".\"dependency_index\", " + "\"package_dependency_alternatives\".\"index\", " + "\"package_dependency_alternatives\".\"enable\", " + "\"package_dependency_alternatives\".\"reflect\", " + "\"package_dependency_alternatives\".\"prefer\", " + "\"package_dependency_alternatives\".\"accept\", " + "\"package_dependency_alternatives\".\"require\" " + "FROM \"package_dependency_alternatives\" " + "WHERE \"package_dependency_alternatives\".\"tenant\"=$1 AND \"package_dependency_alternatives\".\"name\"=$2::CITEXT AND \"package_dependency_alternatives\".\"version_epoch\"=$3 AND \"package_dependency_alternatives\".\"version_canonical_upstream\"=$4 AND \"package_dependency_alternatives\".\"version_canonical_release\"=$5 AND \"package_dependency_alternatives\".\"version_revision\"=$6"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::dependency_alternatives_traits:: + insert_statement[] = + "INSERT INTO \"package_dependency_alternatives\" " + "(\"tenant\", " + "\"name\", " + "\"version_epoch\", " + "\"version_canonical_upstream\", " + "\"version_canonical_release\", " + "\"version_revision\", " + "\"dependency_index\", " + "\"index\", " + "\"enable\", " + "\"reflect\", " + "\"prefer\", " + "\"accept\", " + "\"require\") " + "VALUES " + "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::dependency_alternatives_traits:: + delete_statement[] = + "DELETE FROM \"package_dependency_alternatives\" " + "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::package, id_pgsql >::dependency_alternatives_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; + + // key + // + composite_value_traits< key_type, id_pgsql >::bind ( + b + n, d.key_value, sk); + n += 2UL; + + // value + // + composite_value_traits< value_type, id_pgsql >::bind ( + b + n, d.value_value, sk); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::dependency_alternatives_traits:: + grow (data_image_type& i, + bool* t) + { + bool grew (false); + + // key + // + if (composite_value_traits< key_type, id_pgsql >::grow ( + i.key_value, t + 0UL)) + grew = true; + + // value + // + if (composite_value_traits< value_type, id_pgsql >::grow ( + i.value_value, t + 2UL)) + grew = true; + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::dependency_alternatives_traits:: + init (data_image_type& i, + const key_type* k, + const value_type& v) + { + using namespace pgsql; + + statement_kind sk (statement_insert); + ODB_POTENTIALLY_UNUSED (sk); + + bool grew (false); + + // key + // + if (k != 0) + { + composite_value_traits< key_type, id_pgsql >::init ( + i.key_value, + *k, + sk); + } + + // 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::package, id_pgsql >::dependency_alternatives_traits:: + init (key_type& k, + value_type& v, + const data_image_type& i, + database* db) + { + ODB_POTENTIALLY_UNUSED (db); + + // key + // + { + composite_value_traits< key_type, id_pgsql >::init ( + k, + i.key_value, + db); + } + + // value + // + { + composite_value_traits< value_type, id_pgsql >::init ( + v, + i.value_value, + db); + } + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::dependency_alternatives_traits:: + insert (const key_type& k, 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, &k, 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::package, id_pgsql >::dependency_alternatives_traits:: + select (key_type& k, 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 (k, 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::package, id_pgsql >::dependency_alternatives_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::package, id_pgsql >::dependency_alternatives_traits:: + persist (const container_type& c, + statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::persist (c, fs); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::dependency_alternatives_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 ()); + container_traits_type::load (c, more, fs); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::dependency_alternatives_traits:: + update (const container_type& c, + statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::update (c, fs); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::dependency_alternatives_traits:: + erase (statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::erase (fs); + } + + // dependency_alternative_dependencies + // + + const char access::object_traits_impl< ::brep::package, id_pgsql >::dependency_alternative_dependencies_traits:: + select_name[] = "select_brep_package_dependency_alternative_dependencies"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::dependency_alternative_dependencies_traits:: + insert_name[] = "insert_brep_package_dependency_alternative_dependencies"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::dependency_alternative_dependencies_traits:: + delete_name[] = "delete_brep_package_dependency_alternative_dependencies"; + + const unsigned int access::object_traits_impl< ::brep::package, id_pgsql >::dependency_alternative_dependencies_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::int8_oid, + pgsql::int8_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::bool_oid, + pgsql::bool_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::package, id_pgsql >::dependency_alternative_dependencies_traits:: + select_statement[] = + "SELECT " + "\"package_dependency_alternative_dependencies\".\"dependency_index\", " + "\"package_dependency_alternative_dependencies\".\"alternative_index\", " + "\"package_dependency_alternative_dependencies\".\"index\", " + "\"package_dependency_alternative_dependencies\".\"dep_name\"::TEXT, " + "\"package_dependency_alternative_dependencies\".\"dep_min_version_epoch\", " + "\"package_dependency_alternative_dependencies\".\"dep_min_version_canonical_upstream\", " + "\"package_dependency_alternative_dependencies\".\"dep_min_version_canonical_release\", " + "\"package_dependency_alternative_dependencies\".\"dep_min_version_revision\", " + "\"package_dependency_alternative_dependencies\".\"dep_min_version_upstream\", " + "\"package_dependency_alternative_dependencies\".\"dep_min_version_release\", " + "\"package_dependency_alternative_dependencies\".\"dep_max_version_epoch\", " + "\"package_dependency_alternative_dependencies\".\"dep_max_version_canonical_upstream\", " + "\"package_dependency_alternative_dependencies\".\"dep_max_version_canonical_release\", " + "\"package_dependency_alternative_dependencies\".\"dep_max_version_revision\", " + "\"package_dependency_alternative_dependencies\".\"dep_max_version_upstream\", " + "\"package_dependency_alternative_dependencies\".\"dep_max_version_release\", " + "\"package_dependency_alternative_dependencies\".\"dep_min_open\", " + "\"package_dependency_alternative_dependencies\".\"dep_max_open\", " + "\"package_dependency_alternative_dependencies\".\"dep_package_tenant\", " + "\"package_dependency_alternative_dependencies\".\"dep_package_name\"::TEXT, " + "\"package_dependency_alternative_dependencies\".\"dep_package_version_epoch\", " + "\"package_dependency_alternative_dependencies\".\"dep_package_version_canonical_upstream\", " + "\"package_dependency_alternative_dependencies\".\"dep_package_version_canonical_release\", " + "\"package_dependency_alternative_dependencies\".\"dep_package_version_revision\" " + "FROM \"package_dependency_alternative_dependencies\" " + "WHERE \"package_dependency_alternative_dependencies\".\"tenant\"=$1 AND \"package_dependency_alternative_dependencies\".\"name\"=$2::CITEXT AND \"package_dependency_alternative_dependencies\".\"version_epoch\"=$3 AND \"package_dependency_alternative_dependencies\".\"version_canonical_upstream\"=$4 AND \"package_dependency_alternative_dependencies\".\"version_canonical_release\"=$5 AND \"package_dependency_alternative_dependencies\".\"version_revision\"=$6"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::dependency_alternative_dependencies_traits:: + insert_statement[] = + "INSERT INTO \"package_dependency_alternative_dependencies\" " + "(\"tenant\", " + "\"name\", " + "\"version_epoch\", " + "\"version_canonical_upstream\", " + "\"version_canonical_release\", " + "\"version_revision\", " + "\"dependency_index\", " + "\"alternative_index\", " + "\"index\", " + "\"dep_name\", " + "\"dep_min_version_epoch\", " + "\"dep_min_version_canonical_upstream\", " + "\"dep_min_version_canonical_release\", " + "\"dep_min_version_revision\", " + "\"dep_min_version_upstream\", " + "\"dep_min_version_release\", " + "\"dep_max_version_epoch\", " + "\"dep_max_version_canonical_upstream\", " + "\"dep_max_version_canonical_release\", " + "\"dep_max_version_revision\", " + "\"dep_max_version_upstream\", " + "\"dep_max_version_release\", " + "\"dep_min_open\", " + "\"dep_max_open\", " + "\"dep_package_tenant\", " + "\"dep_package_name\", " + "\"dep_package_version_epoch\", " + "\"dep_package_version_canonical_upstream\", " + "\"dep_package_version_canonical_release\", " + "\"dep_package_version_revision\") " + "VALUES " + "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8, $9, $10::CITEXT, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26::CITEXT, $27, $28, $29, $30)"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::dependency_alternative_dependencies_traits:: + delete_statement[] = + "DELETE FROM \"package_dependency_alternative_dependencies\" " + "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::package, id_pgsql >::dependency_alternative_dependencies_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; + + // key + // + composite_value_traits< key_type, id_pgsql >::bind ( + b + n, d.key_value, sk); + n += 3UL; + + // value + // + composite_value_traits< value_type, id_pgsql >::bind ( + b + n, d.value_value, sk); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::dependency_alternative_dependencies_traits:: + grow (data_image_type& i, + bool* t) + { + bool grew (false); + + // key + // + if (composite_value_traits< key_type, id_pgsql >::grow ( + i.key_value, t + 0UL)) + grew = true; + + // value + // + if (composite_value_traits< value_type, id_pgsql >::grow ( + i.value_value, t + 3UL)) + grew = true; + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::dependency_alternative_dependencies_traits:: + init (data_image_type& i, + const key_type* k, + const value_type& v) + { + using namespace pgsql; + + statement_kind sk (statement_insert); + ODB_POTENTIALLY_UNUSED (sk); + + bool grew (false); + + // key + // + if (k != 0) + { + composite_value_traits< key_type, id_pgsql >::init ( + i.key_value, + *k, + sk); + } + + // 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::package, id_pgsql >::dependency_alternative_dependencies_traits:: + init (key_type& k, + value_type& v, + const data_image_type& i, + database* db) + { + ODB_POTENTIALLY_UNUSED (db); + + // key + // + { + composite_value_traits< key_type, id_pgsql >::init ( + k, + i.key_value, + db); + } + + // value + // + { + composite_value_traits< value_type, id_pgsql >::init ( + v, + i.value_value, + db); + } + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::dependency_alternative_dependencies_traits:: + insert (const key_type& k, 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, &k, 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::package, id_pgsql >::dependency_alternative_dependencies_traits:: + select (key_type& k, 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 (k, 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::package, id_pgsql >::dependency_alternative_dependencies_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::package, id_pgsql >::dependency_alternative_dependencies_traits:: + persist (const container_type& c, + statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::persist (c, fs); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::dependency_alternative_dependencies_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 ()); + container_traits_type::load (c, more, fs); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::dependency_alternative_dependencies_traits:: + update (const container_type& c, + statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::update (c, fs); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::dependency_alternative_dependencies_traits:: + erase (statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::erase (fs); + } + + // requirements + // + + const char access::object_traits_impl< ::brep::package, id_pgsql >::requirements_traits:: + select_name[] = "select_brep_package_requirements"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::requirements_traits:: + insert_name[] = "insert_brep_package_requirements"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::requirements_traits:: + delete_name[] = "delete_brep_package_requirements"; + + const unsigned int access::object_traits_impl< ::brep::package, id_pgsql >::requirements_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 + }; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::requirements_traits:: + select_statement[] = + "SELECT " + "\"package_requirements\".\"index\", " + "\"package_requirements\".\"buildtime\", " + "\"package_requirements\".\"comment\" " + "FROM \"package_requirements\" " + "WHERE \"package_requirements\".\"tenant\"=$1 AND \"package_requirements\".\"name\"=$2::CITEXT AND \"package_requirements\".\"version_epoch\"=$3 AND \"package_requirements\".\"version_canonical_upstream\"=$4 AND \"package_requirements\".\"version_canonical_release\"=$5 AND \"package_requirements\".\"version_revision\"=$6 ORDER BY \"package_requirements\".\"index\""; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::requirements_traits:: + insert_statement[] = + "INSERT INTO \"package_requirements\" " + "(\"tenant\", " + "\"name\", " + "\"version_epoch\", " + "\"version_canonical_upstream\", " + "\"version_canonical_release\", " + "\"version_revision\", " + "\"index\", " + "\"buildtime\", " + "\"comment\") " + "VALUES " + "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8, $9)"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::requirements_traits:: + delete_statement[] = + "DELETE FROM \"package_requirements\" " + "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::package, id_pgsql >::requirements_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::package, id_pgsql >::requirements_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::package, id_pgsql >::requirements_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::package, id_pgsql >::requirements_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::package, id_pgsql >::requirements_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::package, id_pgsql >::requirements_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::package, id_pgsql >::requirements_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::package, id_pgsql >::requirements_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::package, id_pgsql >::requirements_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::package, id_pgsql >::requirements_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::package, id_pgsql >::requirements_traits:: + erase (statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + fs.ordered_ = true; + container_traits_type::erase (fs); + } + + // requirement_alternatives + // + + const char access::object_traits_impl< ::brep::package, id_pgsql >::requirement_alternatives_traits:: + select_name[] = "select_brep_package_requirement_alternatives"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::requirement_alternatives_traits:: + insert_name[] = "insert_brep_package_requirement_alternatives"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::requirement_alternatives_traits:: + delete_name[] = "delete_brep_package_requirement_alternatives"; + + const unsigned int access::object_traits_impl< ::brep::package, id_pgsql >::requirement_alternatives_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::int8_oid, + pgsql::text_oid, + pgsql::text_oid + }; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::requirement_alternatives_traits:: + select_statement[] = + "SELECT " + "\"package_requirement_alternatives\".\"requirement_index\", " + "\"package_requirement_alternatives\".\"index\", " + "\"package_requirement_alternatives\".\"enable\", " + "\"package_requirement_alternatives\".\"reflect\" " + "FROM \"package_requirement_alternatives\" " + "WHERE \"package_requirement_alternatives\".\"tenant\"=$1 AND \"package_requirement_alternatives\".\"name\"=$2::CITEXT AND \"package_requirement_alternatives\".\"version_epoch\"=$3 AND \"package_requirement_alternatives\".\"version_canonical_upstream\"=$4 AND \"package_requirement_alternatives\".\"version_canonical_release\"=$5 AND \"package_requirement_alternatives\".\"version_revision\"=$6"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::requirement_alternatives_traits:: + insert_statement[] = + "INSERT INTO \"package_requirement_alternatives\" " + "(\"tenant\", " + "\"name\", " + "\"version_epoch\", " + "\"version_canonical_upstream\", " + "\"version_canonical_release\", " + "\"version_revision\", " + "\"requirement_index\", " + "\"index\", " + "\"enable\", " + "\"reflect\") " + "VALUES " + "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8, $9, $10)"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::requirement_alternatives_traits:: + delete_statement[] = + "DELETE FROM \"package_requirement_alternatives\" " + "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::package, id_pgsql >::requirement_alternatives_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; + + // key + // + composite_value_traits< key_type, id_pgsql >::bind ( + b + n, d.key_value, sk); + n += 2UL; + + // value + // + composite_value_traits< value_type, id_pgsql >::bind ( + b + n, d.value_value, sk); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::requirement_alternatives_traits:: + grow (data_image_type& i, + bool* t) + { + bool grew (false); + + // key + // + if (composite_value_traits< key_type, id_pgsql >::grow ( + i.key_value, t + 0UL)) + grew = true; + + // value + // + if (composite_value_traits< value_type, id_pgsql >::grow ( + i.value_value, t + 2UL)) + grew = true; + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::requirement_alternatives_traits:: + init (data_image_type& i, + const key_type* k, + const value_type& v) + { + using namespace pgsql; + + statement_kind sk (statement_insert); + ODB_POTENTIALLY_UNUSED (sk); + + bool grew (false); + + // key + // + if (k != 0) + { + composite_value_traits< key_type, id_pgsql >::init ( + i.key_value, + *k, + sk); + } + + // 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::package, id_pgsql >::requirement_alternatives_traits:: + init (key_type& k, + value_type& v, + const data_image_type& i, + database* db) + { + ODB_POTENTIALLY_UNUSED (db); + + // key + // + { + composite_value_traits< key_type, id_pgsql >::init ( + k, + i.key_value, + db); + } + + // value + // + { + composite_value_traits< value_type, id_pgsql >::init ( + v, + i.value_value, + db); + } + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::requirement_alternatives_traits:: + insert (const key_type& k, 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, &k, 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::package, id_pgsql >::requirement_alternatives_traits:: + select (key_type& k, 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 (k, 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::package, id_pgsql >::requirement_alternatives_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::package, id_pgsql >::requirement_alternatives_traits:: + persist (const container_type& c, + statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::persist (c, fs); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::requirement_alternatives_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 ()); + container_traits_type::load (c, more, fs); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::requirement_alternatives_traits:: + update (const container_type& c, + statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::update (c, fs); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::requirement_alternatives_traits:: + erase (statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::erase (fs); + } + + // requirement_alternative_requirements + // + + const char access::object_traits_impl< ::brep::package, id_pgsql >::requirement_alternative_requirements_traits:: + select_name[] = "select_brep_package_requirement_alternative_requirements"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::requirement_alternative_requirements_traits:: + insert_name[] = "insert_brep_package_requirement_alternative_requirements"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::requirement_alternative_requirements_traits:: + delete_name[] = "delete_brep_package_requirement_alternative_requirements"; + + const unsigned int access::object_traits_impl< ::brep::package, id_pgsql >::requirement_alternative_requirements_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::int8_oid, + pgsql::int8_oid, + pgsql::text_oid + }; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::requirement_alternative_requirements_traits:: + select_statement[] = + "SELECT " + "\"package_requirement_alternative_requirements\".\"requirement_index\", " + "\"package_requirement_alternative_requirements\".\"alternative_index\", " + "\"package_requirement_alternative_requirements\".\"index\", " + "\"package_requirement_alternative_requirements\".\"id\" " + "FROM \"package_requirement_alternative_requirements\" " + "WHERE \"package_requirement_alternative_requirements\".\"tenant\"=$1 AND \"package_requirement_alternative_requirements\".\"name\"=$2::CITEXT AND \"package_requirement_alternative_requirements\".\"version_epoch\"=$3 AND \"package_requirement_alternative_requirements\".\"version_canonical_upstream\"=$4 AND \"package_requirement_alternative_requirements\".\"version_canonical_release\"=$5 AND \"package_requirement_alternative_requirements\".\"version_revision\"=$6"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::requirement_alternative_requirements_traits:: + insert_statement[] = + "INSERT INTO \"package_requirement_alternative_requirements\" " + "(\"tenant\", " + "\"name\", " + "\"version_epoch\", " + "\"version_canonical_upstream\", " + "\"version_canonical_release\", " + "\"version_revision\", " + "\"requirement_index\", " + "\"alternative_index\", " + "\"index\", " + "\"id\") " + "VALUES " + "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8, $9, $10)"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::requirement_alternative_requirements_traits:: + delete_statement[] = + "DELETE FROM \"package_requirement_alternative_requirements\" " + "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::package, id_pgsql >::requirement_alternative_requirements_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; + + // key + // + composite_value_traits< key_type, id_pgsql >::bind ( + b + n, d.key_value, sk); + n += 3UL; + + // value + // + b[n].type = pgsql::bind::text; + b[n].buffer = d.value_value.data_ptr (); + b[n].capacity = d.value_value.capacity (); + b[n].size = &d.value_size; + b[n].is_null = &d.value_null; + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::requirement_alternative_requirements_traits:: + grow (data_image_type& i, + bool* t) + { + bool grew (false); + + // key + // + if (composite_value_traits< key_type, id_pgsql >::grow ( + i.key_value, t + 0UL)) + grew = true; + + // value + // + if (t[3UL]) + { + i.value_value.capacity (i.value_size); + grew = true; + } + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::requirement_alternative_requirements_traits:: + init (data_image_type& i, + const key_type* k, + const value_type& v) + { + using namespace pgsql; + + statement_kind sk (statement_insert); + ODB_POTENTIALLY_UNUSED (sk); + + bool grew (false); + + // key + // + if (k != 0) + { + composite_value_traits< key_type, id_pgsql >::init ( + i.key_value, + *k, + sk); + } + + // value + // + { + bool is_null (false); + std::size_t size (0); + std::size_t cap (i.value_value.capacity ()); + pgsql::value_traits< + value_type, + 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 ()); + } + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::requirement_alternative_requirements_traits:: + init (key_type& k, + value_type& v, + const data_image_type& i, + database* db) + { + ODB_POTENTIALLY_UNUSED (db); + + // key + // + { + composite_value_traits< key_type, id_pgsql >::init ( + k, + i.key_value, + db); + } + + // value + // + { + pgsql::value_traits< + value_type, + pgsql::id_string >::set_value ( + v, + i.value_value, + i.value_size, + i.value_null); + } + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::requirement_alternative_requirements_traits:: + insert (const key_type& k, 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, &k, 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::package, id_pgsql >::requirement_alternative_requirements_traits:: + select (key_type& k, 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 (k, 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::package, id_pgsql >::requirement_alternative_requirements_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::package, id_pgsql >::requirement_alternative_requirements_traits:: + persist (const container_type& c, + statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::persist (c, fs); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::requirement_alternative_requirements_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 ()); + container_traits_type::load (c, more, fs); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::requirement_alternative_requirements_traits:: + update (const container_type& c, + statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::update (c, fs); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::requirement_alternative_requirements_traits:: + erase (statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::erase (fs); + } + + // tests + // + + const char access::object_traits_impl< ::brep::package, id_pgsql >::tests_traits:: + select_name[] = "select_brep_package_tests"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::tests_traits:: + insert_name[] = "insert_brep_package_tests"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::tests_traits:: + delete_name[] = "delete_brep_package_tests"; + + const unsigned int access::object_traits_impl< ::brep::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::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::bool_oid, + pgsql::bool_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::int4_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::int4_oid, + pgsql::text_oid, + pgsql::bool_oid, + pgsql::text_oid, + pgsql::text_oid + }; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::tests_traits:: + select_statement[] = + "SELECT " + "\"package_tests\".\"index\", " + "\"package_tests\".\"test_name\"::TEXT, " + "\"package_tests\".\"test_min_version_epoch\", " + "\"package_tests\".\"test_min_version_canonical_upstream\", " + "\"package_tests\".\"test_min_version_canonical_release\", " + "\"package_tests\".\"test_min_version_revision\", " + "\"package_tests\".\"test_min_version_upstream\", " + "\"package_tests\".\"test_min_version_release\", " + "\"package_tests\".\"test_max_version_epoch\", " + "\"package_tests\".\"test_max_version_canonical_upstream\", " + "\"package_tests\".\"test_max_version_canonical_release\", " + "\"package_tests\".\"test_max_version_revision\", " + "\"package_tests\".\"test_max_version_upstream\", " + "\"package_tests\".\"test_max_version_release\", " + "\"package_tests\".\"test_min_open\", " + "\"package_tests\".\"test_max_open\", " + "\"package_tests\".\"test_package_tenant\", " + "\"package_tests\".\"test_package_name\"::TEXT, " + "\"package_tests\".\"test_package_version_epoch\", " + "\"package_tests\".\"test_package_version_canonical_upstream\", " + "\"package_tests\".\"test_package_version_canonical_release\", " + "\"package_tests\".\"test_package_version_revision\", " + "\"package_tests\".\"test_type\", " + "\"package_tests\".\"test_buildtime\", " + "\"package_tests\".\"test_enable\", " + "\"package_tests\".\"test_reflect\" " + "FROM \"package_tests\" " + "WHERE \"package_tests\".\"tenant\"=$1 AND \"package_tests\".\"name\"=$2::CITEXT AND \"package_tests\".\"version_epoch\"=$3 AND \"package_tests\".\"version_canonical_upstream\"=$4 AND \"package_tests\".\"version_canonical_release\"=$5 AND \"package_tests\".\"version_revision\"=$6 ORDER BY \"package_tests\".\"index\""; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::tests_traits:: + insert_statement[] = + "INSERT INTO \"package_tests\" " + "(\"tenant\", " + "\"name\", " + "\"version_epoch\", " + "\"version_canonical_upstream\", " + "\"version_canonical_release\", " + "\"version_revision\", " + "\"index\", " + "\"test_name\", " + "\"test_min_version_epoch\", " + "\"test_min_version_canonical_upstream\", " + "\"test_min_version_canonical_release\", " + "\"test_min_version_revision\", " + "\"test_min_version_upstream\", " + "\"test_min_version_release\", " + "\"test_max_version_epoch\", " + "\"test_max_version_canonical_upstream\", " + "\"test_max_version_canonical_release\", " + "\"test_max_version_revision\", " + "\"test_max_version_upstream\", " + "\"test_max_version_release\", " + "\"test_min_open\", " + "\"test_max_open\", " + "\"test_package_tenant\", " + "\"test_package_name\", " + "\"test_package_version_epoch\", " + "\"test_package_version_canonical_upstream\", " + "\"test_package_version_canonical_release\", " + "\"test_package_version_revision\", " + "\"test_type\", " + "\"test_buildtime\", " + "\"test_enable\", " + "\"test_reflect\") " + "VALUES " + "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8::CITEXT, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24::CITEXT, $25, $26, $27, $28, $29, $30, $31, $32)"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::tests_traits:: + delete_statement[] = + "DELETE FROM \"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::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::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::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::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::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::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::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::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::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::package, id_pgsql >::tests_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::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::package, id_pgsql >::builds_traits:: + select_name[] = "select_brep_package_builds"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::builds_traits:: + insert_name[] = "insert_brep_package_builds"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::builds_traits:: + delete_name[] = "delete_brep_package_builds"; + + const unsigned int access::object_traits_impl< ::brep::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::package, id_pgsql >::builds_traits:: + select_statement[] = + "SELECT " + "\"package_builds\".\"index\", " + "\"package_builds\".\"expression\", " + "\"package_builds\".\"comment\" " + "FROM \"package_builds\" " + "WHERE \"package_builds\".\"tenant\"=$1 AND \"package_builds\".\"name\"=$2::CITEXT AND \"package_builds\".\"version_epoch\"=$3 AND \"package_builds\".\"version_canonical_upstream\"=$4 AND \"package_builds\".\"version_canonical_release\"=$5 AND \"package_builds\".\"version_revision\"=$6 ORDER BY \"package_builds\".\"index\""; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::builds_traits:: + insert_statement[] = + "INSERT INTO \"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::package, id_pgsql >::builds_traits:: + delete_statement[] = + "DELETE FROM \"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::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::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::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::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::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::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::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::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::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::package, id_pgsql >::builds_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::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); + } + + // build_constraints + // + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_constraints_traits:: + select_name[] = "select_brep_package_build_constraints"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_constraints_traits:: + insert_name[] = "insert_brep_package_build_constraints"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_constraints_traits:: + delete_name[] = "delete_brep_package_build_constraints"; + + const unsigned int access::object_traits_impl< ::brep::package, id_pgsql >::build_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::package, id_pgsql >::build_constraints_traits:: + select_statement[] = + "SELECT " + "\"package_build_constraints\".\"index\", " + "\"package_build_constraints\".\"exclusion\", " + "\"package_build_constraints\".\"config\", " + "\"package_build_constraints\".\"target\", " + "\"package_build_constraints\".\"comment\" " + "FROM \"package_build_constraints\" " + "WHERE \"package_build_constraints\".\"tenant\"=$1 AND \"package_build_constraints\".\"name\"=$2::CITEXT AND \"package_build_constraints\".\"version_epoch\"=$3 AND \"package_build_constraints\".\"version_canonical_upstream\"=$4 AND \"package_build_constraints\".\"version_canonical_release\"=$5 AND \"package_build_constraints\".\"version_revision\"=$6 ORDER BY \"package_build_constraints\".\"index\""; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_constraints_traits:: + insert_statement[] = + "INSERT INTO \"package_build_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::package, id_pgsql >::build_constraints_traits:: + delete_statement[] = + "DELETE FROM \"package_build_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::package, id_pgsql >::build_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::package, id_pgsql >::build_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::package, id_pgsql >::build_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::package, id_pgsql >::build_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::package, id_pgsql >::build_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::package, id_pgsql >::build_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::package, id_pgsql >::build_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::package, id_pgsql >::build_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::package, id_pgsql >::build_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::package, id_pgsql >::build_constraints_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::package, id_pgsql >::build_constraints_traits:: + erase (statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + fs.ordered_ = true; + container_traits_type::erase (fs); + } + + // build_auxiliaries + // + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_auxiliaries_traits:: + select_name[] = "select_brep_package_build_auxiliaries"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_auxiliaries_traits:: + insert_name[] = "insert_brep_package_build_auxiliaries"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_auxiliaries_traits:: + delete_name[] = "delete_brep_package_build_auxiliaries"; + + const unsigned int access::object_traits_impl< ::brep::package, id_pgsql >::build_auxiliaries_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 + }; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_auxiliaries_traits:: + select_statement[] = + "SELECT " + "\"package_build_auxiliaries\".\"index\", " + "\"package_build_auxiliaries\".\"environment_name\", " + "\"package_build_auxiliaries\".\"config\", " + "\"package_build_auxiliaries\".\"comment\" " + "FROM \"package_build_auxiliaries\" " + "WHERE \"package_build_auxiliaries\".\"tenant\"=$1 AND \"package_build_auxiliaries\".\"name\"=$2::CITEXT AND \"package_build_auxiliaries\".\"version_epoch\"=$3 AND \"package_build_auxiliaries\".\"version_canonical_upstream\"=$4 AND \"package_build_auxiliaries\".\"version_canonical_release\"=$5 AND \"package_build_auxiliaries\".\"version_revision\"=$6 ORDER BY \"package_build_auxiliaries\".\"index\""; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_auxiliaries_traits:: + insert_statement[] = + "INSERT INTO \"package_build_auxiliaries\" " + "(\"tenant\", " + "\"name\", " + "\"version_epoch\", " + "\"version_canonical_upstream\", " + "\"version_canonical_release\", " + "\"version_revision\", " + "\"index\", " + "\"environment_name\", " + "\"config\", " + "\"comment\") " + "VALUES " + "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8, $9, $10)"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_auxiliaries_traits:: + delete_statement[] = + "DELETE FROM \"package_build_auxiliaries\" " + "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::package, id_pgsql >::build_auxiliaries_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::package, id_pgsql >::build_auxiliaries_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::package, id_pgsql >::build_auxiliaries_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::package, id_pgsql >::build_auxiliaries_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::package, id_pgsql >::build_auxiliaries_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::package, id_pgsql >::build_auxiliaries_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::package, id_pgsql >::build_auxiliaries_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::package, id_pgsql >::build_auxiliaries_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::package, id_pgsql >::build_auxiliaries_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::package, id_pgsql >::build_auxiliaries_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::package, id_pgsql >::build_auxiliaries_traits:: + erase (statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + fs.ordered_ = true; + container_traits_type::erase (fs); + } + + // build_bot_keys + // + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_bot_keys_traits:: + select_name[] = "select_brep_package_build_bot_keys"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_bot_keys_traits:: + insert_name[] = "insert_brep_package_build_bot_keys"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_bot_keys_traits:: + delete_name[] = "delete_brep_package_build_bot_keys"; + + const unsigned int access::object_traits_impl< ::brep::package, id_pgsql >::build_bot_keys_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::package, id_pgsql >::build_bot_keys_traits:: + select_statement[] = + "SELECT " + "\"package_build_bot_keys\".\"index\", " + "\"package_build_bot_keys\".\"key_tenant\", " + "\"package_build_bot_keys\".\"key_fingerprint\" " + "FROM \"package_build_bot_keys\" " + "WHERE \"package_build_bot_keys\".\"tenant\"=$1 AND \"package_build_bot_keys\".\"name\"=$2::CITEXT AND \"package_build_bot_keys\".\"version_epoch\"=$3 AND \"package_build_bot_keys\".\"version_canonical_upstream\"=$4 AND \"package_build_bot_keys\".\"version_canonical_release\"=$5 AND \"package_build_bot_keys\".\"version_revision\"=$6 ORDER BY \"package_build_bot_keys\".\"index\""; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_bot_keys_traits:: + insert_statement[] = + "INSERT INTO \"package_build_bot_keys\" " + "(\"tenant\", " + "\"name\", " + "\"version_epoch\", " + "\"version_canonical_upstream\", " + "\"version_canonical_release\", " + "\"version_revision\", " + "\"index\", " + "\"key_tenant\", " + "\"key_fingerprint\") " + "VALUES " + "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8, $9)"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_bot_keys_traits:: + delete_statement[] = + "DELETE FROM \"package_build_bot_keys\" " + "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::package, id_pgsql >::build_bot_keys_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< ::brep::public_key_id, id_pgsql >::bind ( + b + n, d.value_value, sk); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::build_bot_keys_traits:: + grow (data_image_type& i, + bool* t) + { + bool grew (false); + + // index + // + t[0UL] = 0; + + // value + // + if (composite_value_traits< ::brep::public_key_id, id_pgsql >::grow ( + i.value_value, t + 1UL)) + grew = true; + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::build_bot_keys_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 + // + { + typedef object_traits< ::brep::public_key > obj_traits; + typedef odb::pointer_traits< value_type > 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.value_value, + ptr_id, + sk)) + grew = true; + } + else + throw null_pointer (); + } + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::build_bot_keys_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 + // + { + typedef object_traits< ::brep::public_key > obj_traits; + typedef odb::pointer_traits< value_type > ptr_traits; + + if (composite_value_traits< obj_traits::id_type, id_pgsql >::get_null ( + i.value_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.value_value, + db); + + v = ptr_traits::pointer_type ( + *static_cast<pgsql::database*> (db), ptr_id); + } + } + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::build_bot_keys_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::package, id_pgsql >::build_bot_keys_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::package, id_pgsql >::build_bot_keys_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::package, id_pgsql >::build_bot_keys_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::package, id_pgsql >::build_bot_keys_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::package, id_pgsql >::build_bot_keys_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::package, id_pgsql >::build_bot_keys_traits:: + erase (statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + fs.ordered_ = true; + container_traits_type::erase (fs); + } + + // build_configs + // + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_configs_traits:: + select_name[] = "select_brep_package_build_configs"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_configs_traits:: + insert_name[] = "insert_brep_package_build_configs"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_configs_traits:: + delete_name[] = "delete_brep_package_build_configs"; + + const unsigned int access::object_traits_impl< ::brep::package, id_pgsql >::build_configs_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::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid + }; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_configs_traits:: + select_statement[] = + "SELECT " + "\"package_build_configs\".\"index\", " + "\"package_build_configs\".\"config_name\", " + "\"package_build_configs\".\"config_arguments\", " + "\"package_build_configs\".\"config_comment\", " + "\"package_build_configs\".\"config_email\", " + "\"package_build_configs\".\"config_email_comment\", " + "\"package_build_configs\".\"config_warning_email\", " + "\"package_build_configs\".\"config_warning_email_comment\", " + "\"package_build_configs\".\"config_error_email\", " + "\"package_build_configs\".\"config_error_email_comment\" " + "FROM \"package_build_configs\" " + "WHERE \"package_build_configs\".\"tenant\"=$1 AND \"package_build_configs\".\"name\"=$2::CITEXT AND \"package_build_configs\".\"version_epoch\"=$3 AND \"package_build_configs\".\"version_canonical_upstream\"=$4 AND \"package_build_configs\".\"version_canonical_release\"=$5 AND \"package_build_configs\".\"version_revision\"=$6 ORDER BY \"package_build_configs\".\"index\""; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_configs_traits:: + insert_statement[] = + "INSERT INTO \"package_build_configs\" " + "(\"tenant\", " + "\"name\", " + "\"version_epoch\", " + "\"version_canonical_upstream\", " + "\"version_canonical_release\", " + "\"version_revision\", " + "\"index\", " + "\"config_name\", " + "\"config_arguments\", " + "\"config_comment\", " + "\"config_email\", " + "\"config_email_comment\", " + "\"config_warning_email\", " + "\"config_warning_email_comment\", " + "\"config_error_email\", " + "\"config_error_email_comment\") " + "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::package, id_pgsql >::build_configs_traits:: + delete_statement[] = + "DELETE FROM \"package_build_configs\" " + "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::package, id_pgsql >::build_configs_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::package, id_pgsql >::build_configs_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::package, id_pgsql >::build_configs_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::package, id_pgsql >::build_configs_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::package, id_pgsql >::build_configs_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::package, id_pgsql >::build_configs_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::package, id_pgsql >::build_configs_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::package, id_pgsql >::build_configs_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::package, id_pgsql >::build_configs_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::package, id_pgsql >::build_configs_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::package, id_pgsql >::build_configs_traits:: + erase (statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + fs.ordered_ = true; + container_traits_type::erase (fs); + } + + // build_config_builds + // + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_config_builds_traits:: + select_name[] = "select_brep_package_build_config_builds"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_config_builds_traits:: + insert_name[] = "insert_brep_package_build_config_builds"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_config_builds_traits:: + delete_name[] = "delete_brep_package_build_config_builds"; + + const unsigned int access::object_traits_impl< ::brep::package, id_pgsql >::build_config_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::int8_oid, + pgsql::text_oid, + pgsql::text_oid + }; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_config_builds_traits:: + select_statement[] = + "SELECT " + "\"package_build_config_builds\".\"config_index\", " + "\"package_build_config_builds\".\"index\", " + "\"package_build_config_builds\".\"expression\", " + "\"package_build_config_builds\".\"comment\" " + "FROM \"package_build_config_builds\" " + "WHERE \"package_build_config_builds\".\"tenant\"=$1 AND \"package_build_config_builds\".\"name\"=$2::CITEXT AND \"package_build_config_builds\".\"version_epoch\"=$3 AND \"package_build_config_builds\".\"version_canonical_upstream\"=$4 AND \"package_build_config_builds\".\"version_canonical_release\"=$5 AND \"package_build_config_builds\".\"version_revision\"=$6"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_config_builds_traits:: + insert_statement[] = + "INSERT INTO \"package_build_config_builds\" " + "(\"tenant\", " + "\"name\", " + "\"version_epoch\", " + "\"version_canonical_upstream\", " + "\"version_canonical_release\", " + "\"version_revision\", " + "\"config_index\", " + "\"index\", " + "\"expression\", " + "\"comment\") " + "VALUES " + "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8, $9, $10)"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_config_builds_traits:: + delete_statement[] = + "DELETE FROM \"package_build_config_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::package, id_pgsql >::build_config_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; + + // key + // + composite_value_traits< key_type, id_pgsql >::bind ( + b + n, d.key_value, sk); + n += 2UL; + + // value + // + composite_value_traits< value_type, id_pgsql >::bind ( + b + n, d.value_value, sk); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::build_config_builds_traits:: + grow (data_image_type& i, + bool* t) + { + bool grew (false); + + // key + // + if (composite_value_traits< key_type, id_pgsql >::grow ( + i.key_value, t + 0UL)) + grew = true; + + // value + // + if (composite_value_traits< value_type, id_pgsql >::grow ( + i.value_value, t + 2UL)) + grew = true; + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::build_config_builds_traits:: + init (data_image_type& i, + const key_type* k, + const value_type& v) + { + using namespace pgsql; + + statement_kind sk (statement_insert); + ODB_POTENTIALLY_UNUSED (sk); + + bool grew (false); + + // key + // + if (k != 0) + { + composite_value_traits< key_type, id_pgsql >::init ( + i.key_value, + *k, + sk); + } + + // 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::package, id_pgsql >::build_config_builds_traits:: + init (key_type& k, + value_type& v, + const data_image_type& i, + database* db) + { + ODB_POTENTIALLY_UNUSED (db); + + // key + // + { + composite_value_traits< key_type, id_pgsql >::init ( + k, + i.key_value, + db); + } + + // value + // + { + composite_value_traits< value_type, id_pgsql >::init ( + v, + i.value_value, + db); + } + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::build_config_builds_traits:: + insert (const key_type& k, 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, &k, 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::package, id_pgsql >::build_config_builds_traits:: + select (key_type& k, 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 (k, 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::package, id_pgsql >::build_config_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::package, id_pgsql >::build_config_builds_traits:: + persist (const container_type& c, + statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::persist (c, fs); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::build_config_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 ()); + container_traits_type::load (c, more, fs); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::build_config_builds_traits:: + update (const container_type& c, + statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::update (c, fs); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::build_config_builds_traits:: + erase (statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::erase (fs); + } + + // build_config_constraints + // + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_config_constraints_traits:: + select_name[] = "select_brep_package_build_config_constraints"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_config_constraints_traits:: + insert_name[] = "insert_brep_package_build_config_constraints"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_config_constraints_traits:: + delete_name[] = "delete_brep_package_build_config_constraints"; + + const unsigned int access::object_traits_impl< ::brep::package, id_pgsql >::build_config_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::int8_oid, + pgsql::bool_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid + }; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_config_constraints_traits:: + select_statement[] = + "SELECT " + "\"package_build_config_constraints\".\"config_index\", " + "\"package_build_config_constraints\".\"index\", " + "\"package_build_config_constraints\".\"exclusion\", " + "\"package_build_config_constraints\".\"config\", " + "\"package_build_config_constraints\".\"target\", " + "\"package_build_config_constraints\".\"comment\" " + "FROM \"package_build_config_constraints\" " + "WHERE \"package_build_config_constraints\".\"tenant\"=$1 AND \"package_build_config_constraints\".\"name\"=$2::CITEXT AND \"package_build_config_constraints\".\"version_epoch\"=$3 AND \"package_build_config_constraints\".\"version_canonical_upstream\"=$4 AND \"package_build_config_constraints\".\"version_canonical_release\"=$5 AND \"package_build_config_constraints\".\"version_revision\"=$6"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_config_constraints_traits:: + insert_statement[] = + "INSERT INTO \"package_build_config_constraints\" " + "(\"tenant\", " + "\"name\", " + "\"version_epoch\", " + "\"version_canonical_upstream\", " + "\"version_canonical_release\", " + "\"version_revision\", " + "\"config_index\", " + "\"index\", " + "\"exclusion\", " + "\"config\", " + "\"target\", " + "\"comment\") " + "VALUES " + "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_config_constraints_traits:: + delete_statement[] = + "DELETE FROM \"package_build_config_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::package, id_pgsql >::build_config_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; + + // key + // + composite_value_traits< key_type, id_pgsql >::bind ( + b + n, d.key_value, sk); + n += 2UL; + + // value + // + composite_value_traits< value_type, id_pgsql >::bind ( + b + n, d.value_value, sk); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::build_config_constraints_traits:: + grow (data_image_type& i, + bool* t) + { + bool grew (false); + + // key + // + if (composite_value_traits< key_type, id_pgsql >::grow ( + i.key_value, t + 0UL)) + grew = true; + + // value + // + if (composite_value_traits< value_type, id_pgsql >::grow ( + i.value_value, t + 2UL)) + grew = true; + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::build_config_constraints_traits:: + init (data_image_type& i, + const key_type* k, + const value_type& v) + { + using namespace pgsql; + + statement_kind sk (statement_insert); + ODB_POTENTIALLY_UNUSED (sk); + + bool grew (false); + + // key + // + if (k != 0) + { + composite_value_traits< key_type, id_pgsql >::init ( + i.key_value, + *k, + sk); + } + + // 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::package, id_pgsql >::build_config_constraints_traits:: + init (key_type& k, + value_type& v, + const data_image_type& i, + database* db) + { + ODB_POTENTIALLY_UNUSED (db); + + // key + // + { + composite_value_traits< key_type, id_pgsql >::init ( + k, + i.key_value, + db); + } + + // value + // + { + composite_value_traits< value_type, id_pgsql >::init ( + v, + i.value_value, + db); + } + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::build_config_constraints_traits:: + insert (const key_type& k, 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, &k, 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::package, id_pgsql >::build_config_constraints_traits:: + select (key_type& k, 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 (k, 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::package, id_pgsql >::build_config_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::package, id_pgsql >::build_config_constraints_traits:: + persist (const container_type& c, + statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::persist (c, fs); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::build_config_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 ()); + container_traits_type::load (c, more, fs); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::build_config_constraints_traits:: + update (const container_type& c, + statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::update (c, fs); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::build_config_constraints_traits:: + erase (statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::erase (fs); + } + + // build_config_auxiliaries + // + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_config_auxiliaries_traits:: + select_name[] = "select_brep_package_build_config_auxiliaries"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_config_auxiliaries_traits:: + insert_name[] = "insert_brep_package_build_config_auxiliaries"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_config_auxiliaries_traits:: + delete_name[] = "delete_brep_package_build_config_auxiliaries"; + + const unsigned int access::object_traits_impl< ::brep::package, id_pgsql >::build_config_auxiliaries_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::int8_oid, + pgsql::text_oid, + pgsql::text_oid, + pgsql::text_oid + }; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_config_auxiliaries_traits:: + select_statement[] = + "SELECT " + "\"package_build_config_auxiliaries\".\"config_index\", " + "\"package_build_config_auxiliaries\".\"index\", " + "\"package_build_config_auxiliaries\".\"environment_name\", " + "\"package_build_config_auxiliaries\".\"config\", " + "\"package_build_config_auxiliaries\".\"comment\" " + "FROM \"package_build_config_auxiliaries\" " + "WHERE \"package_build_config_auxiliaries\".\"tenant\"=$1 AND \"package_build_config_auxiliaries\".\"name\"=$2::CITEXT AND \"package_build_config_auxiliaries\".\"version_epoch\"=$3 AND \"package_build_config_auxiliaries\".\"version_canonical_upstream\"=$4 AND \"package_build_config_auxiliaries\".\"version_canonical_release\"=$5 AND \"package_build_config_auxiliaries\".\"version_revision\"=$6"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_config_auxiliaries_traits:: + insert_statement[] = + "INSERT INTO \"package_build_config_auxiliaries\" " + "(\"tenant\", " + "\"name\", " + "\"version_epoch\", " + "\"version_canonical_upstream\", " + "\"version_canonical_release\", " + "\"version_revision\", " + "\"config_index\", " + "\"index\", " + "\"environment_name\", " + "\"config\", " + "\"comment\") " + "VALUES " + "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8, $9, $10, $11)"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_config_auxiliaries_traits:: + delete_statement[] = + "DELETE FROM \"package_build_config_auxiliaries\" " + "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::package, id_pgsql >::build_config_auxiliaries_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; + + // key + // + composite_value_traits< key_type, id_pgsql >::bind ( + b + n, d.key_value, sk); + n += 2UL; + + // value + // + composite_value_traits< value_type, id_pgsql >::bind ( + b + n, d.value_value, sk); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::build_config_auxiliaries_traits:: + grow (data_image_type& i, + bool* t) + { + bool grew (false); + + // key + // + if (composite_value_traits< key_type, id_pgsql >::grow ( + i.key_value, t + 0UL)) + grew = true; + + // value + // + if (composite_value_traits< value_type, id_pgsql >::grow ( + i.value_value, t + 2UL)) + grew = true; + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::build_config_auxiliaries_traits:: + init (data_image_type& i, + const key_type* k, + const value_type& v) + { + using namespace pgsql; + + statement_kind sk (statement_insert); + ODB_POTENTIALLY_UNUSED (sk); + + bool grew (false); + + // key + // + if (k != 0) + { + composite_value_traits< key_type, id_pgsql >::init ( + i.key_value, + *k, + sk); + } + + // 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::package, id_pgsql >::build_config_auxiliaries_traits:: + init (key_type& k, + value_type& v, + const data_image_type& i, + database* db) + { + ODB_POTENTIALLY_UNUSED (db); + + // key + // + { + composite_value_traits< key_type, id_pgsql >::init ( + k, + i.key_value, + db); + } + + // value + // + { + composite_value_traits< value_type, id_pgsql >::init ( + v, + i.value_value, + db); + } + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::build_config_auxiliaries_traits:: + insert (const key_type& k, 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, &k, 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::package, id_pgsql >::build_config_auxiliaries_traits:: + select (key_type& k, 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 (k, 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::package, id_pgsql >::build_config_auxiliaries_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::package, id_pgsql >::build_config_auxiliaries_traits:: + persist (const container_type& c, + statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::persist (c, fs); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::build_config_auxiliaries_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 ()); + container_traits_type::load (c, more, fs); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::build_config_auxiliaries_traits:: + update (const container_type& c, + statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::update (c, fs); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::build_config_auxiliaries_traits:: + erase (statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::erase (fs); + } + + // build_config_bot_keys + // + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_config_bot_keys_traits:: + select_name[] = "select_brep_package_build_config_bot_keys"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_config_bot_keys_traits:: + insert_name[] = "insert_brep_package_build_config_bot_keys"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_config_bot_keys_traits:: + delete_name[] = "delete_brep_package_build_config_bot_keys"; + + const unsigned int access::object_traits_impl< ::brep::package, id_pgsql >::build_config_bot_keys_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::int8_oid, + pgsql::text_oid, + pgsql::text_oid + }; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_config_bot_keys_traits:: + select_statement[] = + "SELECT " + "\"package_build_config_bot_keys\".\"config_index\", " + "\"package_build_config_bot_keys\".\"index\", " + "\"package_build_config_bot_keys\".\"key_tenant\", " + "\"package_build_config_bot_keys\".\"key_fingerprint\" " + "FROM \"package_build_config_bot_keys\" " + "WHERE \"package_build_config_bot_keys\".\"tenant\"=$1 AND \"package_build_config_bot_keys\".\"name\"=$2::CITEXT AND \"package_build_config_bot_keys\".\"version_epoch\"=$3 AND \"package_build_config_bot_keys\".\"version_canonical_upstream\"=$4 AND \"package_build_config_bot_keys\".\"version_canonical_release\"=$5 AND \"package_build_config_bot_keys\".\"version_revision\"=$6"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_config_bot_keys_traits:: + insert_statement[] = + "INSERT INTO \"package_build_config_bot_keys\" " + "(\"tenant\", " + "\"name\", " + "\"version_epoch\", " + "\"version_canonical_upstream\", " + "\"version_canonical_release\", " + "\"version_revision\", " + "\"config_index\", " + "\"index\", " + "\"key_tenant\", " + "\"key_fingerprint\") " + "VALUES " + "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8, $9, $10)"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::build_config_bot_keys_traits:: + delete_statement[] = + "DELETE FROM \"package_build_config_bot_keys\" " + "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::package, id_pgsql >::build_config_bot_keys_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; + + // key + // + composite_value_traits< key_type, id_pgsql >::bind ( + b + n, d.key_value, sk); + n += 2UL; + + // value + // + composite_value_traits< ::brep::public_key_id, id_pgsql >::bind ( + b + n, d.value_value, sk); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::build_config_bot_keys_traits:: + grow (data_image_type& i, + bool* t) + { + bool grew (false); + + // key + // + if (composite_value_traits< key_type, id_pgsql >::grow ( + i.key_value, t + 0UL)) + grew = true; + + // value + // + if (composite_value_traits< ::brep::public_key_id, id_pgsql >::grow ( + i.value_value, t + 2UL)) + grew = true; + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::build_config_bot_keys_traits:: + init (data_image_type& i, + const key_type* k, + const value_type& v) + { + using namespace pgsql; + + statement_kind sk (statement_insert); + ODB_POTENTIALLY_UNUSED (sk); + + bool grew (false); + + // key + // + if (k != 0) + { + composite_value_traits< key_type, id_pgsql >::init ( + i.key_value, + *k, + sk); + } + + // value + // + { + typedef object_traits< ::brep::public_key > obj_traits; + typedef odb::pointer_traits< value_type > 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.value_value, + ptr_id, + sk)) + grew = true; + } + else + throw null_pointer (); + } + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::build_config_bot_keys_traits:: + init (key_type& k, + value_type& v, + const data_image_type& i, + database* db) + { + ODB_POTENTIALLY_UNUSED (db); + + // key + // + { + composite_value_traits< key_type, id_pgsql >::init ( + k, + i.key_value, + db); + } + + // value + // + { + typedef object_traits< ::brep::public_key > obj_traits; + typedef odb::pointer_traits< value_type > ptr_traits; + + if (composite_value_traits< obj_traits::id_type, id_pgsql >::get_null ( + i.value_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.value_value, + db); + + v = ptr_traits::pointer_type ( + *static_cast<pgsql::database*> (db), ptr_id); + } + } + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::build_config_bot_keys_traits:: + insert (const key_type& k, 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, &k, 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::package, id_pgsql >::build_config_bot_keys_traits:: + select (key_type& k, 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 (k, 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::package, id_pgsql >::build_config_bot_keys_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::package, id_pgsql >::build_config_bot_keys_traits:: + persist (const container_type& c, + statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::persist (c, fs); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::build_config_bot_keys_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 ()); + container_traits_type::load (c, more, fs); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::build_config_bot_keys_traits:: + update (const container_type& c, + statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::update (c, fs); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::build_config_bot_keys_traits:: + erase (statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + container_traits_type::erase (fs); + } + + // other_repositories + // + + const char access::object_traits_impl< ::brep::package, id_pgsql >::other_repositories_traits:: + select_name[] = "select_brep_package_other_repositories"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::other_repositories_traits:: + insert_name[] = "insert_brep_package_other_repositories"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::other_repositories_traits:: + delete_name[] = "delete_brep_package_other_repositories"; + + const unsigned int access::object_traits_impl< ::brep::package, id_pgsql >::other_repositories_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::package, id_pgsql >::other_repositories_traits:: + select_statement[] = + "SELECT " + "\"package_other_repositories\".\"index\", " + "\"package_other_repositories\".\"repository_tenant\", " + "\"package_other_repositories\".\"repository_canonical_name\" " + "FROM \"package_other_repositories\" " + "WHERE \"package_other_repositories\".\"tenant\"=$1 AND \"package_other_repositories\".\"name\"=$2::CITEXT AND \"package_other_repositories\".\"version_epoch\"=$3 AND \"package_other_repositories\".\"version_canonical_upstream\"=$4 AND \"package_other_repositories\".\"version_canonical_release\"=$5 AND \"package_other_repositories\".\"version_revision\"=$6 ORDER BY \"package_other_repositories\".\"index\""; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::other_repositories_traits:: + insert_statement[] = + "INSERT INTO \"package_other_repositories\" " + "(\"tenant\", " + "\"name\", " + "\"version_epoch\", " + "\"version_canonical_upstream\", " + "\"version_canonical_release\", " + "\"version_revision\", " + "\"index\", " + "\"repository_tenant\", " + "\"repository_canonical_name\") " + "VALUES " + "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8, $9)"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::other_repositories_traits:: + delete_statement[] = + "DELETE FROM \"package_other_repositories\" " + "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::package, id_pgsql >::other_repositories_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< ::brep::repository_id, id_pgsql >::bind ( + b + n, d.value_value, sk); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::other_repositories_traits:: + grow (data_image_type& i, + bool* t) + { + bool grew (false); + + // index + // + t[0UL] = 0; + + // value + // + if (composite_value_traits< ::brep::repository_id, id_pgsql >::grow ( + i.value_value, t + 1UL)) + grew = true; + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::other_repositories_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 + // + { + typedef object_traits< ::brep::repository > obj_traits; + typedef odb::pointer_traits< value_type > 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.value_value, + ptr_id, + sk)) + grew = true; + } + else + throw null_pointer (); + } + + if (grew) + i.version++; + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::other_repositories_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 + // + { + typedef object_traits< ::brep::repository > obj_traits; + typedef odb::pointer_traits< value_type > ptr_traits; + + if (composite_value_traits< obj_traits::id_type, id_pgsql >::get_null ( + i.value_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.value_value, + db); + + v = ptr_traits::pointer_type ( + *static_cast<pgsql::database*> (db), ptr_id); + } + } + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::other_repositories_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::package, id_pgsql >::other_repositories_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::package, id_pgsql >::other_repositories_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::package, id_pgsql >::other_repositories_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::package, id_pgsql >::other_repositories_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::package, id_pgsql >::other_repositories_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::package, id_pgsql >::other_repositories_traits:: + erase (statements_type& sts) + { + using namespace pgsql; + + functions_type& fs (sts.functions ()); + fs.ordered_ = true; + container_traits_type::erase (fs); + } + + // build_section + // + + void access::object_traits_impl< ::brep::package, id_pgsql >::build_section_traits:: + load (extra_statement_cache_type& esc, object_type& obj) + { + // builds + // + { + ::brep::build_class_exprs& v = + obj.builds; + + builds_traits::load ( + v, + esc.builds); + } + + // build_constraints + // + { + ::brep::package::build_constraints_type& v = + obj.build_constraints; + + build_constraints_traits::load ( + v, + esc.build_constraints); + } + + // build_configs + // + { + ::brep::package_build_configs& v = + obj.build_configs; + + build_configs_traits::load ( + v, + esc.build_configs); + } + + // build_config_builds + // + { + ::brep::build_class_exprs_map v; + + build_config_builds_traits::load ( + v, + esc.build_config_builds); + + // From package.hxx:874:7 + brep::build_package_config_builds bs; + odb::nested_set (bs, std::move (v)); + move (bs).to_configs (obj.build_configs); + } + + // build_config_constraints + // + { + ::brep::build_constraints_map v; + + build_config_constraints_traits::load ( + v, + esc.build_config_constraints); + + // From package.hxx:885:7 + brep::build_package_config_constraints cs; + odb::nested_set (cs, std::move (v)); + move (cs).to_configs (obj.build_configs); + } + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::build_section_traits:: + update (extra_statement_cache_type& esc, const object_type& obj) + { + // builds + // + { + ::brep::build_class_exprs const& v = + obj.builds; + + builds_traits::update ( + v, + esc.builds); + } + + // build_constraints + // + { + ::brep::package::build_constraints_type const& v = + obj.build_constraints; + + build_constraints_traits::update ( + v, + esc.build_constraints); + } + + // build_configs + // + { + ::brep::package_build_configs const& v = + obj.build_configs; + + build_configs_traits::update ( + v, + esc.build_configs); + } + + // build_config_builds + // + { + // From package.hxx:872:7 + ::brep::build_class_exprs_map const& v = + odb::nested_get (brep::build_package_config_builds (obj.build_configs)); + + build_config_builds_traits::update ( + v, + esc.build_config_builds); + } + + // build_config_constraints + // + { + // From package.hxx:883:7 + ::brep::build_constraints_map const& v = + odb::nested_get (brep::build_package_config_constraints (obj.build_configs)); + + build_config_constraints_traits::update ( + v, + esc.build_config_constraints); + } + } + + // unused_section + // + + void access::object_traits_impl< ::brep::package, id_pgsql >::unused_section_traits:: + load (extra_statement_cache_type& esc, object_type& obj) + { + // build_auxiliaries + // + { + ::brep::package::build_auxiliaries_type& v = + obj.build_auxiliaries; + + build_auxiliaries_traits::load ( + v, + esc.build_auxiliaries); + } + + // build_bot_keys + // + { + ::brep::package_build_bot_keys& v = + obj.build_bot_keys; + + build_bot_keys_traits::load ( + v, + esc.build_bot_keys); + } + + // build_config_auxiliaries + // + { + ::brep::build_auxiliaries_map v; + + build_config_auxiliaries_traits::load ( + v, + esc.build_config_auxiliaries); + + // From package.hxx:896:7 + brep::build_package_config_auxiliaries as; + odb::nested_set (as, std::move (v)); + move (as).to_configs (obj.build_configs); + } + + // build_config_bot_keys + // + { + ::brep::package_build_bot_keys_map v; + + build_config_bot_keys_traits::load ( + v, + esc.build_config_bot_keys); + + // From package.hxx:908:7 + brep::build_package_config_bot_keys < lazy_shared_ptr < brep::public_key >> bks; + odb::nested_set (bks, std::move (v)); + move (bks).to_configs (obj.build_configs); + } + } + + void access::object_traits_impl< ::brep::package, id_pgsql >::unused_section_traits:: + update (extra_statement_cache_type& esc, const object_type& obj) + { + // build_auxiliaries + // + { + ::brep::package::build_auxiliaries_type const& v = + obj.build_auxiliaries; + + build_auxiliaries_traits::update ( + v, + esc.build_auxiliaries); + } + + // build_bot_keys + // + { + ::brep::package_build_bot_keys const& v = + obj.build_bot_keys; + + build_bot_keys_traits::update ( + v, + esc.build_bot_keys); + } + + // build_config_auxiliaries + // + { + // From package.hxx:894:7 + ::brep::build_auxiliaries_map const& v = + odb::nested_get (brep::build_package_config_auxiliaries (obj.build_configs)); + + build_config_auxiliaries_traits::update ( + v, + esc.build_config_auxiliaries); + } + + // build_config_bot_keys + // + { + // From package.hxx:905:7 + ::brep::package_build_bot_keys_map const& v = + odb::nested_get (brep::build_package_config_bot_keys < lazy_shared_ptr < brep::public_key >> (obj.build_configs)); + + build_config_bot_keys_traits::update ( + v, + esc.build_config_bot_keys); + } + } + + access::object_traits_impl< ::brep::package, id_pgsql >::id_type + access::object_traits_impl< ::brep::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::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::package::upstream_version_type, id_pgsql >::grow ( + i.version_value, t + 6UL)) + grew = true; + + // upstream_version + // + if (t[8UL]) + { + i.upstream_version_value.capacity (i.upstream_version_size); + grew = true; + } + + // project + // + if (t[9UL]) + { + i.project_value.capacity (i.project_size); + grew = true; + } + + // priority + // + if (composite_value_traits< ::brep::package::priority_type, id_pgsql >::grow ( + i.priority_value, t + 10UL)) + grew = true; + + // summary + // + if (t[12UL]) + { + i.summary_value.capacity (i.summary_size); + grew = true; + } + + // description + // + if (composite_value_traits< ::brep::typed_text, id_pgsql >::grow ( + i.description_value, t + 13UL)) + grew = true; + + // package_description + // + if (composite_value_traits< ::brep::typed_text, id_pgsql >::grow ( + i.package_description_value, t + 15UL)) + grew = true; + + // changes + // + if (composite_value_traits< ::brep::typed_text, id_pgsql >::grow ( + i.changes_value, t + 17UL)) + grew = true; + + // url + // + if (composite_value_traits< ::bpkg::manifest_url, id_pgsql >::grow ( + i.url_value, t + 19UL)) + grew = true; + + // doc_url + // + if (composite_value_traits< ::bpkg::manifest_url, id_pgsql >::grow ( + i.doc_url_value, t + 21UL)) + grew = true; + + // src_url + // + if (composite_value_traits< ::bpkg::manifest_url, id_pgsql >::grow ( + i.src_url_value, t + 23UL)) + grew = true; + + // package_url + // + if (composite_value_traits< ::bpkg::manifest_url, id_pgsql >::grow ( + i.package_url_value, t + 25UL)) + grew = true; + + // email + // + if (composite_value_traits< ::bpkg::email, id_pgsql >::grow ( + i.email_value, t + 27UL)) + grew = true; + + // package_email + // + if (composite_value_traits< ::bpkg::email, id_pgsql >::grow ( + i.package_email_value, t + 29UL)) + grew = true; + + // build_email + // + if (composite_value_traits< ::bpkg::email, id_pgsql >::grow ( + i.build_email_value, t + 31UL)) + grew = true; + + // build_warning_email + // + if (composite_value_traits< ::bpkg::email, id_pgsql >::grow ( + i.build_warning_email_value, t + 33UL)) + grew = true; + + // build_error_email + // + if (composite_value_traits< ::bpkg::email, id_pgsql >::grow ( + i.build_error_email_value, t + 35UL)) + grew = true; + + // internal_repository + // + if (composite_value_traits< ::brep::repository_id, id_pgsql >::grow ( + i.internal_repository_value, t + 37UL)) + grew = true; + + // location + // + if (t[39UL]) + { + i.location_value.capacity (i.location_size); + grew = true; + } + + // fragment + // + if (t[40UL]) + { + i.fragment_value.capacity (i.fragment_size); + grew = true; + } + + // sha256sum + // + if (t[41UL]) + { + i.sha256sum_value.capacity (i.sha256sum_size); + grew = true; + } + + // buildable + // + t[42UL] = 0; + + // unbuildable_reason + // + if (t[43UL]) + { + i.unbuildable_reason_value.capacity (i.unbuildable_reason_size); + grew = true; + } + + // custom_bot + // + t[44UL] = 0; + + // search_index + // + if (t[45UL]) + { + i.search_index_value.capacity (i.search_index_size); + grew = true; + } + + return grew; + } + + void access::object_traits_impl< ::brep::package, 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::package_id, id_pgsql >::bind ( + b + n, i.id_value, sk); + n += 6UL; + } + + // version + // + composite_value_traits< ::brep::package::upstream_version_type, id_pgsql >::bind ( + b + n, i.version_value, sk); + n += 2UL; + + // upstream_version + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.upstream_version_value.data_ptr (); + b[n].capacity = i.upstream_version_value.capacity (); + b[n].size = &i.upstream_version_size; + b[n].is_null = &i.upstream_version_null; + n++; + + // project + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.project_value.data_ptr (); + b[n].capacity = i.project_value.capacity (); + b[n].size = &i.project_size; + b[n].is_null = &i.project_null; + n++; + + // priority + // + composite_value_traits< ::brep::package::priority_type, id_pgsql >::bind ( + b + n, i.priority_value, sk); + n += 2UL; + + // summary + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.summary_value.data_ptr (); + b[n].capacity = i.summary_value.capacity (); + b[n].size = &i.summary_size; + b[n].is_null = &i.summary_null; + n++; + + // description + // + composite_value_traits< ::brep::typed_text, id_pgsql >::bind ( + b + n, i.description_value, sk); + n += 2UL; + + // package_description + // + composite_value_traits< ::brep::typed_text, id_pgsql >::bind ( + b + n, i.package_description_value, sk); + n += 2UL; + + // changes + // + composite_value_traits< ::brep::typed_text, id_pgsql >::bind ( + b + n, i.changes_value, sk); + n += 2UL; + + // url + // + composite_value_traits< ::bpkg::manifest_url, id_pgsql >::bind ( + b + n, i.url_value, sk); + n += 2UL; + + // doc_url + // + composite_value_traits< ::bpkg::manifest_url, id_pgsql >::bind ( + b + n, i.doc_url_value, sk); + n += 2UL; + + // src_url + // + composite_value_traits< ::bpkg::manifest_url, id_pgsql >::bind ( + b + n, i.src_url_value, sk); + n += 2UL; + + // package_url + // + composite_value_traits< ::bpkg::manifest_url, id_pgsql >::bind ( + b + n, i.package_url_value, sk); + n += 2UL; + + // email + // + composite_value_traits< ::bpkg::email, id_pgsql >::bind ( + b + n, i.email_value, sk); + n += 2UL; + + // package_email + // + composite_value_traits< ::bpkg::email, id_pgsql >::bind ( + b + n, i.package_email_value, sk); + n += 2UL; + + // build_email + // + composite_value_traits< ::bpkg::email, id_pgsql >::bind ( + b + n, i.build_email_value, sk); + n += 2UL; + + // build_warning_email + // + composite_value_traits< ::bpkg::email, id_pgsql >::bind ( + b + n, i.build_warning_email_value, sk); + n += 2UL; + + // build_error_email + // + composite_value_traits< ::bpkg::email, id_pgsql >::bind ( + b + n, i.build_error_email_value, sk); + n += 2UL; + + // internal_repository + // + composite_value_traits< ::brep::repository_id, id_pgsql >::bind ( + b + n, i.internal_repository_value, sk); + n += 2UL; + + // location + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.location_value.data_ptr (); + b[n].capacity = i.location_value.capacity (); + b[n].size = &i.location_size; + b[n].is_null = &i.location_null; + n++; + + // fragment + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.fragment_value.data_ptr (); + b[n].capacity = i.fragment_value.capacity (); + b[n].size = &i.fragment_size; + b[n].is_null = &i.fragment_null; + n++; + + // sha256sum + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.sha256sum_value.data_ptr (); + b[n].capacity = i.sha256sum_value.capacity (); + b[n].size = &i.sha256sum_size; + b[n].is_null = &i.sha256sum_null; + n++; + + // buildable + // + b[n].type = pgsql::bind::boolean_; + b[n].buffer = &i.buildable_value; + b[n].is_null = &i.buildable_null; + n++; + + // unbuildable_reason + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.unbuildable_reason_value.data_ptr (); + b[n].capacity = i.unbuildable_reason_value.capacity (); + b[n].size = &i.unbuildable_reason_size; + b[n].is_null = &i.unbuildable_reason_null; + n++; + + // custom_bot + // + b[n].type = pgsql::bind::boolean_; + b[n].buffer = &i.custom_bot_value; + b[n].is_null = &i.custom_bot_null; + n++; + + // search_index + // + b[n].type = pgsql::bind::text; + b[n].buffer = i.search_index_value.data_ptr (); + b[n].capacity = i.search_index_value.capacity (); + b[n].size = &i.search_index_size; + b[n].is_null = &i.search_index_null; + n++; + } + + void access::object_traits_impl< ::brep::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::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; + + bool grew (false); + + // id + // + if (sk == statement_insert) + { + ::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::package::upstream_version_type const& v = + o.version; + + if (composite_value_traits< ::brep::package::upstream_version_type, id_pgsql >::init ( + i.version_value, + v, + sk)) + grew = true; + } + + // upstream_version + // + { + ::butl::optional< ::std::basic_string< char > > const& v = + o.upstream_version; + + bool is_null (true); + std::size_t size (0); + std::size_t cap (i.upstream_version_value.capacity ()); + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_image ( + i.upstream_version_value, + size, + is_null, + v); + i.upstream_version_null = is_null; + i.upstream_version_size = size; + grew = grew || (cap != i.upstream_version_value.capacity ()); + } + + // project + // + { + ::bpkg::package_name const& v = + o.project; + + bool is_null (false); + std::size_t size (0); + std::size_t cap (i.project_value.capacity ()); + pgsql::value_traits< + ::bpkg::package_name, + pgsql::id_string >::set_image ( + i.project_value, + size, + is_null, + v); + i.project_null = is_null; + i.project_size = size; + grew = grew || (cap != i.project_value.capacity ()); + } + + // priority + // + { + ::brep::package::priority_type const& v = + o.priority; + + if (composite_value_traits< ::brep::package::priority_type, id_pgsql >::init ( + i.priority_value, + v, + sk)) + grew = true; + } + + // summary + // + { + ::std::string const& v = + o.summary; + + bool is_null (false); + std::size_t size (0); + std::size_t cap (i.summary_value.capacity ()); + pgsql::value_traits< + ::std::string, + pgsql::id_string >::set_image ( + i.summary_value, + size, + is_null, + v); + i.summary_null = is_null; + i.summary_size = size; + grew = grew || (cap != i.summary_value.capacity ()); + } + + // description + // + { + ::butl::optional< ::brep::typed_text > const& v = + o.description; + + if (wrapper_traits< ::butl::optional< ::brep::typed_text > >::get_null (v)) + composite_value_traits< ::brep::typed_text, id_pgsql >::set_null ( + i.description_value, sk); + else + { + const::brep::typed_text& vw = + wrapper_traits< ::butl::optional< ::brep::typed_text > >::get_ref (v); + + if (composite_value_traits< ::brep::typed_text, id_pgsql >::init ( + i.description_value, + vw, + sk)) + grew = true; + } + } + + // package_description + // + { + ::butl::optional< ::brep::typed_text > const& v = + o.package_description; + + if (wrapper_traits< ::butl::optional< ::brep::typed_text > >::get_null (v)) + composite_value_traits< ::brep::typed_text, id_pgsql >::set_null ( + i.package_description_value, sk); + else + { + const::brep::typed_text& vw = + wrapper_traits< ::butl::optional< ::brep::typed_text > >::get_ref (v); + + if (composite_value_traits< ::brep::typed_text, id_pgsql >::init ( + i.package_description_value, + vw, + sk)) + grew = true; + } + } + + // changes + // + { + ::butl::optional< ::brep::typed_text > const& v = + o.changes; + + if (wrapper_traits< ::butl::optional< ::brep::typed_text > >::get_null (v)) + composite_value_traits< ::brep::typed_text, id_pgsql >::set_null ( + i.changes_value, sk); + else + { + const::brep::typed_text& vw = + wrapper_traits< ::butl::optional< ::brep::typed_text > >::get_ref (v); + + if (composite_value_traits< ::brep::typed_text, id_pgsql >::init ( + i.changes_value, + vw, + sk)) + grew = true; + } + } + + // url + // + { + ::butl::optional< ::bpkg::manifest_url > const& v = + o.url; + + if (wrapper_traits< ::butl::optional< ::bpkg::manifest_url > >::get_null (v)) + composite_value_traits< ::bpkg::manifest_url, id_pgsql >::set_null ( + i.url_value, sk); + else + { + const::bpkg::manifest_url& vw = + wrapper_traits< ::butl::optional< ::bpkg::manifest_url > >::get_ref (v); + + if (composite_value_traits< ::bpkg::manifest_url, id_pgsql >::init ( + i.url_value, + vw, + sk)) + grew = true; + } + } + + // doc_url + // + { + ::butl::optional< ::bpkg::manifest_url > const& v = + o.doc_url; + + if (wrapper_traits< ::butl::optional< ::bpkg::manifest_url > >::get_null (v)) + composite_value_traits< ::bpkg::manifest_url, id_pgsql >::set_null ( + i.doc_url_value, sk); + else + { + const::bpkg::manifest_url& vw = + wrapper_traits< ::butl::optional< ::bpkg::manifest_url > >::get_ref (v); + + if (composite_value_traits< ::bpkg::manifest_url, id_pgsql >::init ( + i.doc_url_value, + vw, + sk)) + grew = true; + } + } + + // src_url + // + { + ::butl::optional< ::bpkg::manifest_url > const& v = + o.src_url; + + if (wrapper_traits< ::butl::optional< ::bpkg::manifest_url > >::get_null (v)) + composite_value_traits< ::bpkg::manifest_url, id_pgsql >::set_null ( + i.src_url_value, sk); + else + { + const::bpkg::manifest_url& vw = + wrapper_traits< ::butl::optional< ::bpkg::manifest_url > >::get_ref (v); + + if (composite_value_traits< ::bpkg::manifest_url, id_pgsql >::init ( + i.src_url_value, + vw, + sk)) + grew = true; + } + } + + // package_url + // + { + ::butl::optional< ::bpkg::manifest_url > const& v = + o.package_url; + + if (wrapper_traits< ::butl::optional< ::bpkg::manifest_url > >::get_null (v)) + composite_value_traits< ::bpkg::manifest_url, id_pgsql >::set_null ( + i.package_url_value, sk); + else + { + const::bpkg::manifest_url& vw = + wrapper_traits< ::butl::optional< ::bpkg::manifest_url > >::get_ref (v); + + if (composite_value_traits< ::bpkg::manifest_url, id_pgsql >::init ( + i.package_url_value, + vw, + sk)) + grew = true; + } + } + + // email + // + { + ::butl::optional< ::bpkg::email > const& v = + o.email; + + if (wrapper_traits< ::butl::optional< ::bpkg::email > >::get_null (v)) + composite_value_traits< ::bpkg::email, id_pgsql >::set_null ( + i.email_value, sk); + else + { + const::bpkg::email& vw = + wrapper_traits< ::butl::optional< ::bpkg::email > >::get_ref (v); + + if (composite_value_traits< ::bpkg::email, id_pgsql >::init ( + i.email_value, + vw, + sk)) + grew = true; + } + } + + // package_email + // + { + ::butl::optional< ::bpkg::email > const& v = + o.package_email; + + if (wrapper_traits< ::butl::optional< ::bpkg::email > >::get_null (v)) + composite_value_traits< ::bpkg::email, id_pgsql >::set_null ( + i.package_email_value, sk); + else + { + const::bpkg::email& vw = + wrapper_traits< ::butl::optional< ::bpkg::email > >::get_ref (v); + + if (composite_value_traits< ::bpkg::email, id_pgsql >::init ( + i.package_email_value, + vw, + sk)) + grew = true; + } + } + + // build_email + // + { + ::butl::optional< ::bpkg::email > const& v = + o.build_email; + + if (wrapper_traits< ::butl::optional< ::bpkg::email > >::get_null (v)) + composite_value_traits< ::bpkg::email, id_pgsql >::set_null ( + i.build_email_value, sk); + else + { + const::bpkg::email& vw = + wrapper_traits< ::butl::optional< ::bpkg::email > >::get_ref (v); + + if (composite_value_traits< ::bpkg::email, id_pgsql >::init ( + i.build_email_value, + vw, + sk)) + grew = true; + } + } + + // build_warning_email + // + { + ::butl::optional< ::bpkg::email > const& v = + o.build_warning_email; + + if (wrapper_traits< ::butl::optional< ::bpkg::email > >::get_null (v)) + composite_value_traits< ::bpkg::email, id_pgsql >::set_null ( + i.build_warning_email_value, sk); + else + { + const::bpkg::email& vw = + wrapper_traits< ::butl::optional< ::bpkg::email > >::get_ref (v); + + if (composite_value_traits< ::bpkg::email, id_pgsql >::init ( + i.build_warning_email_value, + vw, + sk)) + grew = true; + } + } + + // build_error_email + // + { + ::butl::optional< ::bpkg::email > const& v = + o.build_error_email; + + if (wrapper_traits< ::butl::optional< ::bpkg::email > >::get_null (v)) + composite_value_traits< ::bpkg::email, id_pgsql >::set_null ( + i.build_error_email_value, sk); + else + { + const::bpkg::email& vw = + wrapper_traits< ::butl::optional< ::bpkg::email > >::get_ref (v); + + if (composite_value_traits< ::bpkg::email, id_pgsql >::init ( + i.build_error_email_value, + vw, + sk)) + grew = true; + } + } + + // internal_repository + // + { + ::odb::lazy_shared_ptr< ::brep::repository > const& v = + o.internal_repository; + + typedef object_traits< ::brep::repository > obj_traits; + typedef odb::pointer_traits< ::odb::lazy_shared_ptr< ::brep::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); + } + + // location + // + { + ::butl::optional< ::butl::basic_path< char, ::butl::any_path_kind< char > > > const& v = + o.location; + + // From common.hxx:105:14 + ::brep::optional_string const& vt = + (v) ? (v)->string () : brep::optional_string (); + + bool is_null (true); + std::size_t size (0); + std::size_t cap (i.location_value.capacity ()); + pgsql::value_traits< + ::brep::optional_string, + pgsql::id_string >::set_image ( + i.location_value, + size, + is_null, + vt); + i.location_null = is_null; + i.location_size = size; + grew = grew || (cap != i.location_value.capacity ()); + } + + // fragment + // + { + ::butl::optional< ::std::basic_string< char > > const& v = + o.fragment; + + bool is_null (true); + std::size_t size (0); + std::size_t cap (i.fragment_value.capacity ()); + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_image ( + i.fragment_value, + size, + is_null, + v); + i.fragment_null = is_null; + i.fragment_size = size; + grew = grew || (cap != i.fragment_value.capacity ()); + } + + // sha256sum + // + { + ::butl::optional< ::std::basic_string< char > > const& v = + o.sha256sum; + + bool is_null (true); + std::size_t size (0); + std::size_t cap (i.sha256sum_value.capacity ()); + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_image ( + i.sha256sum_value, + size, + is_null, + v); + i.sha256sum_null = is_null; + i.sha256sum_size = size; + grew = grew || (cap != i.sha256sum_value.capacity ()); + } + + // 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; + } + + // unbuildable_reason + // + { + ::butl::optional< ::brep::unbuildable_reason > const& v = + o.unbuildable_reason; + + // From common.hxx:606:14 + ::brep::optional_string const& vt = + (v) ? to_string ( * (v)) : brep::optional_string (); + + bool is_null (true); + std::size_t size (0); + std::size_t cap (i.unbuildable_reason_value.capacity ()); + pgsql::value_traits< + ::brep::optional_string, + pgsql::id_string >::set_image ( + i.unbuildable_reason_value, + size, + is_null, + vt); + i.unbuildable_reason_null = is_null; + i.unbuildable_reason_size = size; + grew = grew || (cap != i.unbuildable_reason_value.capacity ()); + } + + // custom_bot + // + { + ::butl::optional< bool > const& v = + o.custom_bot; + + bool is_null (true); + pgsql::value_traits< + ::butl::optional< bool >, + pgsql::id_boolean >::set_image ( + i.custom_bot_value, is_null, v); + i.custom_bot_null = is_null; + } + + // search_index + // + { + // From package.hxx:926:7 + ::brep::weighted_text const& v = + o.search_text (); + + bool is_null (true); + std::size_t size (0); + std::size_t cap (i.search_index_value.capacity ()); + pgsql::value_traits< + ::brep::weighted_text, + pgsql::id_string >::set_image ( + i.search_index_value, + size, + is_null, + v); + i.search_index_null = is_null; + i.search_index_size = size; + grew = grew || (cap != i.search_index_value.capacity ()); + } + + return grew; + } + + void access::object_traits_impl< ::brep::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 package.hxx:735:32 + ::brep::package::upstream_version_type v; + + composite_value_traits< ::brep::package::upstream_version_type, id_pgsql >::init ( + v, + i.version_value, + db); + + // From package.hxx:735:32 + o.version.init (o.id.version, (v)); + } + + // upstream_version + // + { + ::butl::optional< ::std::basic_string< char > >& v = + o.upstream_version; + + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_value ( + v, + i.upstream_version_value, + i.upstream_version_size, + i.upstream_version_null); + } + + // project + // + { + ::bpkg::package_name& v = + o.project; + + pgsql::value_traits< + ::bpkg::package_name, + pgsql::id_string >::set_value ( + v, + i.project_value, + i.project_size, + i.project_null); + } + + // priority + // + { + ::brep::package::priority_type& v = + o.priority; + + composite_value_traits< ::brep::package::priority_type, id_pgsql >::init ( + v, + i.priority_value, + db); + } + + // summary + // + { + ::std::string& v = + o.summary; + + pgsql::value_traits< + ::std::string, + pgsql::id_string >::set_value ( + v, + i.summary_value, + i.summary_size, + i.summary_null); + } + + // description + // + { + ::butl::optional< ::brep::typed_text >& v = + o.description; + + if (composite_value_traits< ::brep::typed_text, id_pgsql >::get_null ( + i.description_value)) + wrapper_traits< ::butl::optional< ::brep::typed_text > >::set_null (v); + else + { + ::brep::typed_text& vw = + wrapper_traits< ::butl::optional< ::brep::typed_text > >::set_ref (v); + + composite_value_traits< ::brep::typed_text, id_pgsql >::init ( + vw, + i.description_value, + db); + } + } + + // package_description + // + { + ::butl::optional< ::brep::typed_text >& v = + o.package_description; + + if (composite_value_traits< ::brep::typed_text, id_pgsql >::get_null ( + i.package_description_value)) + wrapper_traits< ::butl::optional< ::brep::typed_text > >::set_null (v); + else + { + ::brep::typed_text& vw = + wrapper_traits< ::butl::optional< ::brep::typed_text > >::set_ref (v); + + composite_value_traits< ::brep::typed_text, id_pgsql >::init ( + vw, + i.package_description_value, + db); + } + } + + // changes + // + { + ::butl::optional< ::brep::typed_text >& v = + o.changes; + + if (composite_value_traits< ::brep::typed_text, id_pgsql >::get_null ( + i.changes_value)) + wrapper_traits< ::butl::optional< ::brep::typed_text > >::set_null (v); + else + { + ::brep::typed_text& vw = + wrapper_traits< ::butl::optional< ::brep::typed_text > >::set_ref (v); + + composite_value_traits< ::brep::typed_text, id_pgsql >::init ( + vw, + i.changes_value, + db); + } + } + + // url + // + { + ::butl::optional< ::bpkg::manifest_url >& v = + o.url; + + if (composite_value_traits< ::bpkg::manifest_url, id_pgsql >::get_null ( + i.url_value)) + wrapper_traits< ::butl::optional< ::bpkg::manifest_url > >::set_null (v); + else + { + ::bpkg::manifest_url& vw = + wrapper_traits< ::butl::optional< ::bpkg::manifest_url > >::set_ref (v); + + composite_value_traits< ::bpkg::manifest_url, id_pgsql >::init ( + vw, + i.url_value, + db); + } + } + + // doc_url + // + { + ::butl::optional< ::bpkg::manifest_url >& v = + o.doc_url; + + if (composite_value_traits< ::bpkg::manifest_url, id_pgsql >::get_null ( + i.doc_url_value)) + wrapper_traits< ::butl::optional< ::bpkg::manifest_url > >::set_null (v); + else + { + ::bpkg::manifest_url& vw = + wrapper_traits< ::butl::optional< ::bpkg::manifest_url > >::set_ref (v); + + composite_value_traits< ::bpkg::manifest_url, id_pgsql >::init ( + vw, + i.doc_url_value, + db); + } + } + + // src_url + // + { + ::butl::optional< ::bpkg::manifest_url >& v = + o.src_url; + + if (composite_value_traits< ::bpkg::manifest_url, id_pgsql >::get_null ( + i.src_url_value)) + wrapper_traits< ::butl::optional< ::bpkg::manifest_url > >::set_null (v); + else + { + ::bpkg::manifest_url& vw = + wrapper_traits< ::butl::optional< ::bpkg::manifest_url > >::set_ref (v); + + composite_value_traits< ::bpkg::manifest_url, id_pgsql >::init ( + vw, + i.src_url_value, + db); + } + } + + // package_url + // + { + ::butl::optional< ::bpkg::manifest_url >& v = + o.package_url; + + if (composite_value_traits< ::bpkg::manifest_url, id_pgsql >::get_null ( + i.package_url_value)) + wrapper_traits< ::butl::optional< ::bpkg::manifest_url > >::set_null (v); + else + { + ::bpkg::manifest_url& vw = + wrapper_traits< ::butl::optional< ::bpkg::manifest_url > >::set_ref (v); + + composite_value_traits< ::bpkg::manifest_url, id_pgsql >::init ( + vw, + i.package_url_value, + db); + } + } + + // email + // + { + ::butl::optional< ::bpkg::email >& v = + o.email; + + if (composite_value_traits< ::bpkg::email, id_pgsql >::get_null ( + i.email_value)) + wrapper_traits< ::butl::optional< ::bpkg::email > >::set_null (v); + else + { + ::bpkg::email& vw = + wrapper_traits< ::butl::optional< ::bpkg::email > >::set_ref (v); + + composite_value_traits< ::bpkg::email, id_pgsql >::init ( + vw, + i.email_value, + db); + } + } + + // package_email + // + { + ::butl::optional< ::bpkg::email >& v = + o.package_email; + + if (composite_value_traits< ::bpkg::email, id_pgsql >::get_null ( + i.package_email_value)) + wrapper_traits< ::butl::optional< ::bpkg::email > >::set_null (v); + else + { + ::bpkg::email& vw = + wrapper_traits< ::butl::optional< ::bpkg::email > >::set_ref (v); + + composite_value_traits< ::bpkg::email, id_pgsql >::init ( + vw, + i.package_email_value, + db); + } + } + + // build_email + // + { + ::butl::optional< ::bpkg::email >& v = + o.build_email; + + if (composite_value_traits< ::bpkg::email, id_pgsql >::get_null ( + i.build_email_value)) + wrapper_traits< ::butl::optional< ::bpkg::email > >::set_null (v); + else + { + ::bpkg::email& vw = + wrapper_traits< ::butl::optional< ::bpkg::email > >::set_ref (v); + + composite_value_traits< ::bpkg::email, id_pgsql >::init ( + vw, + i.build_email_value, + db); + } + } + + // build_warning_email + // + { + ::butl::optional< ::bpkg::email >& v = + o.build_warning_email; + + if (composite_value_traits< ::bpkg::email, id_pgsql >::get_null ( + i.build_warning_email_value)) + wrapper_traits< ::butl::optional< ::bpkg::email > >::set_null (v); + else + { + ::bpkg::email& vw = + wrapper_traits< ::butl::optional< ::bpkg::email > >::set_ref (v); + + composite_value_traits< ::bpkg::email, id_pgsql >::init ( + vw, + i.build_warning_email_value, + db); + } + } + + // build_error_email + // + { + ::butl::optional< ::bpkg::email >& v = + o.build_error_email; + + if (composite_value_traits< ::bpkg::email, id_pgsql >::get_null ( + i.build_error_email_value)) + wrapper_traits< ::butl::optional< ::bpkg::email > >::set_null (v); + else + { + ::bpkg::email& vw = + wrapper_traits< ::butl::optional< ::bpkg::email > >::set_ref (v); + + composite_value_traits< ::bpkg::email, id_pgsql >::init ( + vw, + i.build_error_email_value, + db); + } + } + + // internal_repository + // + { + ::odb::lazy_shared_ptr< ::brep::repository >& v = + o.internal_repository; + + typedef object_traits< ::brep::repository > obj_traits; + typedef odb::pointer_traits< ::odb::lazy_shared_ptr< ::brep::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); + } + } + + // location + // + { + ::butl::optional< ::butl::basic_path< char, ::butl::any_path_kind< char > > >& v = + o.location; + + ::brep::optional_string vt; + + pgsql::value_traits< + ::brep::optional_string, + pgsql::id_string >::set_value ( + vt, + i.location_value, + i.location_size, + i.location_null); + + // From common.hxx:105:14 + v = (vt) ? brep::path ( * (vt)) : brep::optional_path (); + } + + // fragment + // + { + ::butl::optional< ::std::basic_string< char > >& v = + o.fragment; + + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_value ( + v, + i.fragment_value, + i.fragment_size, + i.fragment_null); + } + + // sha256sum + // + { + ::butl::optional< ::std::basic_string< char > >& v = + o.sha256sum; + + pgsql::value_traits< + ::butl::optional< ::std::basic_string< char > >, + pgsql::id_string >::set_value ( + v, + i.sha256sum_value, + i.sha256sum_size, + i.sha256sum_null); + } + + // buildable + // + { + bool& v = + o.buildable; + + pgsql::value_traits< + bool, + pgsql::id_boolean >::set_value ( + v, + i.buildable_value, + i.buildable_null); + } + + // unbuildable_reason + // + { + ::butl::optional< ::brep::unbuildable_reason >& v = + o.unbuildable_reason; + + ::brep::optional_string vt; + + pgsql::value_traits< + ::brep::optional_string, + pgsql::id_string >::set_value ( + vt, + i.unbuildable_reason_value, + i.unbuildable_reason_size, + i.unbuildable_reason_null); + + // From common.hxx:606:14 + v = (vt) ? brep::to_unbuildable_reason ( * (vt)) : brep::optional_unbuildable_reason (); + } + + // custom_bot + // + { + ::butl::optional< bool >& v = + o.custom_bot; + + pgsql::value_traits< + ::butl::optional< bool >, + pgsql::id_boolean >::set_value ( + v, + i.custom_bot_value, + i.custom_bot_null); + } + + // search_index + // + { + // From package.hxx:926:7 + ::brep::weighted_text v; + + pgsql::value_traits< + ::brep::weighted_text, + pgsql::id_string >::set_value ( + v, + i.search_index_value, + i.search_index_size, + i.search_index_null); + + // From package.hxx:926:7 + o.search_text (v); + } + } + + void access::object_traits_impl< ::brep::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::package, id_pgsql >::persist_statement[] = + "INSERT INTO \"package\" " + "(\"tenant\", " + "\"name\", " + "\"version_epoch\", " + "\"version_canonical_upstream\", " + "\"version_canonical_release\", " + "\"version_revision\", " + "\"version_upstream\", " + "\"version_release\", " + "\"upstream_version\", " + "\"project\", " + "\"priority\", " + "\"priority_comment\", " + "\"summary\", " + "\"description\", " + "\"description_type\", " + "\"package_description\", " + "\"package_description_type\", " + "\"changes\", " + "\"changes_type\", " + "\"url\", " + "\"url_comment\", " + "\"doc_url\", " + "\"doc_url_comment\", " + "\"src_url\", " + "\"src_url_comment\", " + "\"package_url\", " + "\"package_url_comment\", " + "\"email\", " + "\"email_comment\", " + "\"package_email\", " + "\"package_email_comment\", " + "\"build_email\", " + "\"build_email_comment\", " + "\"build_warning_email\", " + "\"build_warning_email_comment\", " + "\"build_error_email\", " + "\"build_error_email_comment\", " + "\"internal_repository_tenant\", " + "\"internal_repository_canonical_name\", " + "\"location\", " + "\"fragment\", " + "\"sha256sum\", " + "\"buildable\", " + "\"unbuildable_reason\", " + "\"custom_bot\", " + "\"search_index\") " + "VALUES " + "($1, $2::CITEXT, $3, $4, $5, $6, $7, $8, $9, $10::CITEXT, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32, $33, $34, $35, $36, $37, $38, $39, $40, $41, $42, $43, $44, $45, to_tsvector($46::weighted_text))"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::find_statement[] = + "SELECT " + "\"package\".\"tenant\", " + "\"package\".\"name\"::TEXT, " + "\"package\".\"version_epoch\", " + "\"package\".\"version_canonical_upstream\", " + "\"package\".\"version_canonical_release\", " + "\"package\".\"version_revision\", " + "\"package\".\"version_upstream\", " + "\"package\".\"version_release\", " + "\"package\".\"upstream_version\", " + "\"package\".\"project\"::TEXT, " + "\"package\".\"priority\", " + "\"package\".\"priority_comment\", " + "\"package\".\"summary\", " + "\"package\".\"description\", " + "\"package\".\"description_type\", " + "\"package\".\"package_description\", " + "\"package\".\"package_description_type\", " + "\"package\".\"changes\", " + "\"package\".\"changes_type\", " + "\"package\".\"url\", " + "\"package\".\"url_comment\", " + "\"package\".\"doc_url\", " + "\"package\".\"doc_url_comment\", " + "\"package\".\"src_url\", " + "\"package\".\"src_url_comment\", " + "\"package\".\"package_url\", " + "\"package\".\"package_url_comment\", " + "\"package\".\"email\", " + "\"package\".\"email_comment\", " + "\"package\".\"package_email\", " + "\"package\".\"package_email_comment\", " + "\"package\".\"build_email\", " + "\"package\".\"build_email_comment\", " + "\"package\".\"build_warning_email\", " + "\"package\".\"build_warning_email_comment\", " + "\"package\".\"build_error_email\", " + "\"package\".\"build_error_email_comment\", " + "\"package\".\"internal_repository_tenant\", " + "\"package\".\"internal_repository_canonical_name\", " + "\"package\".\"location\", " + "\"package\".\"fragment\", " + "\"package\".\"sha256sum\", " + "\"package\".\"buildable\", " + "\"package\".\"unbuildable_reason\", " + "\"package\".\"custom_bot\", " + "COALESCE('',\"package\".\"search_index\") " + "FROM \"package\" " + "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"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::update_statement[] = + "UPDATE \"package\" " + "SET " + "\"version_upstream\"=$1, " + "\"version_release\"=$2, " + "\"upstream_version\"=$3, " + "\"project\"=$4::CITEXT, " + "\"priority\"=$5, " + "\"priority_comment\"=$6, " + "\"summary\"=$7, " + "\"description\"=$8, " + "\"description_type\"=$9, " + "\"package_description\"=$10, " + "\"package_description_type\"=$11, " + "\"changes\"=$12, " + "\"changes_type\"=$13, " + "\"url\"=$14, " + "\"url_comment\"=$15, " + "\"doc_url\"=$16, " + "\"doc_url_comment\"=$17, " + "\"src_url\"=$18, " + "\"src_url_comment\"=$19, " + "\"package_url\"=$20, " + "\"package_url_comment\"=$21, " + "\"email\"=$22, " + "\"email_comment\"=$23, " + "\"package_email\"=$24, " + "\"package_email_comment\"=$25, " + "\"build_email\"=$26, " + "\"build_email_comment\"=$27, " + "\"build_warning_email\"=$28, " + "\"build_warning_email_comment\"=$29, " + "\"build_error_email\"=$30, " + "\"build_error_email_comment\"=$31, " + "\"internal_repository_tenant\"=$32, " + "\"internal_repository_canonical_name\"=$33, " + "\"location\"=$34, " + "\"fragment\"=$35, " + "\"sha256sum\"=$36, " + "\"buildable\"=$37, " + "\"unbuildable_reason\"=$38, " + "\"custom_bot\"=$39, " + "\"search_index\"=to_tsvector($40::weighted_text) " + "WHERE \"tenant\"=$41 AND \"name\"=$42::CITEXT AND \"version_epoch\"=$43 AND \"version_canonical_upstream\"=$44 AND \"version_canonical_release\"=$45 AND \"version_revision\"=$46"; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::erase_statement[] = + "DELETE FROM \"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::package, id_pgsql >::query_statement[] = + "SELECT\n" + "\"package\".\"tenant\",\n" + "\"package\".\"name\"::TEXT,\n" + "\"package\".\"version_epoch\",\n" + "\"package\".\"version_canonical_upstream\",\n" + "\"package\".\"version_canonical_release\",\n" + "\"package\".\"version_revision\",\n" + "\"package\".\"version_upstream\",\n" + "\"package\".\"version_release\",\n" + "\"package\".\"upstream_version\",\n" + "\"package\".\"project\"::TEXT,\n" + "\"package\".\"priority\",\n" + "\"package\".\"priority_comment\",\n" + "\"package\".\"summary\",\n" + "\"package\".\"description\",\n" + "\"package\".\"description_type\",\n" + "\"package\".\"package_description\",\n" + "\"package\".\"package_description_type\",\n" + "\"package\".\"changes\",\n" + "\"package\".\"changes_type\",\n" + "\"package\".\"url\",\n" + "\"package\".\"url_comment\",\n" + "\"package\".\"doc_url\",\n" + "\"package\".\"doc_url_comment\",\n" + "\"package\".\"src_url\",\n" + "\"package\".\"src_url_comment\",\n" + "\"package\".\"package_url\",\n" + "\"package\".\"package_url_comment\",\n" + "\"package\".\"email\",\n" + "\"package\".\"email_comment\",\n" + "\"package\".\"package_email\",\n" + "\"package\".\"package_email_comment\",\n" + "\"package\".\"build_email\",\n" + "\"package\".\"build_email_comment\",\n" + "\"package\".\"build_warning_email\",\n" + "\"package\".\"build_warning_email_comment\",\n" + "\"package\".\"build_error_email\",\n" + "\"package\".\"build_error_email_comment\",\n" + "\"package\".\"internal_repository_tenant\",\n" + "\"package\".\"internal_repository_canonical_name\",\n" + "\"package\".\"location\",\n" + "\"package\".\"fragment\",\n" + "\"package\".\"sha256sum\",\n" + "\"package\".\"buildable\",\n" + "\"package\".\"unbuildable_reason\",\n" + "\"package\".\"custom_bot\",\n" + "COALESCE('',\"package\".\"search_index\")\n" + "FROM \"package\"\n" + "LEFT JOIN \"repository\" AS \"internal_repository\" ON \"internal_repository\".\"tenant\"=\"package\".\"internal_repository_tenant\" AND \"internal_repository\".\"canonical_name\"=\"package\".\"internal_repository_canonical_name\""; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::erase_query_statement[] = + "DELETE FROM \"package\""; + + const char access::object_traits_impl< ::brep::package, id_pgsql >::table_name[] = + "\"package\""; + + void access::object_traits_impl< ::brep::package, id_pgsql >:: + persist (database& db, const object_type& obj) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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 ()); + + // license_alternatives + // + { + ::brep::package::license_alternatives_type const& v = + obj.license_alternatives; + + license_alternatives_traits::persist ( + v, + esc.license_alternatives); + } + + // licenses + // + { + // From package.hxx:750:7 + ::std::map< ::odb::nested_key< ::bpkg::licenses >, ::std::basic_string< char > > const& v = + odb::nested_get (obj.license_alternatives); + + licenses_traits::persist ( + v, + esc.licenses); + } + + // topics + // + { + ::butl::small_vector< ::std::basic_string< char >, 5 > const& v = + obj.topics; + + topics_traits::persist ( + v, + esc.topics); + } + + // keywords + // + { + ::butl::small_vector< ::std::basic_string< char >, 5 > const& v = + obj.keywords; + + keywords_traits::persist ( + v, + esc.keywords); + } + + // dependencies + // + { + ::brep::package::dependencies_type const& v = + obj.dependencies; + + dependencies_traits::persist ( + v, + esc.dependencies); + } + + // dependency_alternatives + // + { + // From package.hxx:786:7 + ::std::map< ::odb::nested_key< ::brep::dependency_alternatives >, ::brep::dependency_alternative > const& v = + odb::nested_get (obj.dependencies); + + dependency_alternatives_traits::persist ( + v, + esc.dependency_alternatives); + } + + // dependency_alternative_dependencies + // + { + // From package.hxx:804:7 + ::std::map< ::odb::nested2_key< ::brep::dependency_alternatives >, ::brep::dependency > const& v = + odb::nested2_get (obj.dependencies); + + dependency_alternative_dependencies_traits::persist ( + v, + esc.dependency_alternative_dependencies); + } + + // requirements + // + { + ::brep::package::requirements_type const& v = + obj.requirements; + + requirements_traits::persist ( + v, + esc.requirements); + } + + // requirement_alternatives + // + { + // From package.hxx:822:7 + ::brep::requirement_alternatives_map const& v = + odb::nested_get (obj.requirements); + + requirement_alternatives_traits::persist ( + v, + esc.requirement_alternatives); + } + + // requirement_alternative_requirements + // + { + // From package.hxx:831:7 + ::brep::requirement_alternative_requirements_map const& v = + odb::nested2_get (obj.requirements); + + requirement_alternative_requirements_traits::persist ( + v, + esc.requirement_alternative_requirements); + } + + // tests + // + { + ::butl::small_vector< ::brep::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); + } + + // build_constraints + // + { + ::brep::package::build_constraints_type const& v = + obj.build_constraints; + + build_constraints_traits::persist ( + v, + esc.build_constraints); + } + + // build_auxiliaries + // + { + ::brep::package::build_auxiliaries_type const& v = + obj.build_auxiliaries; + + build_auxiliaries_traits::persist ( + v, + esc.build_auxiliaries); + } + + // build_bot_keys + // + { + ::brep::package_build_bot_keys const& v = + obj.build_bot_keys; + + build_bot_keys_traits::persist ( + v, + esc.build_bot_keys); + } + + // build_configs + // + { + ::brep::package_build_configs const& v = + obj.build_configs; + + build_configs_traits::persist ( + v, + esc.build_configs); + } + + // build_config_builds + // + { + // From package.hxx:872:7 + ::brep::build_class_exprs_map const& v = + odb::nested_get (brep::build_package_config_builds (obj.build_configs)); + + build_config_builds_traits::persist ( + v, + esc.build_config_builds); + } + + // build_config_constraints + // + { + // From package.hxx:883:7 + ::brep::build_constraints_map const& v = + odb::nested_get (brep::build_package_config_constraints (obj.build_configs)); + + build_config_constraints_traits::persist ( + v, + esc.build_config_constraints); + } + + // build_config_auxiliaries + // + { + // From package.hxx:894:7 + ::brep::build_auxiliaries_map const& v = + odb::nested_get (brep::build_package_config_auxiliaries (obj.build_configs)); + + build_config_auxiliaries_traits::persist ( + v, + esc.build_config_auxiliaries); + } + + // build_config_bot_keys + // + { + // From package.hxx:905:7 + ::brep::package_build_bot_keys_map const& v = + odb::nested_get (brep::build_package_config_bot_keys < lazy_shared_ptr < brep::public_key >> (obj.build_configs)); + + build_config_bot_keys_traits::persist ( + v, + esc.build_config_bot_keys); + } + + // other_repositories + // + { + ::std::vector< ::odb::lazy_shared_ptr< ::brep::repository > > const& v = + obj.other_repositories; + + other_repositories_traits::persist ( + v, + esc.other_repositories); + } + + obj.build_section.reset (true, false); + + obj.unused_section.reset (true, false); + + callback (db, + obj, + callback_event::post_persist); + } + + void access::object_traits_impl< ::brep::package, 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 (db)); + 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 ()); + + // license_alternatives + // + { + ::brep::package::license_alternatives_type const& v = + obj.license_alternatives; + + license_alternatives_traits::update ( + v, + esc.license_alternatives); + } + + // licenses + // + { + // From package.hxx:750:7 + ::std::map< ::odb::nested_key< ::bpkg::licenses >, ::std::basic_string< char > > const& v = + odb::nested_get (obj.license_alternatives); + + licenses_traits::update ( + v, + esc.licenses); + } + + // topics + // + { + ::butl::small_vector< ::std::basic_string< char >, 5 > const& v = + obj.topics; + + topics_traits::update ( + v, + esc.topics); + } + + // keywords + // + { + ::butl::small_vector< ::std::basic_string< char >, 5 > const& v = + obj.keywords; + + keywords_traits::update ( + v, + esc.keywords); + } + + // dependencies + // + { + ::brep::package::dependencies_type const& v = + obj.dependencies; + + dependencies_traits::update ( + v, + esc.dependencies); + } + + // dependency_alternatives + // + { + // From package.hxx:786:7 + ::std::map< ::odb::nested_key< ::brep::dependency_alternatives >, ::brep::dependency_alternative > const& v = + odb::nested_get (obj.dependencies); + + dependency_alternatives_traits::update ( + v, + esc.dependency_alternatives); + } + + // dependency_alternative_dependencies + // + { + // From package.hxx:804:7 + ::std::map< ::odb::nested2_key< ::brep::dependency_alternatives >, ::brep::dependency > const& v = + odb::nested2_get (obj.dependencies); + + dependency_alternative_dependencies_traits::update ( + v, + esc.dependency_alternative_dependencies); + } + + // requirements + // + { + ::brep::package::requirements_type const& v = + obj.requirements; + + requirements_traits::update ( + v, + esc.requirements); + } + + // requirement_alternatives + // + { + // From package.hxx:822:7 + ::brep::requirement_alternatives_map const& v = + odb::nested_get (obj.requirements); + + requirement_alternatives_traits::update ( + v, + esc.requirement_alternatives); + } + + // requirement_alternative_requirements + // + { + // From package.hxx:831:7 + ::brep::requirement_alternative_requirements_map const& v = + odb::nested2_get (obj.requirements); + + requirement_alternative_requirements_traits::update ( + v, + esc.requirement_alternative_requirements); + } + + // tests + // + { + ::butl::small_vector< ::brep::test_dependency, 1 > const& v = + obj.tests; + + tests_traits::update ( + v, + esc.tests); + } + + // other_repositories + // + { + ::std::vector< ::odb::lazy_shared_ptr< ::brep::repository > > const& v = + obj.other_repositories; + + other_repositories_traits::update ( + v, + esc.other_repositories); + } + + if (obj.build_section.loaded ()) + { + build_section_traits::update (esc, obj); + } + + callback (db, obj, callback_event::post_update); + pointer_cache_traits::update (db, obj); + } + + void access::object_traits_impl< ::brep::package, id_pgsql >:: + erase (database& db, const id_type& id) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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 ()); + + // license_alternatives + // + { + license_alternatives_traits::erase ( + esc.license_alternatives); + } + + // licenses + // + { + licenses_traits::erase ( + esc.licenses); + } + + // topics + // + { + topics_traits::erase ( + esc.topics); + } + + // keywords + // + { + keywords_traits::erase ( + esc.keywords); + } + + // dependencies + // + { + dependencies_traits::erase ( + esc.dependencies); + } + + // dependency_alternatives + // + { + dependency_alternatives_traits::erase ( + esc.dependency_alternatives); + } + + // dependency_alternative_dependencies + // + { + dependency_alternative_dependencies_traits::erase ( + esc.dependency_alternative_dependencies); + } + + // requirements + // + { + requirements_traits::erase ( + esc.requirements); + } + + // requirement_alternatives + // + { + requirement_alternatives_traits::erase ( + esc.requirement_alternatives); + } + + // requirement_alternative_requirements + // + { + requirement_alternative_requirements_traits::erase ( + esc.requirement_alternative_requirements); + } + + // tests + // + { + tests_traits::erase ( + esc.tests); + } + + // builds + // + { + builds_traits::erase ( + esc.builds); + } + + // build_constraints + // + { + build_constraints_traits::erase ( + esc.build_constraints); + } + + // build_auxiliaries + // + { + build_auxiliaries_traits::erase ( + esc.build_auxiliaries); + } + + // build_bot_keys + // + { + build_bot_keys_traits::erase ( + esc.build_bot_keys); + } + + // build_configs + // + { + build_configs_traits::erase ( + esc.build_configs); + } + + // build_config_builds + // + { + build_config_builds_traits::erase ( + esc.build_config_builds); + } + + // build_config_constraints + // + { + build_config_constraints_traits::erase ( + esc.build_config_constraints); + } + + // build_config_auxiliaries + // + { + build_config_auxiliaries_traits::erase ( + esc.build_config_auxiliaries); + } + + // build_config_bot_keys + // + { + build_config_bot_keys_traits::erase ( + esc.build_config_bot_keys); + } + + // other_repositories + // + { + other_repositories_traits::erase ( + esc.other_repositories); + } + + if (sts.erase_statement ().execute () != 1) + throw object_not_persistent (); + + pointer_cache_traits::erase (db, id); + } + + access::object_traits_impl< ::brep::package, id_pgsql >::pointer_type + access::object_traits_impl< ::brep::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 (db)); + 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::package, id_pgsql >:: + find (database& db, const id_type& id, object_type& obj) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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::package, id_pgsql >:: + reload (database& db, object_type& obj) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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::package, 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.build_section) + { + build_section_traits::load (esc, obj); + r = true; + } + + if (!r && &s == &obj.unused_section) + { + unused_section_traits::load (esc, obj); + r = true; + } + + sts.load_delayed (0); + l.unlock (); + return r; + } + + bool access::object_traits_impl< ::brep::package, 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.build_section)build_section_traits::update (esc, obj); + else if (&s == &obj.unused_section)unused_section_traits::update (esc, obj); + else + return false; + + return true; + } + + bool access::object_traits_impl< ::brep::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::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 ()); + + // license_alternatives + // + { + ::brep::package::license_alternatives_type& v = + obj.license_alternatives; + + license_alternatives_traits::load ( + v, + esc.license_alternatives); + } + + // licenses + // + { + ::std::map< ::odb::nested_key< ::bpkg::licenses >, ::std::basic_string< char > > v; + + licenses_traits::load ( + v, + esc.licenses); + + // From package.hxx:751:7 + odb::nested_set (obj.license_alternatives, std::move (v)); + } + + // topics + // + { + ::butl::small_vector< ::std::basic_string< char >, 5 >& v = + obj.topics; + + topics_traits::load ( + v, + esc.topics); + } + + // keywords + // + { + ::butl::small_vector< ::std::basic_string< char >, 5 >& v = + obj.keywords; + + keywords_traits::load ( + v, + esc.keywords); + } + + // dependencies + // + { + ::brep::package::dependencies_type& v = + obj.dependencies; + + dependencies_traits::load ( + v, + esc.dependencies); + } + + // dependency_alternatives + // + { + ::std::map< ::odb::nested_key< ::brep::dependency_alternatives >, ::brep::dependency_alternative > v; + + dependency_alternatives_traits::load ( + v, + esc.dependency_alternatives); + + // From package.hxx:787:7 + odb::nested_set (obj.dependencies, std::move (v)); + } + + // dependency_alternative_dependencies + // + { + ::std::map< ::odb::nested2_key< ::brep::dependency_alternatives >, ::brep::dependency > v; + + dependency_alternative_dependencies_traits::load ( + v, + esc.dependency_alternative_dependencies); + + // From package.hxx:805:7 + odb::nested2_set (obj.dependencies, std::move (v)); + } + + // requirements + // + { + ::brep::package::requirements_type& v = + obj.requirements; + + requirements_traits::load ( + v, + esc.requirements); + } + + // requirement_alternatives + // + { + ::brep::requirement_alternatives_map v; + + requirement_alternatives_traits::load ( + v, + esc.requirement_alternatives); + + // From package.hxx:823:7 + odb::nested_set (obj.requirements, std::move (v)); + } + + // requirement_alternative_requirements + // + { + ::brep::requirement_alternative_requirements_map v; + + requirement_alternative_requirements_traits::load ( + v, + esc.requirement_alternative_requirements); + + // From package.hxx:832:7 + odb::nested2_set (obj.requirements, std::move (v)); + } + + // tests + // + { + ::butl::small_vector< ::brep::test_dependency, 1 >& v = + obj.tests; + + tests_traits::load ( + v, + esc.tests); + } + + // other_repositories + // + { + ::std::vector< ::odb::lazy_shared_ptr< ::brep::repository > >& v = + obj.other_repositories; + + other_repositories_traits::load ( + v, + esc.other_repositories); + } + + if (reload) + { + if (obj.build_section.loaded ()) + { + build_section_traits::load (esc, obj); + obj.build_section.reset (true, false); + } + } + else + obj.build_section.reset (); + + if (reload) + { + if (obj.unused_section.loaded ()) + { + unused_section_traits::load (esc, obj); + obj.unused_section.reset (true, false); + } + } + else + obj.unused_section.reset (); + } + + result< access::object_traits_impl< ::brep::package, id_pgsql >::object_type > + access::object_traits_impl< ::brep::package, id_pgsql >:: + query (database& db, const query_base_type& q) + { + using namespace pgsql; + using odb::details::shared; + using odb::details::shared_ptr; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + + 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::package, id_pgsql >:: + erase_query (database& db, const query_base_type& q) + { + using namespace pgsql; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + + 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::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::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::transaction& tr (pgsql::transaction::current ()); + ODB_POTENTIALLY_UNUSED (tr); + + // The connection used by the current transaction and the + // one used to prepare this statement must be the same. + // + assert (q.verify_connection (tr)); + + statements_type& sts ( + st->connection ().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)); + } + + // latest_package_search_rank + // + + const char access::view_traits_impl< ::brep::latest_package_search_rank, id_pgsql >:: + query_statement_name[] = "query_brep_latest_package_search_rank"; + + bool access::view_traits_impl< ::brep::latest_package_search_rank, 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; + + // rank + // + t[6UL] = 0; + + return grew; + } + + void access::view_traits_impl< ::brep::latest_package_search_rank, 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; + + // rank + // + b[n].type = pgsql::bind::double_; + b[n].buffer = &i.rank_value; + b[n].is_null = &i.rank_null; + n++; + } + + void access::view_traits_impl< ::brep::latest_package_search_rank, 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); + } + + // rank + // + { + double& v = + o.rank; + + pgsql::value_traits< + double, + pgsql::id_double >::set_value ( + v, + i.rank_value, + i.rank_null); + } + } + + access::view_traits_impl< ::brep::latest_package_search_rank, id_pgsql >::query_base_type + access::view_traits_impl< ::brep::latest_package_search_rank, id_pgsql >:: + query_statement (const query_base_type& q) + { + query_base_type r ( + "SELECT * FROM search_latest_packages" + q); + return r; + } + + result< access::view_traits_impl< ::brep::latest_package_search_rank, id_pgsql >::view_type > + access::view_traits_impl< ::brep::latest_package_search_rank, id_pgsql >:: + query (database& db, const query_base_type& q) + { + using namespace pgsql; + using odb::details::shared; + using odb::details::shared_ptr; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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::latest_package_search_rank, 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::latest_package_search_rank, 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::transaction& tr (pgsql::transaction::current ()); + ODB_POTENTIALLY_UNUSED (tr); + + // The connection used by the current transaction and the + // one used to prepare this statement must be the same. + // + assert (q.verify_connection (tr)); + + statements_type& sts ( + st->connection ().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)); + } + + // latest_package_count + // + + const char access::view_traits_impl< ::brep::latest_package_count, id_pgsql >:: + query_statement_name[] = "query_brep_latest_package_count"; + + bool access::view_traits_impl< ::brep::latest_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::latest_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::latest_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::latest_package_count, id_pgsql >::query_base_type + access::view_traits_impl< ::brep::latest_package_count, id_pgsql >:: + query_statement (const query_base_type& q) + { + query_base_type r ( + "SELECT count(*) FROM search_latest_packages" + q); + return r; + } + + result< access::view_traits_impl< ::brep::latest_package_count, id_pgsql >::view_type > + access::view_traits_impl< ::brep::latest_package_count, id_pgsql >:: + query (database& db, const query_base_type& q) + { + using namespace pgsql; + using odb::details::shared; + using odb::details::shared_ptr; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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::latest_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::latest_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::transaction& tr (pgsql::transaction::current ()); + ODB_POTENTIALLY_UNUSED (tr); + + // The connection used by the current transaction and the + // one used to prepare this statement must be the same. + // + assert (q.verify_connection (tr)); + + statements_type& sts ( + st->connection ().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_search_rank + // + + const char access::view_traits_impl< ::brep::package_search_rank, id_pgsql >:: + query_statement_name[] = "query_brep_package_search_rank"; + + bool access::view_traits_impl< ::brep::package_search_rank, 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; + + // rank + // + t[6UL] = 0; + + return grew; + } + + void access::view_traits_impl< ::brep::package_search_rank, 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; + + // rank + // + b[n].type = pgsql::bind::double_; + b[n].buffer = &i.rank_value; + b[n].is_null = &i.rank_null; + n++; + } + + void access::view_traits_impl< ::brep::package_search_rank, 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); + } + + // rank + // + { + double& v = + o.rank; + + pgsql::value_traits< + double, + pgsql::id_double >::set_value ( + v, + i.rank_value, + i.rank_null); + } + } + + access::view_traits_impl< ::brep::package_search_rank, id_pgsql >::query_base_type + access::view_traits_impl< ::brep::package_search_rank, id_pgsql >:: + query_statement (const query_base_type& q) + { + query_base_type r ( + "SELECT * FROM search_packages" + q); + return r; + } + + result< access::view_traits_impl< ::brep::package_search_rank, id_pgsql >::view_type > + access::view_traits_impl< ::brep::package_search_rank, id_pgsql >:: + query (database& db, const query_base_type& q) + { + using namespace pgsql; + using odb::details::shared; + using odb::details::shared_ptr; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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_search_rank, 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_search_rank, 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::transaction& tr (pgsql::transaction::current ()); + ODB_POTENTIALLY_UNUSED (tr); + + // The connection used by the current transaction and the + // one used to prepare this statement must be the same. + // + assert (q.verify_connection (tr)); + + statements_type& sts ( + st->connection ().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_count + // + + const char access::view_traits_impl< ::brep::package_count, id_pgsql >:: + query_statement_name[] = "query_brep_package_count"; + + bool access::view_traits_impl< ::brep::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::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::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::package_count, id_pgsql >::query_base_type + access::view_traits_impl< ::brep::package_count, id_pgsql >:: + query_statement (const query_base_type& q) + { + query_base_type r ( + "SELECT count(*) FROM search_packages" + q); + return r; + } + + result< access::view_traits_impl< ::brep::package_count, id_pgsql >::view_type > + access::view_traits_impl< ::brep::package_count, id_pgsql >:: + query (database& db, const query_base_type& q) + { + using namespace pgsql; + using odb::details::shared; + using odb::details::shared_ptr; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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_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_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::transaction& tr (pgsql::transaction::current ()); + ODB_POTENTIALLY_UNUSED (tr); + + // The connection used by the current transaction and the + // one used to prepare this statement must be the same. + // + assert (q.verify_connection (tr)); + + statements_type& sts ( + st->connection ().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)); + } + + // latest_package + // + + const char access::view_traits_impl< ::brep::latest_package, id_pgsql >:: + query_statement_name[] = "query_brep_latest_package"; + + bool access::view_traits_impl< ::brep::latest_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; + + return grew; + } + + void access::view_traits_impl< ::brep::latest_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; + } + + void access::view_traits_impl< ::brep::latest_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); + } + } + + access::view_traits_impl< ::brep::latest_package, id_pgsql >::query_base_type + access::view_traits_impl< ::brep::latest_package, id_pgsql >:: + query_statement (const query_base_type& q) + { + query_base_type r ( + "SELECT * FROM latest_package" + q); + return r; + } + + result< access::view_traits_impl< ::brep::latest_package, id_pgsql >::view_type > + access::view_traits_impl< ::brep::latest_package, id_pgsql >:: + query (database& db, const query_base_type& q) + { + using namespace pgsql; + using odb::details::shared; + using odb::details::shared_ptr; + + pgsql::connection& conn ( + pgsql::transaction::current ().connection (db)); + 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::latest_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::latest_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::transaction& tr (pgsql::transaction::current ()); + ODB_POTENTIALLY_UNUSED (tr); + + // The connection used by the current transaction and the + // one used to prepare this statement must be the same. + // + assert (q.verify_connection (tr)); + + statements_type& sts ( + st->connection ().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)); + } +} + +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 \"package_other_repositories\" CASCADE"); + db.execute ("DROP TABLE IF EXISTS \"package_build_config_bot_keys\" CASCADE"); + db.execute ("DROP TABLE IF EXISTS \"package_build_config_auxiliaries\" CASCADE"); + db.execute ("DROP TABLE IF EXISTS \"package_build_config_constraints\" CASCADE"); + db.execute ("DROP TABLE IF EXISTS \"package_build_config_builds\" CASCADE"); + db.execute ("DROP TABLE IF EXISTS \"package_build_configs\" CASCADE"); + db.execute ("DROP TABLE IF EXISTS \"package_build_bot_keys\" CASCADE"); + db.execute ("DROP TABLE IF EXISTS \"package_build_auxiliaries\" CASCADE"); + db.execute ("DROP TABLE IF EXISTS \"package_build_constraints\" CASCADE"); + db.execute ("DROP TABLE IF EXISTS \"package_builds\" CASCADE"); + db.execute ("DROP TABLE IF EXISTS \"package_tests\" CASCADE"); + db.execute ("DROP TABLE IF EXISTS \"package_requirement_alternative_requirements\" CASCADE"); + db.execute ("DROP TABLE IF EXISTS \"package_requirement_alternatives\" CASCADE"); + db.execute ("DROP TABLE IF EXISTS \"package_requirements\" CASCADE"); + db.execute ("DROP TABLE IF EXISTS \"package_dependency_alternative_dependencies\" CASCADE"); + db.execute ("DROP TABLE IF EXISTS \"package_dependency_alternatives\" CASCADE"); + db.execute ("DROP TABLE IF EXISTS \"package_dependencies\" CASCADE"); + db.execute ("DROP TABLE IF EXISTS \"package_keywords\" CASCADE"); + db.execute ("DROP TABLE IF EXISTS \"package_topics\" CASCADE"); + db.execute ("DROP TABLE IF EXISTS \"package_licenses\" CASCADE"); + db.execute ("DROP TABLE IF EXISTS \"package_license_alternatives\" CASCADE"); + db.execute ("DROP TABLE IF EXISTS \"package\" CASCADE"); + db.execute ("DROP TABLE IF EXISTS \"public_key\" CASCADE"); + db.execute ("DROP TABLE IF EXISTS \"repository_prerequisites\" CASCADE"); + db.execute ("DROP TABLE IF EXISTS \"repository_complements\" CASCADE"); + db.execute ("DROP TABLE IF EXISTS \"repository\" CASCADE"); + db.execute ("DROP TABLE IF EXISTS \"tenant\" CASCADE"); + db.execute ("DROP TABLE IF EXISTS \"schema_version\""); + return false; + } + } + } + else + { + switch (pass) + { + case 1: + { + db.execute ("CREATE TABLE \"tenant\" (\n" + " \"id\" TEXT NOT NULL PRIMARY KEY,\n" + " \"private\" BOOLEAN NOT NULL,\n" + " \"interactive\" TEXT NULL,\n" + " \"creation_timestamp\" BIGINT NOT NULL,\n" + " \"archived\" BOOLEAN NOT NULL,\n" + " \"service_id\" TEXT NULL,\n" + " \"service_type\" TEXT NULL,\n" + " \"service_data\" TEXT NULL,\n" + " \"loaded_timestamp\" BIGINT NULL,\n" + " \"queued_timestamp\" BIGINT NULL,\n" + " \"build_toolchain_name\" TEXT NULL,\n" + " \"build_toolchain_version_epoch\" INTEGER NULL,\n" + " \"build_toolchain_version_canonical_upstream\" TEXT NULL,\n" + " \"build_toolchain_version_canonical_release\" TEXT NULL,\n" + " \"build_toolchain_version_revision\" INTEGER NULL,\n" + " \"build_toolchain_version_upstream\" TEXT NULL,\n" + " \"build_toolchain_version_release\" TEXT NULL)"); + db.execute ("CREATE UNIQUE INDEX \"tenant_service_i\"\n" + " ON \"tenant\" (\n" + " \"service_id\",\n" + " \"service_type\")"); + db.execute ("CREATE INDEX \"tenant_service_id_i\"\n" + " ON \"tenant\" (\"service_id\")"); + db.execute ("CREATE INDEX \"tenant_loaded_timestamp_i\"\n" + " ON \"tenant\" (\"loaded_timestamp\")"); + db.execute ("CREATE TABLE \"repository\" (\n" + " \"tenant\" TEXT NOT NULL,\n" + " \"canonical_name\" TEXT NOT NULL,\n" + " \"location_url\" TEXT NOT NULL,\n" + " \"location_type\" TEXT NOT NULL,\n" + " \"display_name\" TEXT NOT NULL,\n" + " \"priority\" INTEGER NOT NULL,\n" + " \"interface_url\" TEXT NULL,\n" + " \"email\" TEXT NULL,\n" + " \"email_comment\" TEXT NULL,\n" + " \"summary\" TEXT NULL,\n" + " \"description\" TEXT NULL,\n" + " \"cache_location_url\" TEXT NOT NULL,\n" + " \"cache_location_type\" TEXT NOT NULL,\n" + " \"certificate_fingerprint\" TEXT NULL,\n" + " \"certificate_name\" TEXT NULL,\n" + " \"certificate_organization\" TEXT NULL,\n" + " \"certificate_email\" TEXT NULL,\n" + " \"certificate_pem\" TEXT NULL,\n" + " \"packages_timestamp\" BIGINT NOT NULL,\n" + " \"repositories_timestamp\" BIGINT NOT NULL,\n" + " \"internal\" BOOLEAN NOT NULL,\n" + " \"buildable\" BOOLEAN NOT NULL,\n" + " PRIMARY KEY (\"tenant\",\n" + " \"canonical_name\"),\n" + " CONSTRAINT \"tenant_fk\"\n" + " FOREIGN KEY (\"tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED)"); + db.execute ("CREATE TABLE \"repository_complements\" (\n" + " \"repository_tenant\" TEXT NOT NULL,\n" + " \"repository_canonical_name\" TEXT NOT NULL,\n" + " \"index\" BIGINT NOT NULL,\n" + " \"complement_tenant\" TEXT NOT NULL,\n" + " \"complement_canonical_name\" TEXT NOT NULL,\n" + " CONSTRAINT \"repository_tenant_fk\"\n" + " FOREIGN KEY (\"repository_tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " CONSTRAINT \"repository_fk\"\n" + " FOREIGN KEY (\"repository_tenant\",\n" + " \"repository_canonical_name\")\n" + " REFERENCES \"repository\" (\"tenant\",\n" + " \"canonical_name\")\n" + " ON DELETE CASCADE,\n" + " CONSTRAINT \"complement_tenant_fk\"\n" + " FOREIGN KEY (\"complement_tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " CONSTRAINT \"complement_fk\"\n" + " FOREIGN KEY (\"complement_tenant\",\n" + " \"complement_canonical_name\")\n" + " REFERENCES \"repository\" (\"tenant\",\n" + " \"canonical_name\")\n" + " INITIALLY DEFERRED)"); + db.execute ("CREATE INDEX \"repository_complements_repository_i\"\n" + " ON \"repository_complements\" (\n" + " \"repository_tenant\",\n" + " \"repository_canonical_name\")"); + db.execute ("CREATE INDEX \"repository_complements_index_i\"\n" + " ON \"repository_complements\" (\"index\")"); + db.execute ("CREATE TABLE \"repository_prerequisites\" (\n" + " \"repository_tenant\" TEXT NOT NULL,\n" + " \"repository_canonical_name\" TEXT NOT NULL,\n" + " \"index\" BIGINT NOT NULL,\n" + " \"prerequisite_tenant\" TEXT NOT NULL,\n" + " \"prerequisite_canonical_name\" TEXT NOT NULL,\n" + " CONSTRAINT \"repository_tenant_fk\"\n" + " FOREIGN KEY (\"repository_tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " CONSTRAINT \"repository_fk\"\n" + " FOREIGN KEY (\"repository_tenant\",\n" + " \"repository_canonical_name\")\n" + " REFERENCES \"repository\" (\"tenant\",\n" + " \"canonical_name\")\n" + " ON DELETE CASCADE,\n" + " CONSTRAINT \"prerequisite_tenant_fk\"\n" + " FOREIGN KEY (\"prerequisite_tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " CONSTRAINT \"prerequisite_fk\"\n" + " FOREIGN KEY (\"prerequisite_tenant\",\n" + " \"prerequisite_canonical_name\")\n" + " REFERENCES \"repository\" (\"tenant\",\n" + " \"canonical_name\")\n" + " INITIALLY DEFERRED)"); + db.execute ("CREATE INDEX \"repository_prerequisites_repository_i\"\n" + " ON \"repository_prerequisites\" (\n" + " \"repository_tenant\",\n" + " \"repository_canonical_name\")"); + db.execute ("CREATE INDEX \"repository_prerequisites_index_i\"\n" + " ON \"repository_prerequisites\" (\"index\")"); + db.execute ("CREATE TABLE \"public_key\" (\n" + " \"tenant\" TEXT NOT NULL,\n" + " \"fingerprint\" TEXT NOT NULL,\n" + " \"data\" TEXT NOT NULL,\n" + " PRIMARY KEY (\"tenant\",\n" + " \"fingerprint\"),\n" + " CONSTRAINT \"tenant_fk\"\n" + " FOREIGN KEY (\"tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED)"); + db.execute ("CREATE TABLE \"package\" (\n" + " \"tenant\" TEXT NOT NULL,\n" + " \"name\" CITEXT NOT NULL,\n" + " \"version_epoch\" INTEGER NOT NULL,\n" + " \"version_canonical_upstream\" TEXT NOT NULL,\n" + " \"version_canonical_release\" TEXT NOT NULL COLLATE \"C\",\n" + " \"version_revision\" INTEGER NOT NULL,\n" + " \"version_upstream\" TEXT NOT NULL,\n" + " \"version_release\" TEXT NULL,\n" + " \"upstream_version\" TEXT NULL,\n" + " \"project\" CITEXT NOT NULL,\n" + " \"priority\" INTEGER NOT NULL,\n" + " \"priority_comment\" TEXT NOT NULL,\n" + " \"summary\" TEXT NOT NULL,\n" + " \"description\" TEXT NULL,\n" + " \"description_type\" TEXT NULL,\n" + " \"package_description\" TEXT NULL,\n" + " \"package_description_type\" TEXT NULL,\n" + " \"changes\" TEXT NULL,\n" + " \"changes_type\" TEXT NULL,\n" + " \"url\" TEXT NULL,\n" + " \"url_comment\" TEXT NULL,\n" + " \"doc_url\" TEXT NULL,\n" + " \"doc_url_comment\" TEXT NULL,\n" + " \"src_url\" TEXT NULL,\n" + " \"src_url_comment\" TEXT NULL,\n" + " \"package_url\" TEXT NULL,\n" + " \"package_url_comment\" TEXT NULL,\n" + " \"email\" TEXT NULL,\n" + " \"email_comment\" TEXT NULL,\n" + " \"package_email\" TEXT NULL,\n" + " \"package_email_comment\" TEXT NULL,\n" + " \"build_email\" TEXT NULL,\n" + " \"build_email_comment\" TEXT NULL,\n" + " \"build_warning_email\" TEXT NULL,\n" + " \"build_warning_email_comment\" TEXT NULL,\n" + " \"build_error_email\" TEXT NULL,\n" + " \"build_error_email_comment\" TEXT NULL,\n" + " \"internal_repository_tenant\" TEXT NULL,\n" + " \"internal_repository_canonical_name\" TEXT NULL,\n" + " \"location\" TEXT NULL,\n" + " \"fragment\" TEXT NULL,\n" + " \"sha256sum\" TEXT NULL,\n" + " \"buildable\" BOOLEAN NOT NULL,\n" + " \"unbuildable_reason\" TEXT NULL,\n" + " \"custom_bot\" BOOLEAN NULL,\n" + " \"search_index\" tsvector NULL,\n" + " PRIMARY KEY (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\"),\n" + " CONSTRAINT \"tenant_fk\"\n" + " FOREIGN KEY (\"tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " CONSTRAINT \"internal_repository_tenant_fk\"\n" + " FOREIGN KEY (\"internal_repository_tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " CONSTRAINT \"internal_repository_fk\"\n" + " FOREIGN KEY (\"internal_repository_tenant\",\n" + " \"internal_repository_canonical_name\")\n" + " REFERENCES \"repository\" (\"tenant\",\n" + " \"canonical_name\")\n" + " INITIALLY DEFERRED)"); + db.execute ("CREATE INDEX \"package_search_index_i\"\n" + " ON \"package\" USING GIN (\"search_index\")"); + db.execute ("CREATE TABLE \"package_license_alternatives\" (\n" + " \"tenant\" TEXT NOT NULL,\n" + " \"name\" CITEXT NOT NULL,\n" + " \"version_epoch\" INTEGER NOT NULL,\n" + " \"version_canonical_upstream\" TEXT NOT NULL,\n" + " \"version_canonical_release\" TEXT NOT NULL COLLATE \"C\",\n" + " \"version_revision\" INTEGER NOT NULL,\n" + " \"index\" BIGINT NOT NULL,\n" + " \"comment\" TEXT NOT NULL,\n" + " CONSTRAINT \"tenant_fk\"\n" + " FOREIGN KEY (\"tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " CONSTRAINT \"object_id_fk\"\n" + " FOREIGN KEY (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " REFERENCES \"package\" (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " ON DELETE CASCADE)"); + db.execute ("CREATE INDEX \"package_license_alternatives_object_id_i\"\n" + " ON \"package_license_alternatives\" (\n" + " \"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")"); + db.execute ("CREATE INDEX \"package_license_alternatives_index_i\"\n" + " ON \"package_license_alternatives\" (\"index\")"); + db.execute ("CREATE TABLE \"package_licenses\" (\n" + " \"tenant\" TEXT NOT NULL,\n" + " \"name\" CITEXT NOT NULL,\n" + " \"version_epoch\" INTEGER NOT NULL,\n" + " \"version_canonical_upstream\" TEXT NOT NULL,\n" + " \"version_canonical_release\" TEXT NOT NULL COLLATE \"C\",\n" + " \"version_revision\" INTEGER NOT NULL,\n" + " \"alternative_index\" BIGINT NOT NULL,\n" + " \"index\" BIGINT NOT NULL,\n" + " \"license\" TEXT NOT NULL,\n" + " CONSTRAINT \"tenant_fk\"\n" + " FOREIGN KEY (\"tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " CONSTRAINT \"object_id_fk\"\n" + " FOREIGN KEY (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " REFERENCES \"package\" (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " ON DELETE CASCADE)"); + db.execute ("CREATE INDEX \"package_licenses_object_id_i\"\n" + " ON \"package_licenses\" (\n" + " \"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")"); + db.execute ("CREATE TABLE \"package_topics\" (\n" + " \"tenant\" TEXT NOT NULL,\n" + " \"name\" CITEXT NOT NULL,\n" + " \"version_epoch\" INTEGER NOT NULL,\n" + " \"version_canonical_upstream\" TEXT NOT NULL,\n" + " \"version_canonical_release\" TEXT NOT NULL COLLATE \"C\",\n" + " \"version_revision\" INTEGER NOT NULL,\n" + " \"index\" BIGINT NOT NULL,\n" + " \"topic\" TEXT NOT NULL,\n" + " CONSTRAINT \"tenant_fk\"\n" + " FOREIGN KEY (\"tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " CONSTRAINT \"object_id_fk\"\n" + " FOREIGN KEY (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " REFERENCES \"package\" (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " ON DELETE CASCADE)"); + db.execute ("CREATE INDEX \"package_topics_object_id_i\"\n" + " ON \"package_topics\" (\n" + " \"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")"); + db.execute ("CREATE INDEX \"package_topics_index_i\"\n" + " ON \"package_topics\" (\"index\")"); + db.execute ("CREATE TABLE \"package_keywords\" (\n" + " \"tenant\" TEXT NOT NULL,\n" + " \"name\" CITEXT NOT NULL,\n" + " \"version_epoch\" INTEGER NOT NULL,\n" + " \"version_canonical_upstream\" TEXT NOT NULL,\n" + " \"version_canonical_release\" TEXT NOT NULL COLLATE \"C\",\n" + " \"version_revision\" INTEGER NOT NULL,\n" + " \"index\" BIGINT NOT NULL,\n" + " \"keyword\" TEXT NOT NULL,\n" + " CONSTRAINT \"tenant_fk\"\n" + " FOREIGN KEY (\"tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " CONSTRAINT \"object_id_fk\"\n" + " FOREIGN KEY (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " REFERENCES \"package\" (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " ON DELETE CASCADE)"); + db.execute ("CREATE INDEX \"package_keywords_object_id_i\"\n" + " ON \"package_keywords\" (\n" + " \"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")"); + db.execute ("CREATE INDEX \"package_keywords_index_i\"\n" + " ON \"package_keywords\" (\"index\")"); + db.execute ("CREATE TABLE \"package_dependencies\" (\n" + " \"tenant\" TEXT NOT NULL,\n" + " \"name\" CITEXT NOT NULL,\n" + " \"version_epoch\" INTEGER NOT NULL,\n" + " \"version_canonical_upstream\" TEXT NOT NULL,\n" + " \"version_canonical_release\" TEXT NOT NULL COLLATE \"C\",\n" + " \"version_revision\" INTEGER NOT NULL,\n" + " \"index\" BIGINT NOT NULL,\n" + " \"buildtime\" BOOLEAN NOT NULL,\n" + " \"comment\" TEXT NOT NULL,\n" + " CONSTRAINT \"tenant_fk\"\n" + " FOREIGN KEY (\"tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " CONSTRAINT \"object_id_fk\"\n" + " FOREIGN KEY (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " REFERENCES \"package\" (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " ON DELETE CASCADE)"); + db.execute ("CREATE INDEX \"package_dependencies_object_id_i\"\n" + " ON \"package_dependencies\" (\n" + " \"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")"); + db.execute ("CREATE INDEX \"package_dependencies_index_i\"\n" + " ON \"package_dependencies\" (\"index\")"); + db.execute ("CREATE TABLE \"package_dependency_alternatives\" (\n" + " \"tenant\" TEXT NOT NULL,\n" + " \"name\" CITEXT NOT NULL,\n" + " \"version_epoch\" INTEGER NOT NULL,\n" + " \"version_canonical_upstream\" TEXT NOT NULL,\n" + " \"version_canonical_release\" TEXT NOT NULL COLLATE \"C\",\n" + " \"version_revision\" INTEGER NOT NULL,\n" + " \"dependency_index\" BIGINT NOT NULL,\n" + " \"index\" BIGINT NOT NULL,\n" + " \"enable\" TEXT NULL,\n" + " \"reflect\" TEXT NULL,\n" + " \"prefer\" TEXT NULL,\n" + " \"accept\" TEXT NULL,\n" + " \"require\" TEXT NULL,\n" + " CONSTRAINT \"tenant_fk\"\n" + " FOREIGN KEY (\"tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " CONSTRAINT \"object_id_fk\"\n" + " FOREIGN KEY (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " REFERENCES \"package\" (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " ON DELETE CASCADE)"); + db.execute ("CREATE INDEX \"package_dependency_alternatives_object_id_i\"\n" + " ON \"package_dependency_alternatives\" (\n" + " \"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")"); + db.execute ("CREATE TABLE \"package_dependency_alternative_dependencies\" (\n" + " \"tenant\" TEXT NOT NULL,\n" + " \"name\" CITEXT NOT NULL,\n" + " \"version_epoch\" INTEGER NOT NULL,\n" + " \"version_canonical_upstream\" TEXT NOT NULL,\n" + " \"version_canonical_release\" TEXT NOT NULL COLLATE \"C\",\n" + " \"version_revision\" INTEGER NOT NULL,\n" + " \"dependency_index\" BIGINT NOT NULL,\n" + " \"alternative_index\" BIGINT NOT NULL,\n" + " \"index\" BIGINT NOT NULL,\n" + " \"dep_name\" CITEXT NOT NULL,\n" + " \"dep_min_version_epoch\" INTEGER NULL,\n" + " \"dep_min_version_canonical_upstream\" TEXT NULL,\n" + " \"dep_min_version_canonical_release\" TEXT NULL,\n" + " \"dep_min_version_revision\" INTEGER NULL,\n" + " \"dep_min_version_upstream\" TEXT NULL,\n" + " \"dep_min_version_release\" TEXT NULL,\n" + " \"dep_max_version_epoch\" INTEGER NULL,\n" + " \"dep_max_version_canonical_upstream\" TEXT NULL,\n" + " \"dep_max_version_canonical_release\" TEXT NULL,\n" + " \"dep_max_version_revision\" INTEGER NULL,\n" + " \"dep_max_version_upstream\" TEXT NULL,\n" + " \"dep_max_version_release\" TEXT NULL,\n" + " \"dep_min_open\" BOOLEAN NULL,\n" + " \"dep_max_open\" BOOLEAN NULL,\n" + " \"dep_package_tenant\" TEXT NULL,\n" + " \"dep_package_name\" CITEXT NULL,\n" + " \"dep_package_version_epoch\" INTEGER NULL,\n" + " \"dep_package_version_canonical_upstream\" TEXT NULL,\n" + " \"dep_package_version_canonical_release\" TEXT NULL COLLATE \"C\",\n" + " \"dep_package_version_revision\" INTEGER NULL,\n" + " CONSTRAINT \"tenant_fk\"\n" + " FOREIGN KEY (\"tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " CONSTRAINT \"object_id_fk\"\n" + " FOREIGN KEY (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " REFERENCES \"package\" (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " ON DELETE CASCADE,\n" + " CONSTRAINT \"dep_package_tenant_fk\"\n" + " FOREIGN KEY (\"dep_package_tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " CONSTRAINT \"dep_package_fk\"\n" + " FOREIGN KEY (\"dep_package_tenant\",\n" + " \"dep_package_name\",\n" + " \"dep_package_version_epoch\",\n" + " \"dep_package_version_canonical_upstream\",\n" + " \"dep_package_version_canonical_release\",\n" + " \"dep_package_version_revision\")\n" + " REFERENCES \"package\" (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " INITIALLY DEFERRED)"); + db.execute ("CREATE INDEX \"package_dependency_alternative_dependencies_object_id_i\"\n" + " ON \"package_dependency_alternative_dependencies\" (\n" + " \"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")"); + db.execute ("CREATE TABLE \"package_requirements\" (\n" + " \"tenant\" TEXT NOT NULL,\n" + " \"name\" CITEXT NOT NULL,\n" + " \"version_epoch\" INTEGER NOT NULL,\n" + " \"version_canonical_upstream\" TEXT NOT NULL,\n" + " \"version_canonical_release\" TEXT NOT NULL COLLATE \"C\",\n" + " \"version_revision\" INTEGER NOT NULL,\n" + " \"index\" BIGINT NOT NULL,\n" + " \"buildtime\" BOOLEAN NOT NULL,\n" + " \"comment\" TEXT NOT NULL,\n" + " CONSTRAINT \"tenant_fk\"\n" + " FOREIGN KEY (\"tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " CONSTRAINT \"object_id_fk\"\n" + " FOREIGN KEY (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " REFERENCES \"package\" (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " ON DELETE CASCADE)"); + db.execute ("CREATE INDEX \"package_requirements_object_id_i\"\n" + " ON \"package_requirements\" (\n" + " \"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")"); + db.execute ("CREATE INDEX \"package_requirements_index_i\"\n" + " ON \"package_requirements\" (\"index\")"); + db.execute ("CREATE TABLE \"package_requirement_alternatives\" (\n" + " \"tenant\" TEXT NOT NULL,\n" + " \"name\" CITEXT NOT NULL,\n" + " \"version_epoch\" INTEGER NOT NULL,\n" + " \"version_canonical_upstream\" TEXT NOT NULL,\n" + " \"version_canonical_release\" TEXT NOT NULL COLLATE \"C\",\n" + " \"version_revision\" INTEGER NOT NULL,\n" + " \"requirement_index\" BIGINT NOT NULL,\n" + " \"index\" BIGINT NOT NULL,\n" + " \"enable\" TEXT NULL,\n" + " \"reflect\" TEXT NULL,\n" + " CONSTRAINT \"tenant_fk\"\n" + " FOREIGN KEY (\"tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " CONSTRAINT \"object_id_fk\"\n" + " FOREIGN KEY (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " REFERENCES \"package\" (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " ON DELETE CASCADE)"); + db.execute ("CREATE INDEX \"package_requirement_alternatives_object_id_i\"\n" + " ON \"package_requirement_alternatives\" (\n" + " \"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")"); + db.execute ("CREATE TABLE \"package_requirement_alternative_requirements\" (\n" + " \"tenant\" TEXT NOT NULL,\n" + " \"name\" CITEXT NOT NULL,\n" + " \"version_epoch\" INTEGER NOT NULL,\n" + " \"version_canonical_upstream\" TEXT NOT NULL,\n" + " \"version_canonical_release\" TEXT NOT NULL COLLATE \"C\",\n" + " \"version_revision\" INTEGER NOT NULL,\n" + " \"requirement_index\" BIGINT NOT NULL,\n" + " \"alternative_index\" BIGINT NOT NULL,\n" + " \"index\" BIGINT NOT NULL,\n" + " \"id\" TEXT NOT NULL,\n" + " CONSTRAINT \"tenant_fk\"\n" + " FOREIGN KEY (\"tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " CONSTRAINT \"object_id_fk\"\n" + " FOREIGN KEY (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " REFERENCES \"package\" (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " ON DELETE CASCADE)"); + db.execute ("CREATE INDEX \"package_requirement_alternative_requirements_object_id_i\"\n" + " ON \"package_requirement_alternative_requirements\" (\n" + " \"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")"); + db.execute ("CREATE TABLE \"package_tests\" (\n" + " \"tenant\" TEXT NOT NULL,\n" + " \"name\" CITEXT NOT NULL,\n" + " \"version_epoch\" INTEGER NOT NULL,\n" + " \"version_canonical_upstream\" TEXT NOT NULL,\n" + " \"version_canonical_release\" TEXT NOT NULL COLLATE \"C\",\n" + " \"version_revision\" INTEGER NOT NULL,\n" + " \"index\" BIGINT NOT NULL,\n" + " \"test_name\" CITEXT NOT NULL,\n" + " \"test_min_version_epoch\" INTEGER NULL,\n" + " \"test_min_version_canonical_upstream\" TEXT NULL,\n" + " \"test_min_version_canonical_release\" TEXT NULL,\n" + " \"test_min_version_revision\" INTEGER NULL,\n" + " \"test_min_version_upstream\" TEXT NULL,\n" + " \"test_min_version_release\" TEXT NULL,\n" + " \"test_max_version_epoch\" INTEGER NULL,\n" + " \"test_max_version_canonical_upstream\" TEXT NULL,\n" + " \"test_max_version_canonical_release\" TEXT NULL,\n" + " \"test_max_version_revision\" INTEGER NULL,\n" + " \"test_max_version_upstream\" TEXT NULL,\n" + " \"test_max_version_release\" TEXT NULL,\n" + " \"test_min_open\" BOOLEAN NULL,\n" + " \"test_max_open\" BOOLEAN NULL,\n" + " \"test_package_tenant\" TEXT NULL,\n" + " \"test_package_name\" CITEXT NULL,\n" + " \"test_package_version_epoch\" INTEGER NULL,\n" + " \"test_package_version_canonical_upstream\" TEXT NULL,\n" + " \"test_package_version_canonical_release\" TEXT NULL COLLATE \"C\",\n" + " \"test_package_version_revision\" INTEGER NULL,\n" + " \"test_type\" TEXT NOT NULL,\n" + " \"test_buildtime\" BOOLEAN NOT NULL,\n" + " \"test_enable\" TEXT NULL,\n" + " \"test_reflect\" TEXT NULL,\n" + " CONSTRAINT \"tenant_fk\"\n" + " FOREIGN KEY (\"tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " CONSTRAINT \"object_id_fk\"\n" + " FOREIGN KEY (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " REFERENCES \"package\" (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " ON DELETE CASCADE,\n" + " CONSTRAINT \"test_package_tenant_fk\"\n" + " FOREIGN KEY (\"test_package_tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " CONSTRAINT \"test_package_fk\"\n" + " FOREIGN KEY (\"test_package_tenant\",\n" + " \"test_package_name\",\n" + " \"test_package_version_epoch\",\n" + " \"test_package_version_canonical_upstream\",\n" + " \"test_package_version_canonical_release\",\n" + " \"test_package_version_revision\")\n" + " REFERENCES \"package\" (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " INITIALLY DEFERRED)"); + db.execute ("CREATE INDEX \"package_tests_object_id_i\"\n" + " ON \"package_tests\" (\n" + " \"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")"); + db.execute ("CREATE INDEX \"package_tests_index_i\"\n" + " ON \"package_tests\" (\"index\")"); + db.execute ("CREATE TABLE \"package_builds\" (\n" + " \"tenant\" TEXT NOT NULL,\n" + " \"name\" CITEXT NOT NULL,\n" + " \"version_epoch\" INTEGER NOT NULL,\n" + " \"version_canonical_upstream\" TEXT NOT NULL,\n" + " \"version_canonical_release\" TEXT NOT NULL COLLATE \"C\",\n" + " \"version_revision\" INTEGER NOT NULL,\n" + " \"index\" BIGINT NOT NULL,\n" + " \"expression\" TEXT NOT NULL,\n" + " \"comment\" TEXT NOT NULL,\n" + " CONSTRAINT \"tenant_fk\"\n" + " FOREIGN KEY (\"tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " CONSTRAINT \"object_id_fk\"\n" + " FOREIGN KEY (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " REFERENCES \"package\" (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " ON DELETE CASCADE)"); + db.execute ("CREATE INDEX \"package_builds_object_id_i\"\n" + " ON \"package_builds\" (\n" + " \"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")"); + db.execute ("CREATE INDEX \"package_builds_index_i\"\n" + " ON \"package_builds\" (\"index\")"); + db.execute ("CREATE TABLE \"package_build_constraints\" (\n" + " \"tenant\" TEXT NOT NULL,\n" + " \"name\" CITEXT NOT NULL,\n" + " \"version_epoch\" INTEGER NOT NULL,\n" + " \"version_canonical_upstream\" TEXT NOT NULL,\n" + " \"version_canonical_release\" TEXT NOT NULL COLLATE \"C\",\n" + " \"version_revision\" INTEGER NOT NULL,\n" + " \"index\" BIGINT NOT NULL,\n" + " \"exclusion\" BOOLEAN NOT NULL,\n" + " \"config\" TEXT NOT NULL,\n" + " \"target\" TEXT NULL,\n" + " \"comment\" TEXT NOT NULL,\n" + " CONSTRAINT \"tenant_fk\"\n" + " FOREIGN KEY (\"tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " CONSTRAINT \"object_id_fk\"\n" + " FOREIGN KEY (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " REFERENCES \"package\" (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " ON DELETE CASCADE)"); + db.execute ("CREATE INDEX \"package_build_constraints_object_id_i\"\n" + " ON \"package_build_constraints\" (\n" + " \"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")"); + db.execute ("CREATE INDEX \"package_build_constraints_index_i\"\n" + " ON \"package_build_constraints\" (\"index\")"); + db.execute ("CREATE TABLE \"package_build_auxiliaries\" (\n" + " \"tenant\" TEXT NOT NULL,\n" + " \"name\" CITEXT NOT NULL,\n" + " \"version_epoch\" INTEGER NOT NULL,\n" + " \"version_canonical_upstream\" TEXT NOT NULL,\n" + " \"version_canonical_release\" TEXT NOT NULL COLLATE \"C\",\n" + " \"version_revision\" INTEGER NOT NULL,\n" + " \"index\" BIGINT NOT NULL,\n" + " \"environment_name\" TEXT NOT NULL,\n" + " \"config\" TEXT NOT NULL,\n" + " \"comment\" TEXT NOT NULL,\n" + " CONSTRAINT \"tenant_fk\"\n" + " FOREIGN KEY (\"tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " CONSTRAINT \"object_id_fk\"\n" + " FOREIGN KEY (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " REFERENCES \"package\" (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " ON DELETE CASCADE)"); + db.execute ("CREATE INDEX \"package_build_auxiliaries_object_id_i\"\n" + " ON \"package_build_auxiliaries\" (\n" + " \"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")"); + db.execute ("CREATE INDEX \"package_build_auxiliaries_index_i\"\n" + " ON \"package_build_auxiliaries\" (\"index\")"); + db.execute ("CREATE TABLE \"package_build_bot_keys\" (\n" + " \"tenant\" TEXT NOT NULL,\n" + " \"name\" CITEXT NOT NULL,\n" + " \"version_epoch\" INTEGER NOT NULL,\n" + " \"version_canonical_upstream\" TEXT NOT NULL,\n" + " \"version_canonical_release\" TEXT NOT NULL COLLATE \"C\",\n" + " \"version_revision\" INTEGER NOT NULL,\n" + " \"index\" BIGINT NOT NULL,\n" + " \"key_tenant\" TEXT NOT NULL,\n" + " \"key_fingerprint\" TEXT NOT NULL,\n" + " CONSTRAINT \"tenant_fk\"\n" + " FOREIGN KEY (\"tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " CONSTRAINT \"object_id_fk\"\n" + " FOREIGN KEY (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " REFERENCES \"package\" (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " ON DELETE CASCADE,\n" + " CONSTRAINT \"key_tenant_fk\"\n" + " FOREIGN KEY (\"key_tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " CONSTRAINT \"key_fk\"\n" + " FOREIGN KEY (\"key_tenant\",\n" + " \"key_fingerprint\")\n" + " REFERENCES \"public_key\" (\"tenant\",\n" + " \"fingerprint\")\n" + " INITIALLY DEFERRED)"); + db.execute ("CREATE INDEX \"package_build_bot_keys_object_id_i\"\n" + " ON \"package_build_bot_keys\" (\n" + " \"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")"); + db.execute ("CREATE INDEX \"package_build_bot_keys_index_i\"\n" + " ON \"package_build_bot_keys\" (\"index\")"); + db.execute ("CREATE TABLE \"package_build_configs\" (\n" + " \"tenant\" TEXT NOT NULL,\n" + " \"name\" CITEXT NOT NULL,\n" + " \"version_epoch\" INTEGER NOT NULL,\n" + " \"version_canonical_upstream\" TEXT NOT NULL,\n" + " \"version_canonical_release\" TEXT NOT NULL COLLATE \"C\",\n" + " \"version_revision\" INTEGER NOT NULL,\n" + " \"index\" BIGINT NOT NULL,\n" + " \"config_name\" TEXT NOT NULL,\n" + " \"config_arguments\" TEXT NOT NULL,\n" + " \"config_comment\" TEXT NOT NULL,\n" + " \"config_email\" TEXT NULL,\n" + " \"config_email_comment\" TEXT NULL,\n" + " \"config_warning_email\" TEXT NULL,\n" + " \"config_warning_email_comment\" TEXT NULL,\n" + " \"config_error_email\" TEXT NULL,\n" + " \"config_error_email_comment\" TEXT NULL,\n" + " CONSTRAINT \"tenant_fk\"\n" + " FOREIGN KEY (\"tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " CONSTRAINT \"object_id_fk\"\n" + " FOREIGN KEY (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " REFERENCES \"package\" (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " ON DELETE CASCADE)"); + db.execute ("CREATE INDEX \"package_build_configs_object_id_i\"\n" + " ON \"package_build_configs\" (\n" + " \"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")"); + db.execute ("CREATE INDEX \"package_build_configs_index_i\"\n" + " ON \"package_build_configs\" (\"index\")"); + db.execute ("CREATE TABLE \"package_build_config_builds\" (\n" + " \"tenant\" TEXT NOT NULL,\n" + " \"name\" CITEXT NOT NULL,\n" + " \"version_epoch\" INTEGER NOT NULL,\n" + " \"version_canonical_upstream\" TEXT NOT NULL,\n" + " \"version_canonical_release\" TEXT NOT NULL COLLATE \"C\",\n" + " \"version_revision\" INTEGER NOT NULL,\n" + " \"config_index\" BIGINT NOT NULL,\n" + " \"index\" BIGINT NOT NULL,\n" + " \"expression\" TEXT NOT NULL,\n" + " \"comment\" TEXT NOT NULL,\n" + " CONSTRAINT \"tenant_fk\"\n" + " FOREIGN KEY (\"tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " CONSTRAINT \"object_id_fk\"\n" + " FOREIGN KEY (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " REFERENCES \"package\" (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " ON DELETE CASCADE)"); + db.execute ("CREATE INDEX \"package_build_config_builds_object_id_i\"\n" + " ON \"package_build_config_builds\" (\n" + " \"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")"); + db.execute ("CREATE TABLE \"package_build_config_constraints\" (\n" + " \"tenant\" TEXT NOT NULL,\n" + " \"name\" CITEXT NOT NULL,\n" + " \"version_epoch\" INTEGER NOT NULL,\n" + " \"version_canonical_upstream\" TEXT NOT NULL,\n" + " \"version_canonical_release\" TEXT NOT NULL COLLATE \"C\",\n" + " \"version_revision\" INTEGER NOT NULL,\n" + " \"config_index\" BIGINT NOT NULL,\n" + " \"index\" BIGINT NOT NULL,\n" + " \"exclusion\" BOOLEAN NOT NULL,\n" + " \"config\" TEXT NOT NULL,\n" + " \"target\" TEXT NULL,\n" + " \"comment\" TEXT NOT NULL,\n" + " CONSTRAINT \"tenant_fk\"\n" + " FOREIGN KEY (\"tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " CONSTRAINT \"object_id_fk\"\n" + " FOREIGN KEY (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " REFERENCES \"package\" (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " ON DELETE CASCADE)"); + db.execute ("CREATE INDEX \"package_build_config_constraints_object_id_i\"\n" + " ON \"package_build_config_constraints\" (\n" + " \"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")"); + db.execute ("CREATE TABLE \"package_build_config_auxiliaries\" (\n" + " \"tenant\" TEXT NOT NULL,\n" + " \"name\" CITEXT NOT NULL,\n" + " \"version_epoch\" INTEGER NOT NULL,\n" + " \"version_canonical_upstream\" TEXT NOT NULL,\n" + " \"version_canonical_release\" TEXT NOT NULL COLLATE \"C\",\n" + " \"version_revision\" INTEGER NOT NULL,\n" + " \"config_index\" BIGINT NOT NULL,\n" + " \"index\" BIGINT NOT NULL,\n" + " \"environment_name\" TEXT NOT NULL,\n" + " \"config\" TEXT NOT NULL,\n" + " \"comment\" TEXT NOT NULL,\n" + " CONSTRAINT \"tenant_fk\"\n" + " FOREIGN KEY (\"tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " CONSTRAINT \"object_id_fk\"\n" + " FOREIGN KEY (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " REFERENCES \"package\" (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " ON DELETE CASCADE)"); + db.execute ("CREATE INDEX \"package_build_config_auxiliaries_object_id_i\"\n" + " ON \"package_build_config_auxiliaries\" (\n" + " \"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")"); + db.execute ("CREATE TABLE \"package_build_config_bot_keys\" (\n" + " \"tenant\" TEXT NOT NULL,\n" + " \"name\" CITEXT NOT NULL,\n" + " \"version_epoch\" INTEGER NOT NULL,\n" + " \"version_canonical_upstream\" TEXT NOT NULL,\n" + " \"version_canonical_release\" TEXT NOT NULL COLLATE \"C\",\n" + " \"version_revision\" INTEGER NOT NULL,\n" + " \"config_index\" BIGINT NOT NULL,\n" + " \"index\" BIGINT NOT NULL,\n" + " \"key_tenant\" TEXT NOT NULL,\n" + " \"key_fingerprint\" TEXT NOT NULL,\n" + " CONSTRAINT \"tenant_fk\"\n" + " FOREIGN KEY (\"tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " CONSTRAINT \"object_id_fk\"\n" + " FOREIGN KEY (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " REFERENCES \"package\" (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " ON DELETE CASCADE,\n" + " CONSTRAINT \"key_tenant_fk\"\n" + " FOREIGN KEY (\"key_tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " CONSTRAINT \"key_fk\"\n" + " FOREIGN KEY (\"key_tenant\",\n" + " \"key_fingerprint\")\n" + " REFERENCES \"public_key\" (\"tenant\",\n" + " \"fingerprint\")\n" + " INITIALLY DEFERRED)"); + db.execute ("CREATE INDEX \"package_build_config_bot_keys_object_id_i\"\n" + " ON \"package_build_config_bot_keys\" (\n" + " \"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")"); + db.execute ("CREATE TABLE \"package_other_repositories\" (\n" + " \"tenant\" TEXT NOT NULL,\n" + " \"name\" CITEXT NOT NULL,\n" + " \"version_epoch\" INTEGER NOT NULL,\n" + " \"version_canonical_upstream\" TEXT NOT NULL,\n" + " \"version_canonical_release\" TEXT NOT NULL COLLATE \"C\",\n" + " \"version_revision\" INTEGER NOT NULL,\n" + " \"index\" BIGINT NOT NULL,\n" + " \"repository_tenant\" TEXT NOT NULL,\n" + " \"repository_canonical_name\" TEXT NOT NULL,\n" + " CONSTRAINT \"tenant_fk\"\n" + " FOREIGN KEY (\"tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " CONSTRAINT \"object_id_fk\"\n" + " FOREIGN KEY (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " REFERENCES \"package\" (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " ON DELETE CASCADE,\n" + " CONSTRAINT \"repository_tenant_fk\"\n" + " FOREIGN KEY (\"repository_tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " CONSTRAINT \"repository_fk\"\n" + " FOREIGN KEY (\"repository_tenant\",\n" + " \"repository_canonical_name\")\n" + " REFERENCES \"repository\" (\"tenant\",\n" + " \"canonical_name\")\n" + " INITIALLY DEFERRED)"); + db.execute ("CREATE INDEX \"package_other_repositories_object_id_i\"\n" + " ON \"package_other_repositories\" (\n" + " \"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")"); + db.execute ("CREATE INDEX \"package_other_repositories_index_i\"\n" + " ON \"package_other_repositories\" (\"index\")"); + 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 ('package', 34, FALSE)"); + return false; + } + } + } + + return false; + } + + static const schema_catalog_create_entry + create_schema_entry_ ( + id_pgsql, + "package", + &create_schema); + + static const schema_catalog_migrate_entry + migrate_schema_entry_27_ ( + id_pgsql, + "package", + 27ULL, + 0); + + static bool + migrate_schema_28 (database& db, unsigned short pass, bool pre) + { + ODB_POTENTIALLY_UNUSED (db); + ODB_POTENTIALLY_UNUSED (pass); + ODB_POTENTIALLY_UNUSED (pre); + + if (pre) + { + switch (pass) + { + case 1: + { + db.execute ("ALTER TABLE \"package_build_configs\"\n" + " ADD COLUMN \"config_email\" TEXT NULL,\n" + " ADD COLUMN \"config_email_comment\" TEXT NULL,\n" + " ADD COLUMN \"config_warning_email\" TEXT NULL,\n" + " ADD COLUMN \"config_warning_email_comment\" TEXT NULL,\n" + " ADD COLUMN \"config_error_email\" TEXT NULL,\n" + " ADD COLUMN \"config_error_email_comment\" TEXT NULL"); + return true; + } + case 2: + { + db.execute ("UPDATE \"schema_version\"\n" + " SET \"version\" = 28, \"migration\" = TRUE\n" + " WHERE \"name\" = 'package'"); + return false; + } + } + } + else + { + switch (pass) + { + case 1: + { + return true; + } + case 2: + { + db.execute ("UPDATE \"schema_version\"\n" + " SET \"migration\" = FALSE\n" + " WHERE \"name\" = 'package'"); + return false; + } + } + } + + return false; + } + + static const schema_catalog_migrate_entry + migrate_schema_entry_28_ ( + id_pgsql, + "package", + 28ULL, + &migrate_schema_28); + + static bool + migrate_schema_29 (database& db, unsigned short pass, bool pre) + { + ODB_POTENTIALLY_UNUSED (db); + ODB_POTENTIALLY_UNUSED (pass); + ODB_POTENTIALLY_UNUSED (pre); + + if (pre) + { + switch (pass) + { + case 1: + { + db.execute ("ALTER TABLE \"package_tests\"\n" + " ADD COLUMN \"test_enable\" TEXT NULL"); + return true; + } + case 2: + { + db.execute ("UPDATE \"schema_version\"\n" + " SET \"version\" = 29, \"migration\" = TRUE\n" + " WHERE \"name\" = 'package'"); + return false; + } + } + } + else + { + switch (pass) + { + case 1: + { + return true; + } + case 2: + { + db.execute ("UPDATE \"schema_version\"\n" + " SET \"migration\" = FALSE\n" + " WHERE \"name\" = 'package'"); + return false; + } + } + } + + return false; + } + + static const schema_catalog_migrate_entry + migrate_schema_entry_29_ ( + id_pgsql, + "package", + 29ULL, + &migrate_schema_29); + + static bool + migrate_schema_30 (database& db, unsigned short pass, bool pre) + { + ODB_POTENTIALLY_UNUSED (db); + ODB_POTENTIALLY_UNUSED (pass); + ODB_POTENTIALLY_UNUSED (pre); + + if (pre) + { + switch (pass) + { + case 1: + { + db.execute ("ALTER TABLE \"tenant\"\n" + " ADD COLUMN \"service_id\" TEXT NULL,\n" + " ADD COLUMN \"service_type\" TEXT NULL,\n" + " ADD COLUMN \"service_data\" TEXT NULL,\n" + " ADD COLUMN \"queued_timestamp\" BIGINT NULL"); + return true; + } + case 2: + { + db.execute ("CREATE INDEX \"tenant_service_id_i\"\n" + " ON \"tenant\" (\"service_id\")"); + db.execute ("UPDATE \"schema_version\"\n" + " SET \"version\" = 30, \"migration\" = TRUE\n" + " WHERE \"name\" = 'package'"); + return false; + } + } + } + else + { + switch (pass) + { + case 1: + { + return true; + } + case 2: + { + db.execute ("CREATE UNIQUE INDEX \"tenant_service_i\"\n" + " ON \"tenant\" (\n" + " \"service_id\",\n" + " \"service_type\")"); + db.execute ("UPDATE \"schema_version\"\n" + " SET \"migration\" = FALSE\n" + " WHERE \"name\" = 'package'"); + return false; + } + } + } + + return false; + } + + static const schema_catalog_migrate_entry + migrate_schema_entry_30_ ( + id_pgsql, + "package", + 30ULL, + &migrate_schema_30); + + static bool + migrate_schema_31 (database& db, unsigned short pass, bool pre) + { + ODB_POTENTIALLY_UNUSED (db); + ODB_POTENTIALLY_UNUSED (pass); + ODB_POTENTIALLY_UNUSED (pre); + + if (pre) + { + switch (pass) + { + case 1: + { + db.execute ("CREATE TABLE \"package_build_auxiliaries\" (\n" + " \"tenant\" TEXT NOT NULL,\n" + " \"name\" CITEXT NOT NULL,\n" + " \"version_epoch\" INTEGER NOT NULL,\n" + " \"version_canonical_upstream\" TEXT NOT NULL,\n" + " \"version_canonical_release\" TEXT NOT NULL COLLATE \"C\",\n" + " \"version_revision\" INTEGER NOT NULL,\n" + " \"index\" BIGINT NOT NULL,\n" + " \"environment_name\" TEXT NOT NULL,\n" + " \"config\" TEXT NOT NULL,\n" + " \"comment\" TEXT NOT NULL)"); + db.execute ("CREATE INDEX \"package_build_auxiliaries_object_id_i\"\n" + " ON \"package_build_auxiliaries\" (\n" + " \"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")"); + db.execute ("CREATE INDEX \"package_build_auxiliaries_index_i\"\n" + " ON \"package_build_auxiliaries\" (\"index\")"); + db.execute ("CREATE TABLE \"package_build_config_auxiliaries\" (\n" + " \"tenant\" TEXT NOT NULL,\n" + " \"name\" CITEXT NOT NULL,\n" + " \"version_epoch\" INTEGER NOT NULL,\n" + " \"version_canonical_upstream\" TEXT NOT NULL,\n" + " \"version_canonical_release\" TEXT NOT NULL COLLATE \"C\",\n" + " \"version_revision\" INTEGER NOT NULL,\n" + " \"config_index\" BIGINT NOT NULL,\n" + " \"index\" BIGINT NOT NULL,\n" + " \"environment_name\" TEXT NOT NULL,\n" + " \"config\" TEXT NOT NULL,\n" + " \"comment\" TEXT NOT NULL)"); + db.execute ("CREATE INDEX \"package_build_config_auxiliaries_object_id_i\"\n" + " ON \"package_build_config_auxiliaries\" (\n" + " \"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")"); + return true; + } + case 2: + { + db.execute ("ALTER TABLE \"package_build_auxiliaries\"\n" + " ADD CONSTRAINT \"tenant_fk\"\n" + " FOREIGN KEY (\"tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " ADD CONSTRAINT \"object_id_fk\"\n" + " FOREIGN KEY (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " REFERENCES \"package\" (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " ON DELETE CASCADE"); + db.execute ("ALTER TABLE \"package_build_config_auxiliaries\"\n" + " ADD CONSTRAINT \"tenant_fk\"\n" + " FOREIGN KEY (\"tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " ADD CONSTRAINT \"object_id_fk\"\n" + " FOREIGN KEY (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " REFERENCES \"package\" (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " ON DELETE CASCADE"); + db.execute ("UPDATE \"schema_version\"\n" + " SET \"version\" = 31, \"migration\" = TRUE\n" + " WHERE \"name\" = 'package'"); + return false; + } + } + } + else + { + switch (pass) + { + case 1: + { + return true; + } + case 2: + { + db.execute ("UPDATE \"schema_version\"\n" + " SET \"migration\" = FALSE\n" + " WHERE \"name\" = 'package'"); + return false; + } + } + } + + return false; + } + + static const schema_catalog_migrate_entry + migrate_schema_entry_31_ ( + id_pgsql, + "package", + 31ULL, + &migrate_schema_31); + + static bool + migrate_schema_32 (database& db, unsigned short pass, bool pre) + { + ODB_POTENTIALLY_UNUSED (db); + ODB_POTENTIALLY_UNUSED (pass); + ODB_POTENTIALLY_UNUSED (pre); + + if (pre) + { + switch (pass) + { + case 1: + { + db.execute ("ALTER TABLE \"tenant\"\n" + " ADD COLUMN \"build_toolchain_name\" TEXT NULL,\n" + " ADD COLUMN \"build_toolchain_version_epoch\" INTEGER NULL,\n" + " ADD COLUMN \"build_toolchain_version_canonical_upstream\" TEXT NULL,\n" + " ADD COLUMN \"build_toolchain_version_canonical_release\" TEXT NULL,\n" + " ADD COLUMN \"build_toolchain_version_revision\" INTEGER NULL,\n" + " ADD COLUMN \"build_toolchain_version_upstream\" TEXT NULL,\n" + " ADD COLUMN \"build_toolchain_version_release\" TEXT NULL"); + return true; + } + case 2: + { + db.execute ("UPDATE \"schema_version\"\n" + " SET \"version\" = 32, \"migration\" = TRUE\n" + " WHERE \"name\" = 'package'"); + return false; + } + } + } + else + { + switch (pass) + { + case 1: + { + return true; + } + case 2: + { + db.execute ("UPDATE \"schema_version\"\n" + " SET \"migration\" = FALSE\n" + " WHERE \"name\" = 'package'"); + return false; + } + } + } + + return false; + } + + static const schema_catalog_migrate_entry + migrate_schema_entry_32_ ( + id_pgsql, + "package", + 32ULL, + &migrate_schema_32); + + static bool + migrate_schema_33 (database& db, unsigned short pass, bool pre) + { + ODB_POTENTIALLY_UNUSED (db); + ODB_POTENTIALLY_UNUSED (pass); + ODB_POTENTIALLY_UNUSED (pre); + + if (pre) + { + switch (pass) + { + case 1: + { + db.execute ("CREATE TABLE \"public_key\" (\n" + " \"tenant\" TEXT NOT NULL,\n" + " \"fingerprint\" TEXT NOT NULL,\n" + " \"data\" TEXT NOT NULL,\n" + " PRIMARY KEY (\"tenant\",\n" + " \"fingerprint\"))"); + db.execute ("ALTER TABLE \"package\"\n" + " ADD COLUMN \"custom_bot\" BOOLEAN NULL"); + db.execute ("CREATE TABLE \"package_build_bot_keys\" (\n" + " \"tenant\" TEXT NOT NULL,\n" + " \"name\" CITEXT NOT NULL,\n" + " \"version_epoch\" INTEGER NOT NULL,\n" + " \"version_canonical_upstream\" TEXT NOT NULL,\n" + " \"version_canonical_release\" TEXT NOT NULL COLLATE \"C\",\n" + " \"version_revision\" INTEGER NOT NULL,\n" + " \"index\" BIGINT NOT NULL,\n" + " \"key_tenant\" TEXT NOT NULL,\n" + " \"key_fingerprint\" TEXT NOT NULL)"); + db.execute ("CREATE INDEX \"package_build_bot_keys_object_id_i\"\n" + " ON \"package_build_bot_keys\" (\n" + " \"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")"); + db.execute ("CREATE INDEX \"package_build_bot_keys_index_i\"\n" + " ON \"package_build_bot_keys\" (\"index\")"); + db.execute ("CREATE TABLE \"package_build_config_bot_keys\" (\n" + " \"tenant\" TEXT NOT NULL,\n" + " \"name\" CITEXT NOT NULL,\n" + " \"version_epoch\" INTEGER NOT NULL,\n" + " \"version_canonical_upstream\" TEXT NOT NULL,\n" + " \"version_canonical_release\" TEXT NOT NULL COLLATE \"C\",\n" + " \"version_revision\" INTEGER NOT NULL,\n" + " \"config_index\" BIGINT NOT NULL,\n" + " \"index\" BIGINT NOT NULL,\n" + " \"key_tenant\" TEXT NOT NULL,\n" + " \"key_fingerprint\" TEXT NOT NULL)"); + db.execute ("CREATE INDEX \"package_build_config_bot_keys_object_id_i\"\n" + " ON \"package_build_config_bot_keys\" (\n" + " \"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")"); + return true; + } + case 2: + { + db.execute ("ALTER TABLE \"public_key\"\n" + " ADD CONSTRAINT \"tenant_fk\"\n" + " FOREIGN KEY (\"tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED"); + db.execute ("ALTER TABLE \"package_build_bot_keys\"\n" + " ADD CONSTRAINT \"tenant_fk\"\n" + " FOREIGN KEY (\"tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " ADD CONSTRAINT \"object_id_fk\"\n" + " FOREIGN KEY (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " REFERENCES \"package\" (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " ON DELETE CASCADE,\n" + " ADD CONSTRAINT \"key_tenant_fk\"\n" + " FOREIGN KEY (\"key_tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " ADD CONSTRAINT \"key_fk\"\n" + " FOREIGN KEY (\"key_tenant\",\n" + " \"key_fingerprint\")\n" + " REFERENCES \"public_key\" (\"tenant\",\n" + " \"fingerprint\")\n" + " INITIALLY DEFERRED"); + db.execute ("ALTER TABLE \"package_build_config_bot_keys\"\n" + " ADD CONSTRAINT \"tenant_fk\"\n" + " FOREIGN KEY (\"tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " ADD CONSTRAINT \"object_id_fk\"\n" + " FOREIGN KEY (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " REFERENCES \"package\" (\"tenant\",\n" + " \"name\",\n" + " \"version_epoch\",\n" + " \"version_canonical_upstream\",\n" + " \"version_canonical_release\",\n" + " \"version_revision\")\n" + " ON DELETE CASCADE,\n" + " ADD CONSTRAINT \"key_tenant_fk\"\n" + " FOREIGN KEY (\"key_tenant\")\n" + " REFERENCES \"tenant\" (\"id\")\n" + " INITIALLY DEFERRED,\n" + " ADD CONSTRAINT \"key_fk\"\n" + " FOREIGN KEY (\"key_tenant\",\n" + " \"key_fingerprint\")\n" + " REFERENCES \"public_key\" (\"tenant\",\n" + " \"fingerprint\")\n" + " INITIALLY DEFERRED"); + db.execute ("UPDATE \"schema_version\"\n" + " SET \"version\" = 33, \"migration\" = TRUE\n" + " WHERE \"name\" = 'package'"); + return false; + } + } + } + else + { + switch (pass) + { + case 1: + { + return true; + } + case 2: + { + db.execute ("UPDATE \"schema_version\"\n" + " SET \"migration\" = FALSE\n" + " WHERE \"name\" = 'package'"); + return false; + } + } + } + + return false; + } + + static const schema_catalog_migrate_entry + migrate_schema_entry_33_ ( + id_pgsql, + "package", + 33ULL, + &migrate_schema_33); + + static bool + migrate_schema_34 (database& db, unsigned short pass, bool pre) + { + ODB_POTENTIALLY_UNUSED (db); + ODB_POTENTIALLY_UNUSED (pass); + ODB_POTENTIALLY_UNUSED (pre); + + if (pre) + { + switch (pass) + { + case 1: + { + db.execute ("ALTER TABLE \"tenant\"\n" + " ADD COLUMN \"loaded_timestamp\" BIGINT NULL"); + return true; + } + case 2: + { + db.execute ("CREATE INDEX \"tenant_loaded_timestamp_i\"\n" + " ON \"tenant\" (\"loaded_timestamp\")"); + db.execute ("UPDATE \"schema_version\"\n" + " SET \"version\" = 34, \"migration\" = TRUE\n" + " WHERE \"name\" = 'package'"); + return false; + } + } + } + else + { + switch (pass) + { + case 1: + { + return true; + } + case 2: + { + db.execute ("UPDATE \"schema_version\"\n" + " SET \"migration\" = FALSE\n" + " WHERE \"name\" = 'package'"); + return false; + } + } + } + + return false; + } + + static const schema_catalog_migrate_entry + migrate_schema_entry_34_ ( + id_pgsql, + "package", + 34ULL, + &migrate_schema_34); +} + +#include <odb/post.hxx> diff --git a/libbrep/package-odb.hxx b/libbrep/package-odb.hxx new file mode 100644 index 0000000..b3c71d9 --- /dev/null +++ b/libbrep/package-odb.hxx @@ -0,0 +1,7531 @@ +// -*- C++ -*- +// +// This file was generated by ODB, object-relational mapping (ORM) +// compiler for C++. +// + +#ifndef LIBBREP_PACKAGE_ODB_HXX +#define LIBBREP_PACKAGE_ODB_HXX + +// Begin prologue. +// +#include <libbrep/package-traits.hxx> +// +// End prologue. + +#include <odb/version.hxx> + +#if ODB_VERSION != 20476UL +#error ODB runtime version mismatch +#endif + +#include <odb/pre.hxx> + +#include <libbrep/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 +{ + // tenant + // + template <> + struct class_traits< ::brep::tenant > + { + static const class_kind kind = class_object; + }; + + template <> + class access::object_traits< ::brep::tenant > + { + public: + typedef ::brep::tenant object_type; + typedef ::std::shared_ptr< ::brep::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 + 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); + }; + + // tenant_id + // + template <> + struct class_traits< ::brep::tenant_id > + { + static const class_kind kind = class_view; + }; + + template <> + class access::view_traits< ::brep::tenant_id > + { + public: + typedef ::brep::tenant_id view_type; + typedef ::brep::tenant_id* pointer_type; + + static void + callback (database&, view_type&, callback_event); + }; + + // repository + // + template <> + struct class_traits< ::brep::repository > + { + static const class_kind kind = class_object; + }; + + template <> + class access::object_traits< ::brep::repository > + { + public: + typedef ::brep::repository object_type; + typedef ::std::shared_ptr< ::brep::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 + 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); + }; + + // repository_count + // + template <> + struct class_traits< ::brep::repository_count > + { + static const class_kind kind = class_view; + }; + + template <> + class access::view_traits< ::brep::repository_count > + { + public: + typedef ::brep::repository_count view_type; + typedef ::brep::repository_count* pointer_type; + + static void + callback (database&, view_type&, callback_event); + }; + + // public_key + // + template <> + struct class_traits< ::brep::public_key > + { + static const class_kind kind = class_object; + }; + + template <> + class access::object_traits< ::brep::public_key > + { + public: + typedef ::brep::public_key object_type; + typedef ::std::shared_ptr< ::brep::public_key > pointer_type; + typedef odb::pointer_traits<pointer_type> pointer_traits; + + static const bool polymorphic = false; + + typedef ::brep::public_key_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); + }; + + // package + // + template <> + struct class_traits< ::brep::package > + { + static const class_kind kind = class_object; + }; + + template <> + class access::object_traits< ::brep::package > + { + public: + typedef ::brep::package object_type; + typedef ::std::shared_ptr< ::brep::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); + }; + + // latest_package_search_rank + // + template <> + struct class_traits< ::brep::latest_package_search_rank > + { + static const class_kind kind = class_view; + }; + + template <> + class access::view_traits< ::brep::latest_package_search_rank > + { + public: + typedef ::brep::latest_package_search_rank view_type; + typedef ::brep::latest_package_search_rank* pointer_type; + + static void + callback (database&, view_type&, callback_event); + }; + + // latest_package_count + // + template <> + struct class_traits< ::brep::latest_package_count > + { + static const class_kind kind = class_view; + }; + + template <> + class access::view_traits< ::brep::latest_package_count > + { + public: + typedef ::brep::latest_package_count view_type; + typedef ::brep::latest_package_count* pointer_type; + + static void + callback (database&, view_type&, callback_event); + }; + + // package_search_rank + // + template <> + struct class_traits< ::brep::package_search_rank > + { + static const class_kind kind = class_view; + }; + + template <> + class access::view_traits< ::brep::package_search_rank > + { + public: + typedef ::brep::package_search_rank view_type; + typedef ::brep::package_search_rank* pointer_type; + + static void + callback (database&, view_type&, callback_event); + }; + + // package_count + // + template <> + struct class_traits< ::brep::package_count > + { + static const class_kind kind = class_view; + }; + + template <> + class access::view_traits< ::brep::package_count > + { + public: + typedef ::brep::package_count view_type; + typedef ::brep::package_count* pointer_type; + + static void + callback (database&, view_type&, callback_event); + }; + + // latest_package + // + template <> + struct class_traits< ::brep::latest_package > + { + static const class_kind kind = class_view; + }; + + template <> + class access::view_traits< ::brep::latest_package > + { + public: + typedef ::brep::latest_package view_type; + typedef ::brep::latest_package* 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 +{ + // priority + // + template <> + class access::composite_value_traits< ::bpkg::priority, id_pgsql > + { + public: + typedef ::bpkg::priority value_type; + + struct image_type + { + // value + // + int value_value; + bool value_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; + }; + + // licenses + // + template <> + class access::composite_value_traits< ::bpkg::licenses, id_pgsql > + { + public: + typedef ::bpkg::licenses value_type; + + struct image_type + { + // 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 = 1UL; + }; + + // manifest_url + // + template <> + class access::composite_value_traits< ::bpkg::manifest_url, id_pgsql > + { + public: + typedef ::bpkg::manifest_url value_type; + + struct image_type + { + // value + // + details::buffer value_value; + std::size_t value_size; + bool value_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; + }; + + // dependency + // + template <> + class access::composite_value_traits< ::brep::dependency, id_pgsql > + { + public: + typedef ::brep::dependency value_type; + + struct image_type + { + // name + // + details::buffer name_value; + std::size_t name_size; + bool name_null; + + // constraint + // + composite_value_traits< ::bpkg::version_constraint, id_pgsql >::image_type constraint_value; + + // 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 = 21UL; + }; + + // dependency_alternative + // + template <> + class access::composite_value_traits< ::brep::dependency_alternative, id_pgsql > + { + public: + typedef ::brep::dependency_alternative value_type; + + struct image_type + { + // enable + // + details::buffer enable_value; + std::size_t enable_size; + bool enable_null; + + // reflect + // + details::buffer reflect_value; + std::size_t reflect_size; + bool reflect_null; + + // prefer + // + details::buffer prefer_value; + std::size_t prefer_size; + bool prefer_null; + + // accept + // + details::buffer accept_value; + std::size_t accept_size; + bool accept_null; + + // require + // + details::buffer require_value; + std::size_t require_size; + bool require_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 = 5UL; + }; + + // dependency_alternatives + // + template <> + class access::composite_value_traits< ::brep::dependency_alternatives, id_pgsql > + { + public: + typedef ::brep::dependency_alternatives value_type; + + struct image_type + { + // buildtime + // + bool buildtime_value; + bool buildtime_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; + }; + + // test_dependency + // + template <> + class access::composite_value_traits< ::brep::test_dependency, id_pgsql > + { + public: + typedef ::brep::test_dependency value_type; + + struct image_type: composite_value_traits< ::brep::dependency, id_pgsql >::image_type + { + // type + // + details::buffer type_value; + std::size_t type_size; + bool type_null; + + // buildtime + // + bool buildtime_value; + bool buildtime_null; + + // enable + // + details::buffer enable_value; + std::size_t enable_size; + bool enable_null; + + // reflect + // + details::buffer reflect_value; + std::size_t reflect_size; + bool reflect_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 = 25UL; + }; + + // certificate + // + template <> + class access::composite_value_traits< ::brep::certificate, id_pgsql > + { + public: + typedef ::brep::certificate value_type; + + struct image_type + { + // fingerprint + // + details::buffer fingerprint_value; + std::size_t fingerprint_size; + bool fingerprint_null; + + // name + // + details::buffer name_value; + std::size_t name_size; + bool name_null; + + // organization + // + details::buffer organization_value; + std::size_t organization_size; + bool organization_null; + + // email + // + details::buffer email_value; + std::size_t email_size; + bool email_null; + + // pem + // + details::buffer pem_value; + std::size_t pem_size; + bool pem_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 = 5UL; + }; + + // tenant + // + template <typename A> + struct query_columns< ::brep::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; + + // private_ + // + typedef + pgsql::query_column< + pgsql::value_traits< + bool, + pgsql::id_boolean >::query_type, + pgsql::id_boolean > + private__type_; + + static const private__type_ private_; + + // interactive + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::basic_string< char >, + pgsql::id_string >::query_type, + pgsql::id_string > + interactive_type_; + + static const interactive_type_ interactive; + + // creation_timestamp + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::uint64_t, + pgsql::id_bigint >::query_type, + pgsql::id_bigint > + creation_timestamp_type_; + + static const creation_timestamp_type_ creation_timestamp; + + // archived + // + typedef + pgsql::query_column< + pgsql::value_traits< + bool, + pgsql::id_boolean >::query_type, + pgsql::id_boolean > + archived_type_; + + static const archived_type_ archived; + + // service + // + struct service_class_ + { + service_class_ () + { + } + + // 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; + + // 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; + + // data + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::basic_string< char >, + pgsql::id_string >::query_type, + pgsql::id_string > + data_type_; + + static const data_type_ data; + }; + + static const service_class_ service; + + // loaded_timestamp + // + typedef + pgsql::query_column< + pgsql::value_traits< + long unsigned int, + pgsql::id_bigint >::query_type, + pgsql::id_bigint > + loaded_timestamp_type_; + + static const loaded_timestamp_type_ loaded_timestamp; + + // queued_timestamp + // + typedef + pgsql::query_column< + pgsql::value_traits< + long unsigned int, + pgsql::id_bigint >::query_type, + pgsql::id_bigint > + queued_timestamp_type_; + + static const queued_timestamp_type_ queued_timestamp; + + // build_toolchain + // + struct build_toolchain_class_ + { + build_toolchain_class_ () + { + } + + // name + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + 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< + short unsigned int, + pgsql::id_integer >::query_type, + pgsql::id_integer > + revision_type_; + + static const revision_type_ revision; + + // 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_1_ version; + }; + + static const build_toolchain_class_ build_toolchain; + }; + + template <typename A> + const typename query_columns< ::brep::tenant, id_pgsql, A >::id_type_ + query_columns< ::brep::tenant, id_pgsql, A >:: + id (A::table_name, "\"id\"", 0); + + template <typename A> + const typename query_columns< ::brep::tenant, id_pgsql, A >::private__type_ + query_columns< ::brep::tenant, id_pgsql, A >:: + private_ (A::table_name, "\"private\"", 0); + + template <typename A> + const typename query_columns< ::brep::tenant, id_pgsql, A >::interactive_type_ + query_columns< ::brep::tenant, id_pgsql, A >:: + interactive (A::table_name, "\"interactive\"", 0); + + template <typename A> + const typename query_columns< ::brep::tenant, id_pgsql, A >::creation_timestamp_type_ + query_columns< ::brep::tenant, id_pgsql, A >:: + creation_timestamp (A::table_name, "\"creation_timestamp\"", 0); + + template <typename A> + const typename query_columns< ::brep::tenant, id_pgsql, A >::archived_type_ + query_columns< ::brep::tenant, id_pgsql, A >:: + archived (A::table_name, "\"archived\"", 0); + + template <typename A> + const typename query_columns< ::brep::tenant, id_pgsql, A >::service_class_::id_type_ + query_columns< ::brep::tenant, id_pgsql, A >::service_class_:: + id (A::table_name, "\"service_id\"", 0); + + template <typename A> + const typename query_columns< ::brep::tenant, id_pgsql, A >::service_class_::type_type_ + query_columns< ::brep::tenant, id_pgsql, A >::service_class_:: + type (A::table_name, "\"service_type\"", 0); + + template <typename A> + const typename query_columns< ::brep::tenant, id_pgsql, A >::service_class_::data_type_ + query_columns< ::brep::tenant, id_pgsql, A >::service_class_:: + data (A::table_name, "\"service_data\"", 0); + + template <typename A> + const typename query_columns< ::brep::tenant, id_pgsql, A >::service_class_ + query_columns< ::brep::tenant, id_pgsql, A >::service; + + template <typename A> + const typename query_columns< ::brep::tenant, id_pgsql, A >::loaded_timestamp_type_ + query_columns< ::brep::tenant, id_pgsql, A >:: + loaded_timestamp (A::table_name, "\"loaded_timestamp\"", 0); + + template <typename A> + const typename query_columns< ::brep::tenant, id_pgsql, A >::queued_timestamp_type_ + query_columns< ::brep::tenant, id_pgsql, A >:: + queued_timestamp (A::table_name, "\"queued_timestamp\"", 0); + + template <typename A> + const typename query_columns< ::brep::tenant, id_pgsql, A >::build_toolchain_class_::name_type_ + query_columns< ::brep::tenant, id_pgsql, A >::build_toolchain_class_:: + name (A::table_name, "\"build_toolchain_name\"", 0); + + template <typename A> + const typename query_columns< ::brep::tenant, id_pgsql, A >::build_toolchain_class_::version_class_1_::epoch_type_ + query_columns< ::brep::tenant, id_pgsql, A >::build_toolchain_class_::version_class_1_:: + epoch (A::table_name, "\"build_toolchain_version_epoch\"", 0); + + template <typename A> + const typename query_columns< ::brep::tenant, id_pgsql, A >::build_toolchain_class_::version_class_1_::canonical_upstream_type_ + query_columns< ::brep::tenant, id_pgsql, A >::build_toolchain_class_::version_class_1_:: + canonical_upstream (A::table_name, "\"build_toolchain_version_canonical_upstream\"", 0); + + template <typename A> + const typename query_columns< ::brep::tenant, id_pgsql, A >::build_toolchain_class_::version_class_1_::canonical_release_type_ + query_columns< ::brep::tenant, id_pgsql, A >::build_toolchain_class_::version_class_1_:: + canonical_release (A::table_name, "\"build_toolchain_version_canonical_release\"", 0); + + template <typename A> + const typename query_columns< ::brep::tenant, id_pgsql, A >::build_toolchain_class_::version_class_1_::revision_type_ + query_columns< ::brep::tenant, id_pgsql, A >::build_toolchain_class_::version_class_1_:: + revision (A::table_name, "\"build_toolchain_version_revision\"", 0); + + template <typename A> + const typename query_columns< ::brep::tenant, id_pgsql, A >::build_toolchain_class_::version_class_1_::upstream_type_ + query_columns< ::brep::tenant, id_pgsql, A >::build_toolchain_class_::version_class_1_:: + upstream (A::table_name, "\"build_toolchain_version_upstream\"", 0); + + template <typename A> + const typename query_columns< ::brep::tenant, id_pgsql, A >::build_toolchain_class_::version_class_1_::release_type_ + query_columns< ::brep::tenant, id_pgsql, A >::build_toolchain_class_::version_class_1_:: + release (A::table_name, "\"build_toolchain_version_release\"", 0); + + template <typename A> + const typename query_columns< ::brep::tenant, id_pgsql, A >::build_toolchain_class_::version_class_1_ + query_columns< ::brep::tenant, id_pgsql, A >::build_toolchain_class_::version; + + template <typename A> + const typename query_columns< ::brep::tenant, id_pgsql, A >::build_toolchain_class_ + query_columns< ::brep::tenant, id_pgsql, A >::build_toolchain; + + template <typename A> + struct pointer_query_columns< ::brep::tenant, id_pgsql, A >: + query_columns< ::brep::tenant, id_pgsql, A > + { + }; + + template <> + class access::object_traits_impl< ::brep::tenant, id_pgsql >: + public access::object_traits< ::brep::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; + + // private_ + // + bool private_value; + bool private_null; + + // interactive + // + details::buffer interactive_value; + std::size_t interactive_size; + bool interactive_null; + + // creation_timestamp + // + long long creation_timestamp_value; + bool creation_timestamp_null; + + // archived + // + bool archived_value; + bool archived_null; + + // service + // + composite_value_traits< ::brep::tenant_service, id_pgsql >::image_type service_value; + + // loaded_timestamp + // + long long loaded_timestamp_value; + bool loaded_timestamp_null; + + // queued_timestamp + // + long long queued_timestamp_value; + bool queued_timestamp_null; + + // build_toolchain + // + composite_value_traits< ::brep::build_toolchain, id_pgsql >::image_type build_toolchain_value; + + 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 = 17UL; + static const std::size_t id_column_count = 1UL; + static const std::size_t inverse_column_count = 0UL; + static const std::size_t readonly_column_count = 0UL; + static const std::size_t managed_optimistic_column_count = 0UL; + + static const std::size_t separate_load_column_count = 0UL; + static const std::size_t separate_update_column_count = 0UL; + + static const bool versioned = false; + + static const char persist_statement[]; + static const char find_statement[]; + static const char update_statement[]; + static const char erase_statement[]; + static const char query_statement[]; + static const char erase_query_statement[]; + + static const char table_name[]; + + static void + persist (database&, 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[]; + + static const std::size_t batch = 1UL; + + 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::tenant, id_common >: + public access::object_traits_impl< ::brep::tenant, id_pgsql > + { + }; + + // tenant_id + // + template <> + class access::view_traits_impl< ::brep::tenant_id, id_pgsql >: + public access::view_traits< ::brep::tenant_id > + { + public: + struct image_type + { + // value + // + details::buffer value_value; + std::size_t value_size; + bool value_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::tenant_id, id_common >: + public access::view_traits_impl< ::brep::tenant_id, id_pgsql > + { + }; + + // repository + // + template <typename A> + struct query_columns< ::brep::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; + + // display_name + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + display_name_type_; + + static const display_name_type_ display_name; + + // priority + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::uint16_t, + pgsql::id_integer >::query_type, + pgsql::id_integer > + priority_type_; + + static const priority_type_ priority; + + // interface_url + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::basic_string< char >, + pgsql::id_string >::query_type, + pgsql::id_string > + interface_url_type_; + + static const interface_url_type_ interface_url; + + // email + // + struct email_class_ + { + email_class_ () + { + } + + // value + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + value_type_; + + static const value_type_ value; + + // comment + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + comment_type_; + + static const comment_type_ comment; + }; + + static const email_class_ email; + + // summary + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::basic_string< char >, + pgsql::id_string >::query_type, + pgsql::id_string > + summary_type_; + + static const summary_type_ summary; + + // description + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::basic_string< char >, + pgsql::id_string >::query_type, + pgsql::id_string > + description_type_; + + static const description_type_ description; + + // cache_location + // + struct cache_location_class_ + { + cache_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 cache_location_class_ cache_location; + + // certificate + // + struct certificate_class_ + { + certificate_class_ () + { + } + + // fingerprint + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + fingerprint_type_; + + static const fingerprint_type_ fingerprint; + + // name + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + name_type_; + + static const name_type_ name; + + // organization + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + organization_type_; + + static const organization_type_ organization; + + // email + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + email_type_; + + static const email_type_ email; + + // pem + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + pem_type_; + + static const pem_type_ pem; + }; + + static const certificate_class_ certificate; + + // packages_timestamp + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::uint64_t, + pgsql::id_bigint >::query_type, + pgsql::id_bigint > + packages_timestamp_type_; + + static const packages_timestamp_type_ packages_timestamp; + + // repositories_timestamp + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::uint64_t, + pgsql::id_bigint >::query_type, + pgsql::id_bigint > + repositories_timestamp_type_; + + static const repositories_timestamp_type_ repositories_timestamp; + + // internal + // + typedef + pgsql::query_column< + pgsql::value_traits< + bool, + pgsql::id_boolean >::query_type, + pgsql::id_boolean > + internal_type_; + + static const internal_type_ internal; + + // 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::repository, id_pgsql, A >::id_class_::tenant_type_ + query_columns< ::brep::repository, id_pgsql, A >::id_class_:: + tenant (A::table_name, "\"tenant\"", 0); + + template <typename A> + const typename query_columns< ::brep::repository, id_pgsql, A >::id_class_::canonical_name_type_ + query_columns< ::brep::repository, id_pgsql, A >::id_class_:: + canonical_name (A::table_name, "\"canonical_name\"", 0); + + template <typename A> + const typename query_columns< ::brep::repository, id_pgsql, A >::id_class_ + query_columns< ::brep::repository, id_pgsql, A >::id; + + template <typename A> + const typename query_columns< ::brep::repository, id_pgsql, A >::location_class_::url_type_ + query_columns< ::brep::repository, id_pgsql, A >::location_class_:: + url (A::table_name, "\"location_url\"", 0); + + template <typename A> + const typename query_columns< ::brep::repository, id_pgsql, A >::location_class_::type_type_ + query_columns< ::brep::repository, id_pgsql, A >::location_class_:: + type (A::table_name, "\"location_type\"", 0); + + template <typename A> + const typename query_columns< ::brep::repository, id_pgsql, A >::location_class_ + query_columns< ::brep::repository, id_pgsql, A >::location; + + template <typename A> + const typename query_columns< ::brep::repository, id_pgsql, A >::display_name_type_ + query_columns< ::brep::repository, id_pgsql, A >:: + display_name (A::table_name, "\"display_name\"", 0); + + template <typename A> + const typename query_columns< ::brep::repository, id_pgsql, A >::priority_type_ + query_columns< ::brep::repository, id_pgsql, A >:: + priority (A::table_name, "\"priority\"", 0); + + template <typename A> + const typename query_columns< ::brep::repository, id_pgsql, A >::interface_url_type_ + query_columns< ::brep::repository, id_pgsql, A >:: + interface_url (A::table_name, "\"interface_url\"", 0); + + template <typename A> + const typename query_columns< ::brep::repository, id_pgsql, A >::email_class_::value_type_ + query_columns< ::brep::repository, id_pgsql, A >::email_class_:: + value (A::table_name, "\"email\"", 0); + + template <typename A> + const typename query_columns< ::brep::repository, id_pgsql, A >::email_class_::comment_type_ + query_columns< ::brep::repository, id_pgsql, A >::email_class_:: + comment (A::table_name, "\"email_comment\"", 0); + + template <typename A> + const typename query_columns< ::brep::repository, id_pgsql, A >::email_class_ + query_columns< ::brep::repository, id_pgsql, A >::email; + + template <typename A> + const typename query_columns< ::brep::repository, id_pgsql, A >::summary_type_ + query_columns< ::brep::repository, id_pgsql, A >:: + summary (A::table_name, "\"summary\"", 0); + + template <typename A> + const typename query_columns< ::brep::repository, id_pgsql, A >::description_type_ + query_columns< ::brep::repository, id_pgsql, A >:: + description (A::table_name, "\"description\"", 0); + + template <typename A> + const typename query_columns< ::brep::repository, id_pgsql, A >::cache_location_class_::url_type_ + query_columns< ::brep::repository, id_pgsql, A >::cache_location_class_:: + url (A::table_name, "\"cache_location_url\"", 0); + + template <typename A> + const typename query_columns< ::brep::repository, id_pgsql, A >::cache_location_class_::type_type_ + query_columns< ::brep::repository, id_pgsql, A >::cache_location_class_:: + type (A::table_name, "\"cache_location_type\"", 0); + + template <typename A> + const typename query_columns< ::brep::repository, id_pgsql, A >::cache_location_class_ + query_columns< ::brep::repository, id_pgsql, A >::cache_location; + + template <typename A> + const typename query_columns< ::brep::repository, id_pgsql, A >::certificate_class_::fingerprint_type_ + query_columns< ::brep::repository, id_pgsql, A >::certificate_class_:: + fingerprint (A::table_name, "\"certificate_fingerprint\"", 0); + + template <typename A> + const typename query_columns< ::brep::repository, id_pgsql, A >::certificate_class_::name_type_ + query_columns< ::brep::repository, id_pgsql, A >::certificate_class_:: + name (A::table_name, "\"certificate_name\"", 0); + + template <typename A> + const typename query_columns< ::brep::repository, id_pgsql, A >::certificate_class_::organization_type_ + query_columns< ::brep::repository, id_pgsql, A >::certificate_class_:: + organization (A::table_name, "\"certificate_organization\"", 0); + + template <typename A> + const typename query_columns< ::brep::repository, id_pgsql, A >::certificate_class_::email_type_ + query_columns< ::brep::repository, id_pgsql, A >::certificate_class_:: + email (A::table_name, "\"certificate_email\"", 0); + + template <typename A> + const typename query_columns< ::brep::repository, id_pgsql, A >::certificate_class_::pem_type_ + query_columns< ::brep::repository, id_pgsql, A >::certificate_class_:: + pem (A::table_name, "\"certificate_pem\"", 0); + + template <typename A> + const typename query_columns< ::brep::repository, id_pgsql, A >::certificate_class_ + query_columns< ::brep::repository, id_pgsql, A >::certificate; + + template <typename A> + const typename query_columns< ::brep::repository, id_pgsql, A >::packages_timestamp_type_ + query_columns< ::brep::repository, id_pgsql, A >:: + packages_timestamp (A::table_name, "\"packages_timestamp\"", 0); + + template <typename A> + const typename query_columns< ::brep::repository, id_pgsql, A >::repositories_timestamp_type_ + query_columns< ::brep::repository, id_pgsql, A >:: + repositories_timestamp (A::table_name, "\"repositories_timestamp\"", 0); + + template <typename A> + const typename query_columns< ::brep::repository, id_pgsql, A >::internal_type_ + query_columns< ::brep::repository, id_pgsql, A >:: + internal (A::table_name, "\"internal\"", 0); + + template <typename A> + const typename query_columns< ::brep::repository, id_pgsql, A >::buildable_type_ + query_columns< ::brep::repository, id_pgsql, A >:: + buildable (A::table_name, "\"buildable\"", 0); + + template <typename A> + struct pointer_query_columns< ::brep::repository, id_pgsql, A >: + query_columns< ::brep::repository, id_pgsql, A > + { + }; + + template <> + class access::object_traits_impl< ::brep::repository, id_pgsql >: + public access::object_traits< ::brep::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; + + // display_name + // + details::buffer display_name_value; + std::size_t display_name_size; + bool display_name_null; + + // priority + // + int priority_value; + bool priority_null; + + // interface_url + // + details::buffer interface_url_value; + std::size_t interface_url_size; + bool interface_url_null; + + // email + // + composite_value_traits< ::bpkg::email, id_pgsql >::image_type email_value; + + // summary + // + details::buffer summary_value; + std::size_t summary_size; + bool summary_null; + + // description + // + details::buffer description_value; + std::size_t description_size; + bool description_null; + + // cache_location + // + composite_value_traits< ::brep::_repository_location, id_pgsql >::image_type cache_location_value; + + // certificate + // + composite_value_traits< ::brep::certificate, id_pgsql >::image_type certificate_value; + + // packages_timestamp + // + long long packages_timestamp_value; + bool packages_timestamp_null; + + // repositories_timestamp + // + long long repositories_timestamp_value; + bool repositories_timestamp_null; + + // internal + // + bool internal_value; + bool internal_null; + + // buildable + // + bool buildable_value; + bool buildable_null; + + std::size_t version; + }; + + struct extra_statement_cache_type; + + // complements + // + struct complements_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 = 2UL; + static const std::size_t data_column_count = 5UL; + + static const bool versioned = false; + + static const char insert_statement[]; + static const char select_statement[]; + static const char delete_statement[]; + + typedef ::std::vector< ::odb::lazy_weak_ptr< ::brep::repository > > 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< complements_traits > statements_type; + + struct data_image_type + { + // index + // + long long index_value; + bool index_null; + + // value + // + composite_value_traits< ::brep::repository_id, 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&); + }; + + // prerequisites + // + struct prerequisites_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 = 2UL; + static const std::size_t data_column_count = 5UL; + + static const bool versioned = false; + + static const char insert_statement[]; + static const char select_statement[]; + static const char delete_statement[]; + + typedef ::std::vector< ::odb::lazy_weak_ptr< ::brep::repository > > 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< prerequisites_traits > statements_type; + + struct data_image_type + { + // index + // + long long index_value; + bool index_null; + + // value + // + composite_value_traits< ::brep::repository_id, 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&); + }; + + 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 = 22UL; + 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 = 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[]; + + static const std::size_t batch = 1UL; + + 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::repository, id_common >: + public access::object_traits_impl< ::brep::repository, id_pgsql > + { + }; + + // repository_count + // + template <> + class access::view_traits_impl< ::brep::repository_count, id_pgsql >: + public access::view_traits< ::brep::repository_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::repository_count, id_common >: + public access::view_traits_impl< ::brep::repository_count, id_pgsql > + { + }; + + // typed_text + // + template <> + class access::composite_value_traits< ::brep::typed_text, id_pgsql > + { + public: + typedef ::brep::typed_text value_type; + + struct image_type + { + // text + // + details::buffer text_value; + std::size_t text_size; + bool text_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; + }; + + // public_key + // + template <typename A> + struct query_columns< ::brep::public_key, 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; + + // fingerprint + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + fingerprint_type_; + + static const fingerprint_type_ fingerprint; + }; + + static const id_class_ id; + + // data + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + data_type_; + + static const data_type_ data; + }; + + template <typename A> + const typename query_columns< ::brep::public_key, id_pgsql, A >::id_class_::tenant_type_ + query_columns< ::brep::public_key, id_pgsql, A >::id_class_:: + tenant (A::table_name, "\"tenant\"", 0); + + template <typename A> + const typename query_columns< ::brep::public_key, id_pgsql, A >::id_class_::fingerprint_type_ + query_columns< ::brep::public_key, id_pgsql, A >::id_class_:: + fingerprint (A::table_name, "\"fingerprint\"", 0); + + template <typename A> + const typename query_columns< ::brep::public_key, id_pgsql, A >::id_class_ + query_columns< ::brep::public_key, id_pgsql, A >::id; + + template <typename A> + const typename query_columns< ::brep::public_key, id_pgsql, A >::data_type_ + query_columns< ::brep::public_key, id_pgsql, A >:: + data (A::table_name, "\"data\"", 0); + + template <typename A> + struct pointer_query_columns< ::brep::public_key, id_pgsql, A >: + query_columns< ::brep::public_key, id_pgsql, A > + { + }; + + template <> + class access::object_traits_impl< ::brep::public_key, id_pgsql >: + public access::object_traits< ::brep::public_key > + { + public: + struct id_image_type + { + composite_value_traits< ::brep::public_key_id, id_pgsql >::image_type id_value; + + std::size_t version; + }; + + struct image_type + { + // id + // + composite_value_traits< ::brep::public_key_id, id_pgsql >::image_type id_value; + + // data + // + details::buffer data_value; + std::size_t data_size; + bool data_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 = 3UL; + 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 = 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[]; + + static const std::size_t batch = 1UL; + + 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::public_key, id_common >: + public access::object_traits_impl< ::brep::public_key, id_pgsql > + { + }; + + // package_build_config + // + template <> + class access::composite_value_traits< ::brep::package_build_config, id_pgsql > + { + public: + typedef ::brep::package_build_config value_type; + + struct image_type + { + // name + // + details::buffer name_value; + std::size_t name_size; + bool name_null; + + // arguments + // + details::buffer arguments_value; + std::size_t arguments_size; + bool arguments_null; + + // comment + // + details::buffer comment_value; + std::size_t comment_size; + bool comment_null; + + // email + // + composite_value_traits< ::bpkg::email, id_pgsql >::image_type email_value; + + // warning_email + // + composite_value_traits< ::bpkg::email, id_pgsql >::image_type warning_email_value; + + // error_email + // + composite_value_traits< ::bpkg::email, id_pgsql >::image_type error_email_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 = 9UL; + }; + + // package_build_bot_key_key + // + template <> + class access::composite_value_traits< ::brep::package_build_bot_key_key, id_pgsql > + { + public: + typedef ::brep::package_build_bot_key_key value_type; + + struct image_type + { + // outer + // + long long outer_value; + bool outer_null; + + // inner + // + long long inner_value; + bool inner_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; + }; + + // _license_key + // + template <> + class access::composite_value_traits< ::brep::package::_license_key, id_pgsql > + { + public: + typedef ::brep::package::_license_key value_type; + + struct image_type + { + // outer + // + long long outer_value; + bool outer_null; + + // inner + // + long long inner_value; + bool inner_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; + }; + + // _dependency_alternative_key + // + template <> + class access::composite_value_traits< ::brep::package::_dependency_alternative_key, id_pgsql > + { + public: + typedef ::brep::package::_dependency_alternative_key value_type; + + struct image_type + { + // outer + // + long long outer_value; + bool outer_null; + + // inner + // + long long inner_value; + bool inner_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; + }; + + // _dependency_key + // + template <> + class access::composite_value_traits< ::brep::package::_dependency_key, id_pgsql > + { + public: + typedef ::brep::package::_dependency_key value_type; + + struct image_type + { + // outer + // + long long outer_value; + bool outer_null; + + // middle + // + long long middle_value; + bool middle_null; + + // inner + // + long long inner_value; + bool inner_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; + }; + + // package + // + template <typename A> + struct pointer_query_columns< ::brep::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; + + // upstream_version + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::basic_string< char >, + pgsql::id_string >::query_type, + pgsql::id_string > + upstream_version_type_; + + static const upstream_version_type_ upstream_version; + + // project + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::bpkg::package_name, + pgsql::id_string >::query_type, + pgsql::id_string > + project_type_; + + static const project_type_ project; + + // priority + // + struct priority_class_ + { + priority_class_ () + { + } + + // value + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::bpkg::priority::value_type, + pgsql::id_integer >::query_type, + pgsql::id_integer > + value_type_; + + static const value_type_ value; + + // comment + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + comment_type_; + + static const comment_type_ comment; + }; + + static const priority_class_ priority; + + // summary + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + summary_type_; + + static const summary_type_ summary; + + // description + // + struct description_class_ + { + description_class_ () + { + } + + // text + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + text_type_; + + static const text_type_ text; + + // 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 description_class_ description; + + // package_description + // + struct package_description_class_ + { + package_description_class_ () + { + } + + // text + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + text_type_; + + static const text_type_ text; + + // 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 package_description_class_ package_description; + + // changes + // + struct changes_class_ + { + changes_class_ () + { + } + + // text + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + text_type_; + + static const text_type_ text; + + // 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 changes_class_ changes; + + // url + // + struct url_class_ + { + url_class_ () + { + } + + // value + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + value_type_; + + static const value_type_ value; + + // comment + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + comment_type_; + + static const comment_type_ comment; + }; + + static const url_class_ url; + + // doc_url + // + struct doc_url_class_ + { + doc_url_class_ () + { + } + + // value + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + value_type_; + + static const value_type_ value; + + // comment + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + comment_type_; + + static const comment_type_ comment; + }; + + static const doc_url_class_ doc_url; + + // src_url + // + struct src_url_class_ + { + src_url_class_ () + { + } + + // value + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + value_type_; + + static const value_type_ value; + + // comment + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + comment_type_; + + static const comment_type_ comment; + }; + + static const src_url_class_ src_url; + + // package_url + // + struct package_url_class_ + { + package_url_class_ () + { + } + + // value + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + value_type_; + + static const value_type_ value; + + // comment + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + comment_type_; + + static const comment_type_ comment; + }; + + static const package_url_class_ package_url; + + // email + // + struct email_class_ + { + email_class_ () + { + } + + // value + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + value_type_; + + static const value_type_ value; + + // comment + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + comment_type_; + + static const comment_type_ comment; + }; + + static const email_class_ email; + + // package_email + // + struct package_email_class_ + { + package_email_class_ () + { + } + + // value + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + value_type_; + + static const value_type_ value; + + // comment + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + comment_type_; + + static const comment_type_ comment; + }; + + static const package_email_class_ package_email; + + // build_email + // + struct build_email_class_ + { + build_email_class_ () + { + } + + // value + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + value_type_; + + static const value_type_ value; + + // comment + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + comment_type_; + + static const comment_type_ comment; + }; + + static const build_email_class_ build_email; + + // build_warning_email + // + struct build_warning_email_class_ + { + build_warning_email_class_ () + { + } + + // value + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + value_type_; + + static const value_type_ value; + + // comment + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + comment_type_; + + static const comment_type_ comment; + }; + + static const build_warning_email_class_ build_warning_email; + + // build_error_email + // + struct build_error_email_class_ + { + build_error_email_class_ () + { + } + + // value + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + value_type_; + + static const value_type_ value; + + // comment + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + comment_type_; + + static const comment_type_ comment; + }; + + static const build_error_email_class_ build_error_email; + + // 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; + + // location + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::basic_string< char >, + pgsql::id_string >::query_type, + pgsql::id_string > + location_type_; + + static const location_type_ location; + + // fragment + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::basic_string< char >, + pgsql::id_string >::query_type, + pgsql::id_string > + fragment_type_; + + static const fragment_type_ fragment; + + // sha256sum + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::basic_string< char >, + pgsql::id_string >::query_type, + pgsql::id_string > + sha256sum_type_; + + static const sha256sum_type_ sha256sum; + + // buildable + // + typedef + pgsql::query_column< + pgsql::value_traits< + bool, + pgsql::id_boolean >::query_type, + pgsql::id_boolean > + buildable_type_; + + static const buildable_type_ buildable; + + // unbuildable_reason + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::basic_string< char >, + pgsql::id_string >::query_type, + pgsql::id_string > + unbuildable_reason_type_; + + static const unbuildable_reason_type_ unbuildable_reason; + + // custom_bot + // + typedef + pgsql::query_column< + pgsql::value_traits< + bool, + pgsql::id_boolean >::query_type, + pgsql::id_boolean > + custom_bot_type_; + + static const custom_bot_type_ custom_bot; + + // search_index + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::brep::weighted_text, + pgsql::id_string >::query_type, + pgsql::id_string > + search_index_type_; + + static const search_index_type_ search_index; + }; + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::id_class_::tenant_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >::id_class_:: + tenant (A::table_name, "\"tenant\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::id_class_::name_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >::id_class_:: + name (A::table_name, "\"name\"", "(?)::CITEXT"); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::id_class_::version_class_1_::epoch_type_ + pointer_query_columns< ::brep::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::package, id_pgsql, A >::id_class_::version_class_1_::canonical_upstream_type_ + pointer_query_columns< ::brep::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::package, id_pgsql, A >::id_class_::version_class_1_::canonical_release_type_ + pointer_query_columns< ::brep::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::package, id_pgsql, A >::id_class_::version_class_1_::revision_type_ + pointer_query_columns< ::brep::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::package, id_pgsql, A >::id_class_::version_class_1_ + pointer_query_columns< ::brep::package, id_pgsql, A >::id_class_::version; + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::id_class_ + pointer_query_columns< ::brep::package, id_pgsql, A >::id; + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::version_class_::upstream_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >::version_class_:: + upstream (A::table_name, "\"version_upstream\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::version_class_::release_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >::version_class_:: + release (A::table_name, "\"version_release\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::version_class_ + pointer_query_columns< ::brep::package, id_pgsql, A >::version; + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::upstream_version_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >:: + upstream_version (A::table_name, "\"upstream_version\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::project_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >:: + project (A::table_name, "\"project\"", "(?)::CITEXT"); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::priority_class_::value_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >::priority_class_:: + value (A::table_name, "\"priority\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::priority_class_::comment_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >::priority_class_:: + comment (A::table_name, "\"priority_comment\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::priority_class_ + pointer_query_columns< ::brep::package, id_pgsql, A >::priority; + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::summary_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >:: + summary (A::table_name, "\"summary\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::description_class_::text_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >::description_class_:: + text (A::table_name, "\"description\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::description_class_::type_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >::description_class_:: + type (A::table_name, "\"description_type\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::description_class_ + pointer_query_columns< ::brep::package, id_pgsql, A >::description; + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::package_description_class_::text_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >::package_description_class_:: + text (A::table_name, "\"package_description\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::package_description_class_::type_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >::package_description_class_:: + type (A::table_name, "\"package_description_type\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::package_description_class_ + pointer_query_columns< ::brep::package, id_pgsql, A >::package_description; + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::changes_class_::text_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >::changes_class_:: + text (A::table_name, "\"changes\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::changes_class_::type_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >::changes_class_:: + type (A::table_name, "\"changes_type\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::changes_class_ + pointer_query_columns< ::brep::package, id_pgsql, A >::changes; + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::url_class_::value_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >::url_class_:: + value (A::table_name, "\"url\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::url_class_::comment_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >::url_class_:: + comment (A::table_name, "\"url_comment\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::url_class_ + pointer_query_columns< ::brep::package, id_pgsql, A >::url; + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::doc_url_class_::value_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >::doc_url_class_:: + value (A::table_name, "\"doc_url\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::doc_url_class_::comment_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >::doc_url_class_:: + comment (A::table_name, "\"doc_url_comment\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::doc_url_class_ + pointer_query_columns< ::brep::package, id_pgsql, A >::doc_url; + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::src_url_class_::value_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >::src_url_class_:: + value (A::table_name, "\"src_url\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::src_url_class_::comment_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >::src_url_class_:: + comment (A::table_name, "\"src_url_comment\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::src_url_class_ + pointer_query_columns< ::brep::package, id_pgsql, A >::src_url; + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::package_url_class_::value_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >::package_url_class_:: + value (A::table_name, "\"package_url\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::package_url_class_::comment_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >::package_url_class_:: + comment (A::table_name, "\"package_url_comment\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::package_url_class_ + pointer_query_columns< ::brep::package, id_pgsql, A >::package_url; + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::email_class_::value_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >::email_class_:: + value (A::table_name, "\"email\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::email_class_::comment_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >::email_class_:: + comment (A::table_name, "\"email_comment\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::email_class_ + pointer_query_columns< ::brep::package, id_pgsql, A >::email; + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::package_email_class_::value_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >::package_email_class_:: + value (A::table_name, "\"package_email\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::package_email_class_::comment_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >::package_email_class_:: + comment (A::table_name, "\"package_email_comment\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::package_email_class_ + pointer_query_columns< ::brep::package, id_pgsql, A >::package_email; + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::build_email_class_::value_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >::build_email_class_:: + value (A::table_name, "\"build_email\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::build_email_class_::comment_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >::build_email_class_:: + comment (A::table_name, "\"build_email_comment\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::build_email_class_ + pointer_query_columns< ::brep::package, id_pgsql, A >::build_email; + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::build_warning_email_class_::value_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >::build_warning_email_class_:: + value (A::table_name, "\"build_warning_email\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::build_warning_email_class_::comment_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >::build_warning_email_class_:: + comment (A::table_name, "\"build_warning_email_comment\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::build_warning_email_class_ + pointer_query_columns< ::brep::package, id_pgsql, A >::build_warning_email; + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::build_error_email_class_::value_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >::build_error_email_class_:: + value (A::table_name, "\"build_error_email\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::build_error_email_class_::comment_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >::build_error_email_class_:: + comment (A::table_name, "\"build_error_email_comment\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::build_error_email_class_ + pointer_query_columns< ::brep::package, id_pgsql, A >::build_error_email; + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::internal_repository_class_::tenant_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >::internal_repository_class_:: + tenant (A::table_name, "\"internal_repository_tenant\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::internal_repository_class_::canonical_name_type_ + pointer_query_columns< ::brep::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::package, id_pgsql, A >::internal_repository_class_ + pointer_query_columns< ::brep::package, id_pgsql, A >::internal_repository; + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::location_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >:: + location (A::table_name, "\"location\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::fragment_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >:: + fragment (A::table_name, "\"fragment\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::sha256sum_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >:: + sha256sum (A::table_name, "\"sha256sum\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::buildable_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >:: + buildable (A::table_name, "\"buildable\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::unbuildable_reason_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >:: + unbuildable_reason (A::table_name, "\"unbuildable_reason\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::custom_bot_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >:: + custom_bot (A::table_name, "\"custom_bot\"", 0); + + template <typename A> + const typename pointer_query_columns< ::brep::package, id_pgsql, A >::search_index_type_ + pointer_query_columns< ::brep::package, id_pgsql, A >:: + search_index (A::table_name, "\"search_index\"", "to_tsvector((?)::weighted_text)"); + + template <> + class access::object_traits_impl< ::brep::package, id_pgsql >: + public access::object_traits< ::brep::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::package::upstream_version_type, id_pgsql >::image_type version_value; + + // upstream_version + // + details::buffer upstream_version_value; + std::size_t upstream_version_size; + bool upstream_version_null; + + // project + // + details::buffer project_value; + std::size_t project_size; + bool project_null; + + // priority + // + composite_value_traits< ::brep::package::priority_type, id_pgsql >::image_type priority_value; + + // summary + // + details::buffer summary_value; + std::size_t summary_size; + bool summary_null; + + // description + // + composite_value_traits< ::brep::typed_text, id_pgsql >::image_type description_value; + + // package_description + // + composite_value_traits< ::brep::typed_text, id_pgsql >::image_type package_description_value; + + // changes + // + composite_value_traits< ::brep::typed_text, id_pgsql >::image_type changes_value; + + // url + // + composite_value_traits< ::bpkg::manifest_url, id_pgsql >::image_type url_value; + + // doc_url + // + composite_value_traits< ::bpkg::manifest_url, id_pgsql >::image_type doc_url_value; + + // src_url + // + composite_value_traits< ::bpkg::manifest_url, id_pgsql >::image_type src_url_value; + + // package_url + // + composite_value_traits< ::bpkg::manifest_url, id_pgsql >::image_type package_url_value; + + // email + // + composite_value_traits< ::bpkg::email, id_pgsql >::image_type email_value; + + // package_email + // + composite_value_traits< ::bpkg::email, id_pgsql >::image_type package_email_value; + + // build_email + // + composite_value_traits< ::bpkg::email, id_pgsql >::image_type build_email_value; + + // build_warning_email + // + composite_value_traits< ::bpkg::email, id_pgsql >::image_type build_warning_email_value; + + // build_error_email + // + composite_value_traits< ::bpkg::email, id_pgsql >::image_type build_error_email_value; + + // internal_repository + // + composite_value_traits< ::brep::repository_id, id_pgsql >::image_type internal_repository_value; + + // location + // + details::buffer location_value; + std::size_t location_size; + bool location_null; + + // fragment + // + details::buffer fragment_value; + std::size_t fragment_size; + bool fragment_null; + + // sha256sum + // + details::buffer sha256sum_value; + std::size_t sha256sum_size; + bool sha256sum_null; + + // buildable + // + bool buildable_value; + bool buildable_null; + + // unbuildable_reason + // + details::buffer unbuildable_reason_value; + std::size_t unbuildable_reason_size; + bool unbuildable_reason_null; + + // custom_bot + // + bool custom_bot_value; + bool custom_bot_null; + + // search_index + // + details::buffer search_index_value; + std::size_t search_index_size; + bool search_index_null; + + std::size_t version; + }; + + struct extra_statement_cache_type; + + // license_alternatives + // + struct license_alternatives_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 = 8UL; + + static const bool versioned = false; + + static const char insert_statement[]; + static const char select_statement[]; + static const char delete_statement[]; + + typedef ::brep::package::license_alternatives_type 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< license_alternatives_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&); + }; + + // licenses + // + struct licenses_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 ::std::map< ::odb::nested_key< ::bpkg::licenses >, ::std::basic_string< char > > container_type; + typedef + odb::access::container_traits<container_type> + container_traits_type; + typedef container_traits_type::key_type key_type; + typedef container_traits_type::value_type value_type; + + typedef map_functions<key_type, value_type> functions_type; + typedef pgsql::container_statements< licenses_traits > statements_type; + + struct data_image_type + { + // key + // + composite_value_traits< key_type, id_pgsql >::image_type key_value; + + // value + // + details::buffer value_value; + std::size_t value_size; + bool value_null; + + 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&, + const key_type*, + const value_type&); + + static void + init (key_type&, + value_type&, + const data_image_type&, + database*); + + static void + insert (const key_type&, const value_type&, void*); + + static bool + select (key_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&); + }; + + // topics + // + struct topics_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 = 8UL; + + static const bool versioned = false; + + static const char insert_statement[]; + static const char select_statement[]; + static const char delete_statement[]; + + typedef ::butl::small_vector< ::std::basic_string< char >, 5 > 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< topics_traits > statements_type; + + struct data_image_type + { + // index + // + long long index_value; + bool index_null; + + // value + // + details::buffer value_value; + std::size_t value_size; + bool value_null; + + 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&); + }; + + // keywords + // + struct keywords_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 = 8UL; + + static const bool versioned = false; + + static const char insert_statement[]; + static const char select_statement[]; + static const char delete_statement[]; + + typedef ::butl::small_vector< ::std::basic_string< char >, 5 > 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< keywords_traits > statements_type; + + struct data_image_type + { + // index + // + long long index_value; + bool index_null; + + // value + // + details::buffer value_value; + std::size_t value_size; + bool value_null; + + 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&); + }; + + // dependencies + // + struct dependencies_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::package::dependencies_type 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< dependencies_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&); + }; + + // dependency_alternatives + // + struct dependency_alternatives_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 = 13UL; + + static const bool versioned = false; + + static const char insert_statement[]; + static const char select_statement[]; + static const char delete_statement[]; + + typedef ::std::map< ::odb::nested_key< ::brep::dependency_alternatives >, ::brep::dependency_alternative > container_type; + typedef + odb::access::container_traits<container_type> + container_traits_type; + typedef container_traits_type::key_type key_type; + typedef container_traits_type::value_type value_type; + + typedef map_functions<key_type, value_type> functions_type; + typedef pgsql::container_statements< dependency_alternatives_traits > statements_type; + + struct data_image_type + { + // key + // + composite_value_traits< key_type, id_pgsql >::image_type key_value; + + // 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&, + const key_type*, + const value_type&); + + static void + init (key_type&, + value_type&, + const data_image_type&, + database*); + + static void + insert (const key_type&, const value_type&, void*); + + static bool + select (key_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&); + }; + + // dependency_alternative_dependencies + // + struct dependency_alternative_dependencies_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 = 30UL; + + static const bool versioned = false; + + static const char insert_statement[]; + static const char select_statement[]; + static const char delete_statement[]; + + typedef ::std::map< ::odb::nested2_key< ::brep::dependency_alternatives >, ::brep::dependency > container_type; + typedef + odb::access::container_traits<container_type> + container_traits_type; + typedef container_traits_type::key_type key_type; + typedef container_traits_type::value_type value_type; + + typedef map_functions<key_type, value_type> functions_type; + typedef pgsql::container_statements< dependency_alternative_dependencies_traits > statements_type; + + struct data_image_type + { + // key + // + composite_value_traits< key_type, id_pgsql >::image_type key_value; + + // 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&, + const key_type*, + const value_type&); + + static void + init (key_type&, + value_type&, + const data_image_type&, + database*); + + static void + insert (const key_type&, const value_type&, void*); + + static bool + select (key_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&); + }; + + // requirements + // + struct requirements_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::package::requirements_type 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< requirements_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&); + }; + + // requirement_alternatives + // + struct requirement_alternatives_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 = 10UL; + + static const bool versioned = false; + + static const char insert_statement[]; + static const char select_statement[]; + static const char delete_statement[]; + + typedef ::brep::requirement_alternatives_map container_type; + typedef + odb::access::container_traits<container_type> + container_traits_type; + typedef container_traits_type::key_type key_type; + typedef container_traits_type::value_type value_type; + + typedef map_functions<key_type, value_type> functions_type; + typedef pgsql::container_statements< requirement_alternatives_traits > statements_type; + + struct data_image_type + { + // key + // + composite_value_traits< key_type, id_pgsql >::image_type key_value; + + // 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&, + const key_type*, + const value_type&); + + static void + init (key_type&, + value_type&, + const data_image_type&, + database*); + + static void + insert (const key_type&, const value_type&, void*); + + static bool + select (key_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&); + }; + + // requirement_alternative_requirements + // + struct requirement_alternative_requirements_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 = 10UL; + + static const bool versioned = false; + + static const char insert_statement[]; + static const char select_statement[]; + static const char delete_statement[]; + + typedef ::brep::requirement_alternative_requirements_map container_type; + typedef + odb::access::container_traits<container_type> + container_traits_type; + typedef container_traits_type::key_type key_type; + typedef container_traits_type::value_type value_type; + + typedef map_functions<key_type, value_type> functions_type; + typedef pgsql::container_statements< requirement_alternative_requirements_traits > statements_type; + + struct data_image_type + { + // key + // + composite_value_traits< key_type, id_pgsql >::image_type key_value; + + // value + // + details::buffer value_value; + std::size_t value_size; + bool value_null; + + 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&, + const key_type*, + const value_type&); + + static void + init (key_type&, + value_type&, + const data_image_type&, + database*); + + static void + insert (const key_type&, const value_type&, void*); + + static bool + select (key_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&); + }; + + // 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 = 32UL; + + 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::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 + update (const 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 + update (const container_type&, + statements_type&); + + static void + erase (statements_type&); + }; + + // build_constraints + // + struct build_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::package::build_constraints_type 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< build_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 + update (const container_type&, + statements_type&); + + static void + erase (statements_type&); + }; + + // build_auxiliaries + // + struct build_auxiliaries_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 = 10UL; + + static const bool versioned = false; + + static const char insert_statement[]; + static const char select_statement[]; + static const char delete_statement[]; + + typedef ::brep::package::build_auxiliaries_type 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< build_auxiliaries_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&); + }; + + // build_bot_keys + // + struct build_bot_keys_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::package_build_bot_keys 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< build_bot_keys_traits > statements_type; + + struct data_image_type + { + // index + // + long long index_value; + bool index_null; + + // value + // + composite_value_traits< ::brep::public_key_id, 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&); + }; + + // build_configs + // + struct build_configs_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 = 16UL; + + static const bool versioned = false; + + static const char insert_statement[]; + static const char select_statement[]; + static const char delete_statement[]; + + typedef ::brep::package_build_configs 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< build_configs_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&); + }; + + // build_config_builds + // + struct build_config_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 = 10UL; + + 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_map container_type; + typedef + odb::access::container_traits<container_type> + container_traits_type; + typedef container_traits_type::key_type key_type; + typedef container_traits_type::value_type value_type; + + typedef map_functions<key_type, value_type> functions_type; + typedef pgsql::container_statements< build_config_builds_traits > statements_type; + + struct data_image_type + { + // key + // + composite_value_traits< key_type, id_pgsql >::image_type key_value; + + // 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&, + const key_type*, + const value_type&); + + static void + init (key_type&, + value_type&, + const data_image_type&, + database*); + + static void + insert (const key_type&, const value_type&, void*); + + static bool + select (key_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&); + }; + + // build_config_constraints + // + struct build_config_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 = 12UL; + + static const bool versioned = false; + + static const char insert_statement[]; + static const char select_statement[]; + static const char delete_statement[]; + + typedef ::brep::build_constraints_map container_type; + typedef + odb::access::container_traits<container_type> + container_traits_type; + typedef container_traits_type::key_type key_type; + typedef container_traits_type::value_type value_type; + + typedef map_functions<key_type, value_type> functions_type; + typedef pgsql::container_statements< build_config_constraints_traits > statements_type; + + struct data_image_type + { + // key + // + composite_value_traits< key_type, id_pgsql >::image_type key_value; + + // 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&, + const key_type*, + const value_type&); + + static void + init (key_type&, + value_type&, + const data_image_type&, + database*); + + static void + insert (const key_type&, const value_type&, void*); + + static bool + select (key_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&); + }; + + // build_config_auxiliaries + // + struct build_config_auxiliaries_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_auxiliaries_map container_type; + typedef + odb::access::container_traits<container_type> + container_traits_type; + typedef container_traits_type::key_type key_type; + typedef container_traits_type::value_type value_type; + + typedef map_functions<key_type, value_type> functions_type; + typedef pgsql::container_statements< build_config_auxiliaries_traits > statements_type; + + struct data_image_type + { + // key + // + composite_value_traits< key_type, id_pgsql >::image_type key_value; + + // 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&, + const key_type*, + const value_type&); + + static void + init (key_type&, + value_type&, + const data_image_type&, + database*); + + static void + insert (const key_type&, const value_type&, void*); + + static bool + select (key_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&); + }; + + // build_config_bot_keys + // + struct build_config_bot_keys_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 = 10UL; + + static const bool versioned = false; + + static const char insert_statement[]; + static const char select_statement[]; + static const char delete_statement[]; + + typedef ::brep::package_build_bot_keys_map container_type; + typedef + odb::access::container_traits<container_type> + container_traits_type; + typedef container_traits_type::key_type key_type; + typedef container_traits_type::value_type value_type; + + typedef map_functions<key_type, value_type> functions_type; + typedef pgsql::container_statements< build_config_bot_keys_traits > statements_type; + + struct data_image_type + { + // key + // + composite_value_traits< key_type, id_pgsql >::image_type key_value; + + // value + // + composite_value_traits< ::brep::public_key_id, 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&, + const key_type*, + const value_type&); + + static void + init (key_type&, + value_type&, + const data_image_type&, + database*); + + static void + insert (const key_type&, const value_type&, void*); + + static bool + select (key_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&); + }; + + // other_repositories + // + struct other_repositories_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 ::std::vector< ::odb::lazy_shared_ptr< ::brep::repository > > 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< other_repositories_traits > statements_type; + + struct data_image_type + { + // index + // + long long index_value; + bool index_null; + + // value + // + composite_value_traits< ::brep::repository_id, 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&); + }; + + // build_section + // + struct build_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 = 6UL; + 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&); + }; + + // unused_section + // + struct unused_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 = 6UL; + 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&); + }; + + 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 = 46UL; + 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 = 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[]; + + static const std::size_t batch = 1UL; + + 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::package, id_common >: + public access::object_traits_impl< ::brep::package, id_pgsql > + { + }; + + // latest_package_search_rank + // + template <> + class access::view_traits_impl< ::brep::latest_package_search_rank, id_pgsql >: + public access::view_traits< ::brep::latest_package_search_rank > + { + public: + struct image_type + { + // id + // + composite_value_traits< ::brep::package_id, id_pgsql >::image_type id_value; + + // rank + // + double rank_value; + bool rank_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 = 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::latest_package_search_rank, id_common >: + public access::view_traits_impl< ::brep::latest_package_search_rank, id_pgsql > + { + }; + + // latest_package_count + // + template <> + class access::view_traits_impl< ::brep::latest_package_count, id_pgsql >: + public access::view_traits< ::brep::latest_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::latest_package_count, id_common >: + public access::view_traits_impl< ::brep::latest_package_count, id_pgsql > + { + }; + + // package_search_rank + // + template <> + class access::view_traits_impl< ::brep::package_search_rank, id_pgsql >: + public access::view_traits< ::brep::package_search_rank > + { + public: + struct image_type + { + // id + // + composite_value_traits< ::brep::package_id, id_pgsql >::image_type id_value; + + // rank + // + double rank_value; + bool rank_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 = 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::package_search_rank, id_common >: + public access::view_traits_impl< ::brep::package_search_rank, id_pgsql > + { + }; + + // package_count + // + template <> + class access::view_traits_impl< ::brep::package_count, id_pgsql >: + public access::view_traits< ::brep::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::package_count, id_common >: + public access::view_traits_impl< ::brep::package_count, id_pgsql > + { + }; + + // latest_package + // + template <> + class access::view_traits_impl< ::brep::latest_package, id_pgsql >: + public access::view_traits< ::brep::latest_package > + { + public: + struct image_type + { + // id + // + composite_value_traits< ::brep::package_id, id_pgsql >::image_type id_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 = 6UL; + + 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::latest_package, id_common >: + public access::view_traits_impl< ::brep::latest_package, id_pgsql > + { + }; + + // tenant + // + // tenant_id + // + struct access::view_traits_impl< ::brep::tenant_id, id_pgsql >::query_columns: + odb::pointer_query_columns< + ::brep::tenant, + id_pgsql, + odb::access::object_traits_impl< ::brep::tenant, id_pgsql > > + { + }; + + // repository + // + // repository_count + // + struct access::view_traits_impl< ::brep::repository_count, id_pgsql >::query_columns: + odb::pointer_query_columns< + ::brep::repository, + id_pgsql, + odb::access::object_traits_impl< ::brep::repository, id_pgsql > > + { + }; + + // public_key + // + // package + // + template <> + struct alias_traits< + ::brep::repository, + id_pgsql, + access::object_traits_impl< ::brep::package, id_pgsql >::internal_repository_tag> + { + static const char table_name[]; + }; + + template <> + struct query_columns_base< ::brep::package, id_pgsql > + { + // internal_repository + // + typedef + odb::alias_traits< + ::brep::repository, + id_pgsql, + access::object_traits_impl< ::brep::package, id_pgsql >::internal_repository_tag> + internal_repository_alias_; + }; + + template <typename A> + struct query_columns< ::brep::package, id_pgsql, A >: + query_columns_base< ::brep::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; + + // upstream_version + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::basic_string< char >, + pgsql::id_string >::query_type, + pgsql::id_string > + upstream_version_type_; + + static const upstream_version_type_ upstream_version; + + // project + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::bpkg::package_name, + pgsql::id_string >::query_type, + pgsql::id_string > + project_type_; + + static const project_type_ project; + + // priority + // + struct priority_class_ + { + priority_class_ () + { + } + + // value + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::bpkg::priority::value_type, + pgsql::id_integer >::query_type, + pgsql::id_integer > + value_type_; + + static const value_type_ value; + + // comment + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + comment_type_; + + static const comment_type_ comment; + }; + + static const priority_class_ priority; + + // summary + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + summary_type_; + + static const summary_type_ summary; + + // description + // + struct description_class_ + { + description_class_ () + { + } + + // text + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + text_type_; + + static const text_type_ text; + + // 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 description_class_ description; + + // package_description + // + struct package_description_class_ + { + package_description_class_ () + { + } + + // text + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + text_type_; + + static const text_type_ text; + + // 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 package_description_class_ package_description; + + // changes + // + struct changes_class_ + { + changes_class_ () + { + } + + // text + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + text_type_; + + static const text_type_ text; + + // 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 changes_class_ changes; + + // url + // + struct url_class_ + { + url_class_ () + { + } + + // value + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + value_type_; + + static const value_type_ value; + + // comment + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + comment_type_; + + static const comment_type_ comment; + }; + + static const url_class_ url; + + // doc_url + // + struct doc_url_class_ + { + doc_url_class_ () + { + } + + // value + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + value_type_; + + static const value_type_ value; + + // comment + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + comment_type_; + + static const comment_type_ comment; + }; + + static const doc_url_class_ doc_url; + + // src_url + // + struct src_url_class_ + { + src_url_class_ () + { + } + + // value + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + value_type_; + + static const value_type_ value; + + // comment + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + comment_type_; + + static const comment_type_ comment; + }; + + static const src_url_class_ src_url; + + // package_url + // + struct package_url_class_ + { + package_url_class_ () + { + } + + // value + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + value_type_; + + static const value_type_ value; + + // comment + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + comment_type_; + + static const comment_type_ comment; + }; + + static const package_url_class_ package_url; + + // email + // + struct email_class_ + { + email_class_ () + { + } + + // value + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + value_type_; + + static const value_type_ value; + + // comment + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + comment_type_; + + static const comment_type_ comment; + }; + + static const email_class_ email; + + // package_email + // + struct package_email_class_ + { + package_email_class_ () + { + } + + // value + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + value_type_; + + static const value_type_ value; + + // comment + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + comment_type_; + + static const comment_type_ comment; + }; + + static const package_email_class_ package_email; + + // build_email + // + struct build_email_class_ + { + build_email_class_ () + { + } + + // value + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + value_type_; + + static const value_type_ value; + + // comment + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + comment_type_; + + static const comment_type_ comment; + }; + + static const build_email_class_ build_email; + + // build_warning_email + // + struct build_warning_email_class_ + { + build_warning_email_class_ () + { + } + + // value + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + value_type_; + + static const value_type_ value; + + // comment + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + comment_type_; + + static const comment_type_ comment; + }; + + static const build_warning_email_class_ build_warning_email; + + // build_error_email + // + struct build_error_email_class_ + { + build_error_email_class_ () + { + } + + // value + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + value_type_; + + static const value_type_ value; + + // comment + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::string, + pgsql::id_string >::query_type, + pgsql::id_string > + comment_type_; + + static const comment_type_ comment; + }; + + static const build_error_email_class_ build_error_email; + + // 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::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; + + // location + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::basic_string< char >, + pgsql::id_string >::query_type, + pgsql::id_string > + location_type_; + + static const location_type_ location; + + // fragment + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::basic_string< char >, + pgsql::id_string >::query_type, + pgsql::id_string > + fragment_type_; + + static const fragment_type_ fragment; + + // sha256sum + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::basic_string< char >, + pgsql::id_string >::query_type, + pgsql::id_string > + sha256sum_type_; + + static const sha256sum_type_ sha256sum; + + // buildable + // + typedef + pgsql::query_column< + pgsql::value_traits< + bool, + pgsql::id_boolean >::query_type, + pgsql::id_boolean > + buildable_type_; + + static const buildable_type_ buildable; + + // unbuildable_reason + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::std::basic_string< char >, + pgsql::id_string >::query_type, + pgsql::id_string > + unbuildable_reason_type_; + + static const unbuildable_reason_type_ unbuildable_reason; + + // custom_bot + // + typedef + pgsql::query_column< + pgsql::value_traits< + bool, + pgsql::id_boolean >::query_type, + pgsql::id_boolean > + custom_bot_type_; + + static const custom_bot_type_ custom_bot; + + // search_index + // + typedef + pgsql::query_column< + pgsql::value_traits< + ::brep::weighted_text, + pgsql::id_string >::query_type, + pgsql::id_string > + search_index_type_; + + static const search_index_type_ search_index; + }; + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::id_class_::tenant_type_ + query_columns< ::brep::package, id_pgsql, A >::id_class_:: + tenant (A::table_name, "\"tenant\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::id_class_::name_type_ + query_columns< ::brep::package, id_pgsql, A >::id_class_:: + name (A::table_name, "\"name\"", "(?)::CITEXT"); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::id_class_::version_class_1_::epoch_type_ + query_columns< ::brep::package, id_pgsql, A >::id_class_::version_class_1_:: + epoch (A::table_name, "\"version_epoch\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::id_class_::version_class_1_::canonical_upstream_type_ + query_columns< ::brep::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::package, id_pgsql, A >::id_class_::version_class_1_::canonical_release_type_ + query_columns< ::brep::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::package, id_pgsql, A >::id_class_::version_class_1_::revision_type_ + query_columns< ::brep::package, id_pgsql, A >::id_class_::version_class_1_:: + revision (A::table_name, "\"version_revision\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::id_class_::version_class_1_ + query_columns< ::brep::package, id_pgsql, A >::id_class_::version; + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::id_class_ + query_columns< ::brep::package, id_pgsql, A >::id; + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::version_class_::upstream_type_ + query_columns< ::brep::package, id_pgsql, A >::version_class_:: + upstream (A::table_name, "\"version_upstream\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::version_class_::release_type_ + query_columns< ::brep::package, id_pgsql, A >::version_class_:: + release (A::table_name, "\"version_release\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::version_class_ + query_columns< ::brep::package, id_pgsql, A >::version; + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::upstream_version_type_ + query_columns< ::brep::package, id_pgsql, A >:: + upstream_version (A::table_name, "\"upstream_version\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::project_type_ + query_columns< ::brep::package, id_pgsql, A >:: + project (A::table_name, "\"project\"", "(?)::CITEXT"); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::priority_class_::value_type_ + query_columns< ::brep::package, id_pgsql, A >::priority_class_:: + value (A::table_name, "\"priority\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::priority_class_::comment_type_ + query_columns< ::brep::package, id_pgsql, A >::priority_class_:: + comment (A::table_name, "\"priority_comment\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::priority_class_ + query_columns< ::brep::package, id_pgsql, A >::priority; + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::summary_type_ + query_columns< ::brep::package, id_pgsql, A >:: + summary (A::table_name, "\"summary\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::description_class_::text_type_ + query_columns< ::brep::package, id_pgsql, A >::description_class_:: + text (A::table_name, "\"description\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::description_class_::type_type_ + query_columns< ::brep::package, id_pgsql, A >::description_class_:: + type (A::table_name, "\"description_type\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::description_class_ + query_columns< ::brep::package, id_pgsql, A >::description; + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::package_description_class_::text_type_ + query_columns< ::brep::package, id_pgsql, A >::package_description_class_:: + text (A::table_name, "\"package_description\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::package_description_class_::type_type_ + query_columns< ::brep::package, id_pgsql, A >::package_description_class_:: + type (A::table_name, "\"package_description_type\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::package_description_class_ + query_columns< ::brep::package, id_pgsql, A >::package_description; + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::changes_class_::text_type_ + query_columns< ::brep::package, id_pgsql, A >::changes_class_:: + text (A::table_name, "\"changes\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::changes_class_::type_type_ + query_columns< ::brep::package, id_pgsql, A >::changes_class_:: + type (A::table_name, "\"changes_type\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::changes_class_ + query_columns< ::brep::package, id_pgsql, A >::changes; + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::url_class_::value_type_ + query_columns< ::brep::package, id_pgsql, A >::url_class_:: + value (A::table_name, "\"url\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::url_class_::comment_type_ + query_columns< ::brep::package, id_pgsql, A >::url_class_:: + comment (A::table_name, "\"url_comment\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::url_class_ + query_columns< ::brep::package, id_pgsql, A >::url; + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::doc_url_class_::value_type_ + query_columns< ::brep::package, id_pgsql, A >::doc_url_class_:: + value (A::table_name, "\"doc_url\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::doc_url_class_::comment_type_ + query_columns< ::brep::package, id_pgsql, A >::doc_url_class_:: + comment (A::table_name, "\"doc_url_comment\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::doc_url_class_ + query_columns< ::brep::package, id_pgsql, A >::doc_url; + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::src_url_class_::value_type_ + query_columns< ::brep::package, id_pgsql, A >::src_url_class_:: + value (A::table_name, "\"src_url\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::src_url_class_::comment_type_ + query_columns< ::brep::package, id_pgsql, A >::src_url_class_:: + comment (A::table_name, "\"src_url_comment\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::src_url_class_ + query_columns< ::brep::package, id_pgsql, A >::src_url; + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::package_url_class_::value_type_ + query_columns< ::brep::package, id_pgsql, A >::package_url_class_:: + value (A::table_name, "\"package_url\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::package_url_class_::comment_type_ + query_columns< ::brep::package, id_pgsql, A >::package_url_class_:: + comment (A::table_name, "\"package_url_comment\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::package_url_class_ + query_columns< ::brep::package, id_pgsql, A >::package_url; + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::email_class_::value_type_ + query_columns< ::brep::package, id_pgsql, A >::email_class_:: + value (A::table_name, "\"email\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::email_class_::comment_type_ + query_columns< ::brep::package, id_pgsql, A >::email_class_:: + comment (A::table_name, "\"email_comment\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::email_class_ + query_columns< ::brep::package, id_pgsql, A >::email; + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::package_email_class_::value_type_ + query_columns< ::brep::package, id_pgsql, A >::package_email_class_:: + value (A::table_name, "\"package_email\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::package_email_class_::comment_type_ + query_columns< ::brep::package, id_pgsql, A >::package_email_class_:: + comment (A::table_name, "\"package_email_comment\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::package_email_class_ + query_columns< ::brep::package, id_pgsql, A >::package_email; + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::build_email_class_::value_type_ + query_columns< ::brep::package, id_pgsql, A >::build_email_class_:: + value (A::table_name, "\"build_email\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::build_email_class_::comment_type_ + query_columns< ::brep::package, id_pgsql, A >::build_email_class_:: + comment (A::table_name, "\"build_email_comment\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::build_email_class_ + query_columns< ::brep::package, id_pgsql, A >::build_email; + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::build_warning_email_class_::value_type_ + query_columns< ::brep::package, id_pgsql, A >::build_warning_email_class_:: + value (A::table_name, "\"build_warning_email\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::build_warning_email_class_::comment_type_ + query_columns< ::brep::package, id_pgsql, A >::build_warning_email_class_:: + comment (A::table_name, "\"build_warning_email_comment\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::build_warning_email_class_ + query_columns< ::brep::package, id_pgsql, A >::build_warning_email; + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::build_error_email_class_::value_type_ + query_columns< ::brep::package, id_pgsql, A >::build_error_email_class_:: + value (A::table_name, "\"build_error_email\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::build_error_email_class_::comment_type_ + query_columns< ::brep::package, id_pgsql, A >::build_error_email_class_:: + comment (A::table_name, "\"build_error_email_comment\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::build_error_email_class_ + query_columns< ::brep::package, id_pgsql, A >::build_error_email; + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::internal_repository_column_class_::tenant_type_ + query_columns< ::brep::package, id_pgsql, A >::internal_repository_column_class_:: + tenant (A::table_name, "\"internal_repository_tenant\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::internal_repository_column_class_::canonical_name_type_ + query_columns< ::brep::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::package, id_pgsql, A >::internal_repository_type_ + query_columns< ::brep::package, id_pgsql, A >::internal_repository; + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::location_type_ + query_columns< ::brep::package, id_pgsql, A >:: + location (A::table_name, "\"location\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::fragment_type_ + query_columns< ::brep::package, id_pgsql, A >:: + fragment (A::table_name, "\"fragment\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::sha256sum_type_ + query_columns< ::brep::package, id_pgsql, A >:: + sha256sum (A::table_name, "\"sha256sum\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::buildable_type_ + query_columns< ::brep::package, id_pgsql, A >:: + buildable (A::table_name, "\"buildable\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::unbuildable_reason_type_ + query_columns< ::brep::package, id_pgsql, A >:: + unbuildable_reason (A::table_name, "\"unbuildable_reason\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::custom_bot_type_ + query_columns< ::brep::package, id_pgsql, A >:: + custom_bot (A::table_name, "\"custom_bot\"", 0); + + template <typename A> + const typename query_columns< ::brep::package, id_pgsql, A >::search_index_type_ + query_columns< ::brep::package, id_pgsql, A >:: + search_index (A::table_name, "\"search_index\"", "to_tsvector((?)::weighted_text)"); +} + +#include <libbrep/package-odb.ixx> + +#include <odb/post.hxx> + +#endif // LIBBREP_PACKAGE_ODB_HXX diff --git a/libbrep/package-odb.ixx b/libbrep/package-odb.ixx new file mode 100644 index 0000000..a0ea85f --- /dev/null +++ b/libbrep/package-odb.ixx @@ -0,0 +1,695 @@ +// -*- C++ -*- +// +// This file was generated by ODB, object-relational mapping (ORM) +// compiler for C++. +// + +namespace odb +{ + // tenant + // + + inline + access::object_traits< ::brep::tenant >::id_type + access::object_traits< ::brep::tenant >:: + id (const object_type& o) + { + return o.id; + } + + inline + void access::object_traits< ::brep::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::tenant >:: + callback (database& db, const object_type& x, callback_event e) + { + ODB_POTENTIALLY_UNUSED (db); + ODB_POTENTIALLY_UNUSED (x); + ODB_POTENTIALLY_UNUSED (e); + } + + // tenant_id + // + + inline + void access::view_traits< ::brep::tenant_id >:: + callback (database& db, view_type& x, callback_event e) + { + ODB_POTENTIALLY_UNUSED (db); + ODB_POTENTIALLY_UNUSED (x); + ODB_POTENTIALLY_UNUSED (e); + } + + // repository + // + + inline + access::object_traits< ::brep::repository >::id_type + access::object_traits< ::brep::repository >:: + id (const object_type& o) + { + return o.id; + } + + inline + void access::object_traits< ::brep::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::repository >:: + callback (database& db, const object_type& x, callback_event e) + { + ODB_POTENTIALLY_UNUSED (db); + ODB_POTENTIALLY_UNUSED (x); + ODB_POTENTIALLY_UNUSED (e); + } + + // repository_count + // + + inline + void access::view_traits< ::brep::repository_count >:: + callback (database& db, view_type& x, callback_event e) + { + ODB_POTENTIALLY_UNUSED (db); + ODB_POTENTIALLY_UNUSED (x); + ODB_POTENTIALLY_UNUSED (e); + } + + // public_key + // + + inline + access::object_traits< ::brep::public_key >::id_type + access::object_traits< ::brep::public_key >:: + id (const object_type& o) + { + return o.id; + } + + inline + void access::object_traits< ::brep::public_key >:: + 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::public_key >:: + callback (database& db, const object_type& x, callback_event e) + { + ODB_POTENTIALLY_UNUSED (db); + ODB_POTENTIALLY_UNUSED (x); + ODB_POTENTIALLY_UNUSED (e); + } + + // package + // + + inline + access::object_traits< ::brep::package >::id_type + access::object_traits< ::brep::package >:: + id (const object_type& o) + { + return o.id; + } + + inline + void access::object_traits< ::brep::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::package >:: + callback (database& db, const object_type& x, callback_event e) + { + ODB_POTENTIALLY_UNUSED (db); + ODB_POTENTIALLY_UNUSED (x); + ODB_POTENTIALLY_UNUSED (e); + } + + // latest_package_search_rank + // + + inline + void access::view_traits< ::brep::latest_package_search_rank >:: + callback (database& db, view_type& x, callback_event e) + { + ODB_POTENTIALLY_UNUSED (db); + ODB_POTENTIALLY_UNUSED (x); + ODB_POTENTIALLY_UNUSED (e); + } + + // latest_package_count + // + + inline + void access::view_traits< ::brep::latest_package_count >:: + callback (database& db, view_type& x, callback_event e) + { + ODB_POTENTIALLY_UNUSED (db); + ODB_POTENTIALLY_UNUSED (x); + ODB_POTENTIALLY_UNUSED (e); + } + + // package_search_rank + // + + inline + void access::view_traits< ::brep::package_search_rank >:: + callback (database& db, view_type& x, callback_event e) + { + ODB_POTENTIALLY_UNUSED (db); + ODB_POTENTIALLY_UNUSED (x); + ODB_POTENTIALLY_UNUSED (e); + } + + // package_count + // + + inline + void access::view_traits< ::brep::package_count >:: + callback (database& db, view_type& x, callback_event e) + { + ODB_POTENTIALLY_UNUSED (db); + ODB_POTENTIALLY_UNUSED (x); + ODB_POTENTIALLY_UNUSED (e); + } + + // latest_package + // + + inline + void access::view_traits< ::brep::latest_package >:: + callback (database& db, view_type& x, callback_event e) + { + ODB_POTENTIALLY_UNUSED (db); + ODB_POTENTIALLY_UNUSED (x); + ODB_POTENTIALLY_UNUSED (e); + } +} + +#include <odb/schema-version.hxx> + +namespace odb +{ + // priority + // + + inline + bool access::composite_value_traits< ::bpkg::priority, id_pgsql >:: + get_null (const image_type& i) + { + bool r (true); + r = r && i.value_null; + r = r && i.comment_null; + return r; + } + + inline + void access::composite_value_traits< ::bpkg::priority, id_pgsql >:: + set_null (image_type& i, + pgsql::statement_kind sk) + { + ODB_POTENTIALLY_UNUSED (sk); + + using namespace pgsql; + + i.value_null = true; + i.comment_null = true; + } + + // licenses + // + + inline + bool access::composite_value_traits< ::bpkg::licenses, id_pgsql >:: + get_null (const image_type& i) + { + bool r (true); + r = r && i.comment_null; + return r; + } + + inline + void access::composite_value_traits< ::bpkg::licenses, id_pgsql >:: + set_null (image_type& i, + pgsql::statement_kind sk) + { + ODB_POTENTIALLY_UNUSED (sk); + + using namespace pgsql; + + i.comment_null = true; + } + + // manifest_url + // + + inline + bool access::composite_value_traits< ::bpkg::manifest_url, id_pgsql >:: + get_null (const image_type& i) + { + bool r (true); + r = r && i.value_null; + r = r && i.comment_null; + return r; + } + + inline + void access::composite_value_traits< ::bpkg::manifest_url, id_pgsql >:: + set_null (image_type& i, + pgsql::statement_kind sk) + { + ODB_POTENTIALLY_UNUSED (sk); + + using namespace pgsql; + + i.value_null = true; + i.comment_null = true; + } + + // dependency + // + + inline + bool access::composite_value_traits< ::brep::dependency, id_pgsql >:: + get_null (const image_type& i) + { + bool r (true); + r = r && i.name_null; + r = r && composite_value_traits< ::bpkg::version_constraint, id_pgsql >::get_null (i.constraint_value); + r = r && composite_value_traits< ::brep::package_id, id_pgsql >::get_null (i.package_value); + return r; + } + + inline + void access::composite_value_traits< ::brep::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< ::bpkg::version_constraint, id_pgsql >::set_null (i.constraint_value, sk); + composite_value_traits< ::brep::package_id, id_pgsql >::set_null (i.package_value, sk); + } + + // dependency_alternative + // + + inline + bool access::composite_value_traits< ::brep::dependency_alternative, id_pgsql >:: + get_null (const image_type& i) + { + bool r (true); + r = r && i.enable_null; + r = r && i.reflect_null; + r = r && i.prefer_null; + r = r && i.accept_null; + r = r && i.require_null; + return r; + } + + inline + void access::composite_value_traits< ::brep::dependency_alternative, id_pgsql >:: + set_null (image_type& i, + pgsql::statement_kind sk) + { + ODB_POTENTIALLY_UNUSED (sk); + + using namespace pgsql; + + i.enable_null = true; + i.reflect_null = true; + i.prefer_null = true; + i.accept_null = true; + i.require_null = true; + } + + // dependency_alternatives + // + + inline + bool access::composite_value_traits< ::brep::dependency_alternatives, id_pgsql >:: + get_null (const image_type& i) + { + bool r (true); + r = r && i.buildtime_null; + r = r && i.comment_null; + return r; + } + + inline + void access::composite_value_traits< ::brep::dependency_alternatives, id_pgsql >:: + set_null (image_type& i, + pgsql::statement_kind sk) + { + ODB_POTENTIALLY_UNUSED (sk); + + using namespace pgsql; + + i.buildtime_null = true; + i.comment_null = true; + } + + // test_dependency + // + + inline + bool access::composite_value_traits< ::brep::test_dependency, id_pgsql >:: + get_null (const image_type& i) + { + bool r (true); + r = r && composite_value_traits< ::brep::dependency, id_pgsql >::get_null (i); + r = r && i.type_null; + r = r && i.buildtime_null; + r = r && i.enable_null; + r = r && i.reflect_null; + return r; + } + + inline + void access::composite_value_traits< ::brep::test_dependency, id_pgsql >:: + set_null (image_type& i, + pgsql::statement_kind sk) + { + ODB_POTENTIALLY_UNUSED (sk); + + using namespace pgsql; + + composite_value_traits< ::brep::dependency, id_pgsql >::set_null (i, sk); + i.type_null = true; + i.buildtime_null = true; + i.enable_null = true; + i.reflect_null = true; + } + + // certificate + // + + inline + bool access::composite_value_traits< ::brep::certificate, id_pgsql >:: + get_null (const image_type& i) + { + bool r (true); + r = r && i.fingerprint_null; + r = r && i.name_null; + r = r && i.organization_null; + r = r && i.email_null; + r = r && i.pem_null; + return r; + } + + inline + void access::composite_value_traits< ::brep::certificate, id_pgsql >:: + set_null (image_type& i, + pgsql::statement_kind sk) + { + ODB_POTENTIALLY_UNUSED (sk); + + using namespace pgsql; + + i.fingerprint_null = true; + i.name_null = true; + i.organization_null = true; + i.email_null = true; + i.pem_null = true; + } + + // tenant + // + + inline + void access::object_traits_impl< ::brep::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::tenant, id_pgsql >:: + load_ (statements_type& sts, + object_type& obj, + bool) + { + ODB_POTENTIALLY_UNUSED (sts); + ODB_POTENTIALLY_UNUSED (obj); + } + + // tenant_id + // + + // repository + // + + inline + void access::object_traits_impl< ::brep::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); + } + + // repository_count + // + + // typed_text + // + + inline + bool access::composite_value_traits< ::brep::typed_text, id_pgsql >:: + get_null (const image_type& i) + { + bool r (true); + r = r && i.text_null; + r = r && i.type_null; + return r; + } + + inline + void access::composite_value_traits< ::brep::typed_text, id_pgsql >:: + set_null (image_type& i, + pgsql::statement_kind sk) + { + ODB_POTENTIALLY_UNUSED (sk); + + using namespace pgsql; + + i.text_null = true; + i.type_null = true; + } + + // public_key + // + + inline + void access::object_traits_impl< ::brep::public_key, 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::public_key, id_pgsql >:: + load_ (statements_type& sts, + object_type& obj, + bool) + { + ODB_POTENTIALLY_UNUSED (sts); + ODB_POTENTIALLY_UNUSED (obj); + } + + // package_build_config + // + + inline + bool access::composite_value_traits< ::brep::package_build_config, id_pgsql >:: + get_null (const image_type& i) + { + bool r (true); + r = r && i.name_null; + r = r && i.arguments_null; + r = r && i.comment_null; + r = r && composite_value_traits< ::bpkg::email, id_pgsql >::get_null (i.email_value); + r = r && composite_value_traits< ::bpkg::email, id_pgsql >::get_null (i.warning_email_value); + r = r && composite_value_traits< ::bpkg::email, id_pgsql >::get_null (i.error_email_value); + return r; + } + + inline + void access::composite_value_traits< ::brep::package_build_config, id_pgsql >:: + set_null (image_type& i, + pgsql::statement_kind sk) + { + ODB_POTENTIALLY_UNUSED (sk); + + using namespace pgsql; + + i.name_null = true; + i.arguments_null = true; + i.comment_null = true; + composite_value_traits< ::bpkg::email, id_pgsql >::set_null (i.email_value, sk); + composite_value_traits< ::bpkg::email, id_pgsql >::set_null (i.warning_email_value, sk); + composite_value_traits< ::bpkg::email, id_pgsql >::set_null (i.error_email_value, sk); + } + + // package_build_bot_key_key + // + + inline + bool access::composite_value_traits< ::brep::package_build_bot_key_key, id_pgsql >:: + get_null (const image_type& i) + { + bool r (true); + r = r && i.outer_null; + r = r && i.inner_null; + return r; + } + + inline + void access::composite_value_traits< ::brep::package_build_bot_key_key, id_pgsql >:: + set_null (image_type& i, + pgsql::statement_kind sk) + { + ODB_POTENTIALLY_UNUSED (sk); + + using namespace pgsql; + + i.outer_null = true; + i.inner_null = true; + } + + // _license_key + // + + inline + bool access::composite_value_traits< ::brep::package::_license_key, id_pgsql >:: + get_null (const image_type& i) + { + bool r (true); + r = r && i.outer_null; + r = r && i.inner_null; + return r; + } + + inline + void access::composite_value_traits< ::brep::package::_license_key, id_pgsql >:: + set_null (image_type& i, + pgsql::statement_kind sk) + { + ODB_POTENTIALLY_UNUSED (sk); + + using namespace pgsql; + + i.outer_null = true; + i.inner_null = true; + } + + // _dependency_alternative_key + // + + inline + bool access::composite_value_traits< ::brep::package::_dependency_alternative_key, id_pgsql >:: + get_null (const image_type& i) + { + bool r (true); + r = r && i.outer_null; + r = r && i.inner_null; + return r; + } + + inline + void access::composite_value_traits< ::brep::package::_dependency_alternative_key, id_pgsql >:: + set_null (image_type& i, + pgsql::statement_kind sk) + { + ODB_POTENTIALLY_UNUSED (sk); + + using namespace pgsql; + + i.outer_null = true; + i.inner_null = true; + } + + // _dependency_key + // + + inline + bool access::composite_value_traits< ::brep::package::_dependency_key, id_pgsql >:: + get_null (const image_type& i) + { + bool r (true); + r = r && i.outer_null; + r = r && i.middle_null; + r = r && i.inner_null; + return r; + } + + inline + void access::composite_value_traits< ::brep::package::_dependency_key, id_pgsql >:: + set_null (image_type& i, + pgsql::statement_kind sk) + { + ODB_POTENTIALLY_UNUSED (sk); + + using namespace pgsql; + + i.outer_null = true; + i.middle_null = true; + i.inner_null = true; + } + + // package + // + + inline + void access::object_traits_impl< ::brep::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); + } + + // latest_package_search_rank + // + + // latest_package_count + // + + // package_search_rank + // + + // package_count + // + + // latest_package + // +} + diff --git a/libbrep/package.sql b/libbrep/package.sql new file mode 100644 index 0000000..e39586e --- /dev/null +++ b/libbrep/package.sql @@ -0,0 +1,1245 @@ +/* This file was generated by ODB, object-relational mapping (ORM) + * compiler for C++. + */ + +DROP TABLE IF EXISTS "package_other_repositories" CASCADE; + +DROP TABLE IF EXISTS "package_build_config_bot_keys" CASCADE; + +DROP TABLE IF EXISTS "package_build_config_auxiliaries" CASCADE; + +DROP TABLE IF EXISTS "package_build_config_constraints" CASCADE; + +DROP TABLE IF EXISTS "package_build_config_builds" CASCADE; + +DROP TABLE IF EXISTS "package_build_configs" CASCADE; + +DROP TABLE IF EXISTS "package_build_bot_keys" CASCADE; + +DROP TABLE IF EXISTS "package_build_auxiliaries" CASCADE; + +DROP TABLE IF EXISTS "package_build_constraints" CASCADE; + +DROP TABLE IF EXISTS "package_builds" CASCADE; + +DROP TABLE IF EXISTS "package_tests" CASCADE; + +DROP TABLE IF EXISTS "package_requirement_alternative_requirements" CASCADE; + +DROP TABLE IF EXISTS "package_requirement_alternatives" CASCADE; + +DROP TABLE IF EXISTS "package_requirements" CASCADE; + +DROP TABLE IF EXISTS "package_dependency_alternative_dependencies" CASCADE; + +DROP TABLE IF EXISTS "package_dependency_alternatives" CASCADE; + +DROP TABLE IF EXISTS "package_dependencies" CASCADE; + +DROP TABLE IF EXISTS "package_keywords" CASCADE; + +DROP TABLE IF EXISTS "package_topics" CASCADE; + +DROP TABLE IF EXISTS "package_licenses" CASCADE; + +DROP TABLE IF EXISTS "package_license_alternatives" CASCADE; + +DROP TABLE IF EXISTS "package" CASCADE; + +DROP TABLE IF EXISTS "public_key" CASCADE; + +DROP TABLE IF EXISTS "repository_prerequisites" CASCADE; + +DROP TABLE IF EXISTS "repository_complements" CASCADE; + +DROP TABLE IF EXISTS "repository" CASCADE; + +DROP TABLE IF EXISTS "tenant" CASCADE; + +DROP TABLE IF EXISTS "schema_version"; + +CREATE TABLE "tenant" ( + "id" TEXT NOT NULL PRIMARY KEY, + "private" BOOLEAN NOT NULL, + "interactive" TEXT NULL, + "creation_timestamp" BIGINT NOT NULL, + "archived" BOOLEAN NOT NULL, + "service_id" TEXT NULL, + "service_type" TEXT NULL, + "service_data" TEXT NULL, + "loaded_timestamp" BIGINT NULL, + "queued_timestamp" BIGINT NULL, + "build_toolchain_name" TEXT NULL, + "build_toolchain_version_epoch" INTEGER NULL, + "build_toolchain_version_canonical_upstream" TEXT NULL, + "build_toolchain_version_canonical_release" TEXT NULL, + "build_toolchain_version_revision" INTEGER NULL, + "build_toolchain_version_upstream" TEXT NULL, + "build_toolchain_version_release" TEXT NULL); + +CREATE UNIQUE INDEX "tenant_service_i" + ON "tenant" ( + "service_id", + "service_type"); + +CREATE INDEX "tenant_service_id_i" + ON "tenant" ("service_id"); + +CREATE INDEX "tenant_loaded_timestamp_i" + ON "tenant" ("loaded_timestamp"); + +CREATE TABLE "repository" ( + "tenant" TEXT NOT NULL, + "canonical_name" TEXT NOT NULL, + "location_url" TEXT NOT NULL, + "location_type" TEXT NOT NULL, + "display_name" TEXT NOT NULL, + "priority" INTEGER NOT NULL, + "interface_url" TEXT NULL, + "email" TEXT NULL, + "email_comment" TEXT NULL, + "summary" TEXT NULL, + "description" TEXT NULL, + "cache_location_url" TEXT NOT NULL, + "cache_location_type" TEXT NOT NULL, + "certificate_fingerprint" TEXT NULL, + "certificate_name" TEXT NULL, + "certificate_organization" TEXT NULL, + "certificate_email" TEXT NULL, + "certificate_pem" TEXT NULL, + "packages_timestamp" BIGINT NOT NULL, + "repositories_timestamp" BIGINT NOT NULL, + "internal" BOOLEAN NOT NULL, + "buildable" BOOLEAN NOT NULL, + PRIMARY KEY ("tenant", + "canonical_name"), + CONSTRAINT "tenant_fk" + FOREIGN KEY ("tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED); + +CREATE TABLE "repository_complements" ( + "repository_tenant" TEXT NOT NULL, + "repository_canonical_name" TEXT NOT NULL, + "index" BIGINT NOT NULL, + "complement_tenant" TEXT NOT NULL, + "complement_canonical_name" TEXT NOT NULL, + CONSTRAINT "repository_tenant_fk" + FOREIGN KEY ("repository_tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + CONSTRAINT "repository_fk" + FOREIGN KEY ("repository_tenant", + "repository_canonical_name") + REFERENCES "repository" ("tenant", + "canonical_name") + ON DELETE CASCADE, + CONSTRAINT "complement_tenant_fk" + FOREIGN KEY ("complement_tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + CONSTRAINT "complement_fk" + FOREIGN KEY ("complement_tenant", + "complement_canonical_name") + REFERENCES "repository" ("tenant", + "canonical_name") + INITIALLY DEFERRED); + +CREATE INDEX "repository_complements_repository_i" + ON "repository_complements" ( + "repository_tenant", + "repository_canonical_name"); + +CREATE INDEX "repository_complements_index_i" + ON "repository_complements" ("index"); + +CREATE TABLE "repository_prerequisites" ( + "repository_tenant" TEXT NOT NULL, + "repository_canonical_name" TEXT NOT NULL, + "index" BIGINT NOT NULL, + "prerequisite_tenant" TEXT NOT NULL, + "prerequisite_canonical_name" TEXT NOT NULL, + CONSTRAINT "repository_tenant_fk" + FOREIGN KEY ("repository_tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + CONSTRAINT "repository_fk" + FOREIGN KEY ("repository_tenant", + "repository_canonical_name") + REFERENCES "repository" ("tenant", + "canonical_name") + ON DELETE CASCADE, + CONSTRAINT "prerequisite_tenant_fk" + FOREIGN KEY ("prerequisite_tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + CONSTRAINT "prerequisite_fk" + FOREIGN KEY ("prerequisite_tenant", + "prerequisite_canonical_name") + REFERENCES "repository" ("tenant", + "canonical_name") + INITIALLY DEFERRED); + +CREATE INDEX "repository_prerequisites_repository_i" + ON "repository_prerequisites" ( + "repository_tenant", + "repository_canonical_name"); + +CREATE INDEX "repository_prerequisites_index_i" + ON "repository_prerequisites" ("index"); + +CREATE TABLE "public_key" ( + "tenant" TEXT NOT NULL, + "fingerprint" TEXT NOT NULL, + "data" TEXT NOT NULL, + PRIMARY KEY ("tenant", + "fingerprint"), + CONSTRAINT "tenant_fk" + FOREIGN KEY ("tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED); + +CREATE TABLE "package" ( + "tenant" TEXT NOT NULL, + "name" CITEXT NOT NULL, + "version_epoch" INTEGER NOT NULL, + "version_canonical_upstream" TEXT NOT NULL, + "version_canonical_release" TEXT NOT NULL COLLATE "C", + "version_revision" INTEGER NOT NULL, + "version_upstream" TEXT NOT NULL, + "version_release" TEXT NULL, + "upstream_version" TEXT NULL, + "project" CITEXT NOT NULL, + "priority" INTEGER NOT NULL, + "priority_comment" TEXT NOT NULL, + "summary" TEXT NOT NULL, + "description" TEXT NULL, + "description_type" TEXT NULL, + "package_description" TEXT NULL, + "package_description_type" TEXT NULL, + "changes" TEXT NULL, + "changes_type" TEXT NULL, + "url" TEXT NULL, + "url_comment" TEXT NULL, + "doc_url" TEXT NULL, + "doc_url_comment" TEXT NULL, + "src_url" TEXT NULL, + "src_url_comment" TEXT NULL, + "package_url" TEXT NULL, + "package_url_comment" TEXT NULL, + "email" TEXT NULL, + "email_comment" TEXT NULL, + "package_email" TEXT NULL, + "package_email_comment" TEXT NULL, + "build_email" TEXT NULL, + "build_email_comment" TEXT NULL, + "build_warning_email" TEXT NULL, + "build_warning_email_comment" TEXT NULL, + "build_error_email" TEXT NULL, + "build_error_email_comment" TEXT NULL, + "internal_repository_tenant" TEXT NULL, + "internal_repository_canonical_name" TEXT NULL, + "location" TEXT NULL, + "fragment" TEXT NULL, + "sha256sum" TEXT NULL, + "buildable" BOOLEAN NOT NULL, + "unbuildable_reason" TEXT NULL, + "custom_bot" BOOLEAN NULL, + "search_index" tsvector NULL, + PRIMARY KEY ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision"), + CONSTRAINT "tenant_fk" + FOREIGN KEY ("tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + CONSTRAINT "internal_repository_tenant_fk" + FOREIGN KEY ("internal_repository_tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + CONSTRAINT "internal_repository_fk" + FOREIGN KEY ("internal_repository_tenant", + "internal_repository_canonical_name") + REFERENCES "repository" ("tenant", + "canonical_name") + INITIALLY DEFERRED); + +CREATE INDEX "package_search_index_i" + ON "package" USING GIN ("search_index"); + +CREATE TABLE "package_license_alternatives" ( + "tenant" TEXT NOT NULL, + "name" CITEXT NOT NULL, + "version_epoch" INTEGER NOT NULL, + "version_canonical_upstream" TEXT NOT NULL, + "version_canonical_release" TEXT NOT NULL COLLATE "C", + "version_revision" INTEGER NOT NULL, + "index" BIGINT NOT NULL, + "comment" TEXT NOT NULL, + CONSTRAINT "tenant_fk" + FOREIGN KEY ("tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + CONSTRAINT "object_id_fk" + FOREIGN KEY ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + REFERENCES "package" ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + ON DELETE CASCADE); + +CREATE INDEX "package_license_alternatives_object_id_i" + ON "package_license_alternatives" ( + "tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision"); + +CREATE INDEX "package_license_alternatives_index_i" + ON "package_license_alternatives" ("index"); + +CREATE TABLE "package_licenses" ( + "tenant" TEXT NOT NULL, + "name" CITEXT NOT NULL, + "version_epoch" INTEGER NOT NULL, + "version_canonical_upstream" TEXT NOT NULL, + "version_canonical_release" TEXT NOT NULL COLLATE "C", + "version_revision" INTEGER NOT NULL, + "alternative_index" BIGINT NOT NULL, + "index" BIGINT NOT NULL, + "license" TEXT NOT NULL, + CONSTRAINT "tenant_fk" + FOREIGN KEY ("tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + CONSTRAINT "object_id_fk" + FOREIGN KEY ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + REFERENCES "package" ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + ON DELETE CASCADE); + +CREATE INDEX "package_licenses_object_id_i" + ON "package_licenses" ( + "tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision"); + +CREATE TABLE "package_topics" ( + "tenant" TEXT NOT NULL, + "name" CITEXT NOT NULL, + "version_epoch" INTEGER NOT NULL, + "version_canonical_upstream" TEXT NOT NULL, + "version_canonical_release" TEXT NOT NULL COLLATE "C", + "version_revision" INTEGER NOT NULL, + "index" BIGINT NOT NULL, + "topic" TEXT NOT NULL, + CONSTRAINT "tenant_fk" + FOREIGN KEY ("tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + CONSTRAINT "object_id_fk" + FOREIGN KEY ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + REFERENCES "package" ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + ON DELETE CASCADE); + +CREATE INDEX "package_topics_object_id_i" + ON "package_topics" ( + "tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision"); + +CREATE INDEX "package_topics_index_i" + ON "package_topics" ("index"); + +CREATE TABLE "package_keywords" ( + "tenant" TEXT NOT NULL, + "name" CITEXT NOT NULL, + "version_epoch" INTEGER NOT NULL, + "version_canonical_upstream" TEXT NOT NULL, + "version_canonical_release" TEXT NOT NULL COLLATE "C", + "version_revision" INTEGER NOT NULL, + "index" BIGINT NOT NULL, + "keyword" TEXT NOT NULL, + CONSTRAINT "tenant_fk" + FOREIGN KEY ("tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + CONSTRAINT "object_id_fk" + FOREIGN KEY ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + REFERENCES "package" ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + ON DELETE CASCADE); + +CREATE INDEX "package_keywords_object_id_i" + ON "package_keywords" ( + "tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision"); + +CREATE INDEX "package_keywords_index_i" + ON "package_keywords" ("index"); + +CREATE TABLE "package_dependencies" ( + "tenant" TEXT NOT NULL, + "name" CITEXT NOT NULL, + "version_epoch" INTEGER NOT NULL, + "version_canonical_upstream" TEXT NOT NULL, + "version_canonical_release" TEXT NOT NULL COLLATE "C", + "version_revision" INTEGER NOT NULL, + "index" BIGINT NOT NULL, + "buildtime" BOOLEAN NOT NULL, + "comment" TEXT NOT NULL, + CONSTRAINT "tenant_fk" + FOREIGN KEY ("tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + CONSTRAINT "object_id_fk" + FOREIGN KEY ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + REFERENCES "package" ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + ON DELETE CASCADE); + +CREATE INDEX "package_dependencies_object_id_i" + ON "package_dependencies" ( + "tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision"); + +CREATE INDEX "package_dependencies_index_i" + ON "package_dependencies" ("index"); + +CREATE TABLE "package_dependency_alternatives" ( + "tenant" TEXT NOT NULL, + "name" CITEXT NOT NULL, + "version_epoch" INTEGER NOT NULL, + "version_canonical_upstream" TEXT NOT NULL, + "version_canonical_release" TEXT NOT NULL COLLATE "C", + "version_revision" INTEGER NOT NULL, + "dependency_index" BIGINT NOT NULL, + "index" BIGINT NOT NULL, + "enable" TEXT NULL, + "reflect" TEXT NULL, + "prefer" TEXT NULL, + "accept" TEXT NULL, + "require" TEXT NULL, + CONSTRAINT "tenant_fk" + FOREIGN KEY ("tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + CONSTRAINT "object_id_fk" + FOREIGN KEY ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + REFERENCES "package" ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + ON DELETE CASCADE); + +CREATE INDEX "package_dependency_alternatives_object_id_i" + ON "package_dependency_alternatives" ( + "tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision"); + +CREATE TABLE "package_dependency_alternative_dependencies" ( + "tenant" TEXT NOT NULL, + "name" CITEXT NOT NULL, + "version_epoch" INTEGER NOT NULL, + "version_canonical_upstream" TEXT NOT NULL, + "version_canonical_release" TEXT NOT NULL COLLATE "C", + "version_revision" INTEGER NOT NULL, + "dependency_index" BIGINT NOT NULL, + "alternative_index" BIGINT NOT NULL, + "index" BIGINT NOT NULL, + "dep_name" CITEXT NOT NULL, + "dep_min_version_epoch" INTEGER NULL, + "dep_min_version_canonical_upstream" TEXT NULL, + "dep_min_version_canonical_release" TEXT NULL, + "dep_min_version_revision" INTEGER NULL, + "dep_min_version_upstream" TEXT NULL, + "dep_min_version_release" TEXT NULL, + "dep_max_version_epoch" INTEGER NULL, + "dep_max_version_canonical_upstream" TEXT NULL, + "dep_max_version_canonical_release" TEXT NULL, + "dep_max_version_revision" INTEGER NULL, + "dep_max_version_upstream" TEXT NULL, + "dep_max_version_release" TEXT NULL, + "dep_min_open" BOOLEAN NULL, + "dep_max_open" BOOLEAN NULL, + "dep_package_tenant" TEXT NULL, + "dep_package_name" CITEXT NULL, + "dep_package_version_epoch" INTEGER NULL, + "dep_package_version_canonical_upstream" TEXT NULL, + "dep_package_version_canonical_release" TEXT NULL COLLATE "C", + "dep_package_version_revision" INTEGER NULL, + CONSTRAINT "tenant_fk" + FOREIGN KEY ("tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + CONSTRAINT "object_id_fk" + FOREIGN KEY ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + REFERENCES "package" ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + ON DELETE CASCADE, + CONSTRAINT "dep_package_tenant_fk" + FOREIGN KEY ("dep_package_tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + CONSTRAINT "dep_package_fk" + FOREIGN KEY ("dep_package_tenant", + "dep_package_name", + "dep_package_version_epoch", + "dep_package_version_canonical_upstream", + "dep_package_version_canonical_release", + "dep_package_version_revision") + REFERENCES "package" ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + INITIALLY DEFERRED); + +CREATE INDEX "package_dependency_alternative_dependencies_object_id_i" + ON "package_dependency_alternative_dependencies" ( + "tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision"); + +CREATE TABLE "package_requirements" ( + "tenant" TEXT NOT NULL, + "name" CITEXT NOT NULL, + "version_epoch" INTEGER NOT NULL, + "version_canonical_upstream" TEXT NOT NULL, + "version_canonical_release" TEXT NOT NULL COLLATE "C", + "version_revision" INTEGER NOT NULL, + "index" BIGINT NOT NULL, + "buildtime" BOOLEAN NOT NULL, + "comment" TEXT NOT NULL, + CONSTRAINT "tenant_fk" + FOREIGN KEY ("tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + CONSTRAINT "object_id_fk" + FOREIGN KEY ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + REFERENCES "package" ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + ON DELETE CASCADE); + +CREATE INDEX "package_requirements_object_id_i" + ON "package_requirements" ( + "tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision"); + +CREATE INDEX "package_requirements_index_i" + ON "package_requirements" ("index"); + +CREATE TABLE "package_requirement_alternatives" ( + "tenant" TEXT NOT NULL, + "name" CITEXT NOT NULL, + "version_epoch" INTEGER NOT NULL, + "version_canonical_upstream" TEXT NOT NULL, + "version_canonical_release" TEXT NOT NULL COLLATE "C", + "version_revision" INTEGER NOT NULL, + "requirement_index" BIGINT NOT NULL, + "index" BIGINT NOT NULL, + "enable" TEXT NULL, + "reflect" TEXT NULL, + CONSTRAINT "tenant_fk" + FOREIGN KEY ("tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + CONSTRAINT "object_id_fk" + FOREIGN KEY ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + REFERENCES "package" ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + ON DELETE CASCADE); + +CREATE INDEX "package_requirement_alternatives_object_id_i" + ON "package_requirement_alternatives" ( + "tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision"); + +CREATE TABLE "package_requirement_alternative_requirements" ( + "tenant" TEXT NOT NULL, + "name" CITEXT NOT NULL, + "version_epoch" INTEGER NOT NULL, + "version_canonical_upstream" TEXT NOT NULL, + "version_canonical_release" TEXT NOT NULL COLLATE "C", + "version_revision" INTEGER NOT NULL, + "requirement_index" BIGINT NOT NULL, + "alternative_index" BIGINT NOT NULL, + "index" BIGINT NOT NULL, + "id" TEXT NOT NULL, + CONSTRAINT "tenant_fk" + FOREIGN KEY ("tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + CONSTRAINT "object_id_fk" + FOREIGN KEY ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + REFERENCES "package" ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + ON DELETE CASCADE); + +CREATE INDEX "package_requirement_alternative_requirements_object_id_i" + ON "package_requirement_alternative_requirements" ( + "tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision"); + +CREATE TABLE "package_tests" ( + "tenant" TEXT NOT NULL, + "name" CITEXT NOT NULL, + "version_epoch" INTEGER NOT NULL, + "version_canonical_upstream" TEXT NOT NULL, + "version_canonical_release" TEXT NOT NULL COLLATE "C", + "version_revision" INTEGER NOT NULL, + "index" BIGINT NOT NULL, + "test_name" CITEXT NOT NULL, + "test_min_version_epoch" INTEGER NULL, + "test_min_version_canonical_upstream" TEXT NULL, + "test_min_version_canonical_release" TEXT NULL, + "test_min_version_revision" INTEGER NULL, + "test_min_version_upstream" TEXT NULL, + "test_min_version_release" TEXT NULL, + "test_max_version_epoch" INTEGER NULL, + "test_max_version_canonical_upstream" TEXT NULL, + "test_max_version_canonical_release" TEXT NULL, + "test_max_version_revision" INTEGER NULL, + "test_max_version_upstream" TEXT NULL, + "test_max_version_release" TEXT NULL, + "test_min_open" BOOLEAN NULL, + "test_max_open" BOOLEAN NULL, + "test_package_tenant" TEXT NULL, + "test_package_name" CITEXT NULL, + "test_package_version_epoch" INTEGER NULL, + "test_package_version_canonical_upstream" TEXT NULL, + "test_package_version_canonical_release" TEXT NULL COLLATE "C", + "test_package_version_revision" INTEGER NULL, + "test_type" TEXT NOT NULL, + "test_buildtime" BOOLEAN NOT NULL, + "test_enable" TEXT NULL, + "test_reflect" TEXT NULL, + CONSTRAINT "tenant_fk" + FOREIGN KEY ("tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + CONSTRAINT "object_id_fk" + FOREIGN KEY ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + REFERENCES "package" ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + ON DELETE CASCADE, + CONSTRAINT "test_package_tenant_fk" + FOREIGN KEY ("test_package_tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + CONSTRAINT "test_package_fk" + FOREIGN KEY ("test_package_tenant", + "test_package_name", + "test_package_version_epoch", + "test_package_version_canonical_upstream", + "test_package_version_canonical_release", + "test_package_version_revision") + REFERENCES "package" ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + INITIALLY DEFERRED); + +CREATE INDEX "package_tests_object_id_i" + ON "package_tests" ( + "tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision"); + +CREATE INDEX "package_tests_index_i" + ON "package_tests" ("index"); + +CREATE TABLE "package_builds" ( + "tenant" TEXT NOT NULL, + "name" CITEXT NOT NULL, + "version_epoch" INTEGER NOT NULL, + "version_canonical_upstream" TEXT NOT NULL, + "version_canonical_release" TEXT NOT NULL COLLATE "C", + "version_revision" INTEGER NOT NULL, + "index" BIGINT NOT NULL, + "expression" TEXT NOT NULL, + "comment" TEXT NOT NULL, + CONSTRAINT "tenant_fk" + FOREIGN KEY ("tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + CONSTRAINT "object_id_fk" + FOREIGN KEY ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + REFERENCES "package" ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + ON DELETE CASCADE); + +CREATE INDEX "package_builds_object_id_i" + ON "package_builds" ( + "tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision"); + +CREATE INDEX "package_builds_index_i" + ON "package_builds" ("index"); + +CREATE TABLE "package_build_constraints" ( + "tenant" TEXT NOT NULL, + "name" CITEXT NOT NULL, + "version_epoch" INTEGER NOT NULL, + "version_canonical_upstream" TEXT NOT NULL, + "version_canonical_release" TEXT NOT NULL COLLATE "C", + "version_revision" INTEGER NOT NULL, + "index" BIGINT NOT NULL, + "exclusion" BOOLEAN NOT NULL, + "config" TEXT NOT NULL, + "target" TEXT NULL, + "comment" TEXT NOT NULL, + CONSTRAINT "tenant_fk" + FOREIGN KEY ("tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + CONSTRAINT "object_id_fk" + FOREIGN KEY ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + REFERENCES "package" ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + ON DELETE CASCADE); + +CREATE INDEX "package_build_constraints_object_id_i" + ON "package_build_constraints" ( + "tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision"); + +CREATE INDEX "package_build_constraints_index_i" + ON "package_build_constraints" ("index"); + +CREATE TABLE "package_build_auxiliaries" ( + "tenant" TEXT NOT NULL, + "name" CITEXT NOT NULL, + "version_epoch" INTEGER NOT NULL, + "version_canonical_upstream" TEXT NOT NULL, + "version_canonical_release" TEXT NOT NULL COLLATE "C", + "version_revision" INTEGER NOT NULL, + "index" BIGINT NOT NULL, + "environment_name" TEXT NOT NULL, + "config" TEXT NOT NULL, + "comment" TEXT NOT NULL, + CONSTRAINT "tenant_fk" + FOREIGN KEY ("tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + CONSTRAINT "object_id_fk" + FOREIGN KEY ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + REFERENCES "package" ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + ON DELETE CASCADE); + +CREATE INDEX "package_build_auxiliaries_object_id_i" + ON "package_build_auxiliaries" ( + "tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision"); + +CREATE INDEX "package_build_auxiliaries_index_i" + ON "package_build_auxiliaries" ("index"); + +CREATE TABLE "package_build_bot_keys" ( + "tenant" TEXT NOT NULL, + "name" CITEXT NOT NULL, + "version_epoch" INTEGER NOT NULL, + "version_canonical_upstream" TEXT NOT NULL, + "version_canonical_release" TEXT NOT NULL COLLATE "C", + "version_revision" INTEGER NOT NULL, + "index" BIGINT NOT NULL, + "key_tenant" TEXT NOT NULL, + "key_fingerprint" TEXT NOT NULL, + CONSTRAINT "tenant_fk" + FOREIGN KEY ("tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + CONSTRAINT "object_id_fk" + FOREIGN KEY ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + REFERENCES "package" ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + ON DELETE CASCADE, + CONSTRAINT "key_tenant_fk" + FOREIGN KEY ("key_tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + CONSTRAINT "key_fk" + FOREIGN KEY ("key_tenant", + "key_fingerprint") + REFERENCES "public_key" ("tenant", + "fingerprint") + INITIALLY DEFERRED); + +CREATE INDEX "package_build_bot_keys_object_id_i" + ON "package_build_bot_keys" ( + "tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision"); + +CREATE INDEX "package_build_bot_keys_index_i" + ON "package_build_bot_keys" ("index"); + +CREATE TABLE "package_build_configs" ( + "tenant" TEXT NOT NULL, + "name" CITEXT NOT NULL, + "version_epoch" INTEGER NOT NULL, + "version_canonical_upstream" TEXT NOT NULL, + "version_canonical_release" TEXT NOT NULL COLLATE "C", + "version_revision" INTEGER NOT NULL, + "index" BIGINT NOT NULL, + "config_name" TEXT NOT NULL, + "config_arguments" TEXT NOT NULL, + "config_comment" TEXT NOT NULL, + "config_email" TEXT NULL, + "config_email_comment" TEXT NULL, + "config_warning_email" TEXT NULL, + "config_warning_email_comment" TEXT NULL, + "config_error_email" TEXT NULL, + "config_error_email_comment" TEXT NULL, + CONSTRAINT "tenant_fk" + FOREIGN KEY ("tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + CONSTRAINT "object_id_fk" + FOREIGN KEY ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + REFERENCES "package" ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + ON DELETE CASCADE); + +CREATE INDEX "package_build_configs_object_id_i" + ON "package_build_configs" ( + "tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision"); + +CREATE INDEX "package_build_configs_index_i" + ON "package_build_configs" ("index"); + +CREATE TABLE "package_build_config_builds" ( + "tenant" TEXT NOT NULL, + "name" CITEXT NOT NULL, + "version_epoch" INTEGER NOT NULL, + "version_canonical_upstream" TEXT NOT NULL, + "version_canonical_release" TEXT NOT NULL COLLATE "C", + "version_revision" INTEGER NOT NULL, + "config_index" BIGINT NOT NULL, + "index" BIGINT NOT NULL, + "expression" TEXT NOT NULL, + "comment" TEXT NOT NULL, + CONSTRAINT "tenant_fk" + FOREIGN KEY ("tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + CONSTRAINT "object_id_fk" + FOREIGN KEY ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + REFERENCES "package" ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + ON DELETE CASCADE); + +CREATE INDEX "package_build_config_builds_object_id_i" + ON "package_build_config_builds" ( + "tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision"); + +CREATE TABLE "package_build_config_constraints" ( + "tenant" TEXT NOT NULL, + "name" CITEXT NOT NULL, + "version_epoch" INTEGER NOT NULL, + "version_canonical_upstream" TEXT NOT NULL, + "version_canonical_release" TEXT NOT NULL COLLATE "C", + "version_revision" INTEGER NOT NULL, + "config_index" BIGINT NOT NULL, + "index" BIGINT NOT NULL, + "exclusion" BOOLEAN NOT NULL, + "config" TEXT NOT NULL, + "target" TEXT NULL, + "comment" TEXT NOT NULL, + CONSTRAINT "tenant_fk" + FOREIGN KEY ("tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + CONSTRAINT "object_id_fk" + FOREIGN KEY ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + REFERENCES "package" ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + ON DELETE CASCADE); + +CREATE INDEX "package_build_config_constraints_object_id_i" + ON "package_build_config_constraints" ( + "tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision"); + +CREATE TABLE "package_build_config_auxiliaries" ( + "tenant" TEXT NOT NULL, + "name" CITEXT NOT NULL, + "version_epoch" INTEGER NOT NULL, + "version_canonical_upstream" TEXT NOT NULL, + "version_canonical_release" TEXT NOT NULL COLLATE "C", + "version_revision" INTEGER NOT NULL, + "config_index" BIGINT NOT NULL, + "index" BIGINT NOT NULL, + "environment_name" TEXT NOT NULL, + "config" TEXT NOT NULL, + "comment" TEXT NOT NULL, + CONSTRAINT "tenant_fk" + FOREIGN KEY ("tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + CONSTRAINT "object_id_fk" + FOREIGN KEY ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + REFERENCES "package" ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + ON DELETE CASCADE); + +CREATE INDEX "package_build_config_auxiliaries_object_id_i" + ON "package_build_config_auxiliaries" ( + "tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision"); + +CREATE TABLE "package_build_config_bot_keys" ( + "tenant" TEXT NOT NULL, + "name" CITEXT NOT NULL, + "version_epoch" INTEGER NOT NULL, + "version_canonical_upstream" TEXT NOT NULL, + "version_canonical_release" TEXT NOT NULL COLLATE "C", + "version_revision" INTEGER NOT NULL, + "config_index" BIGINT NOT NULL, + "index" BIGINT NOT NULL, + "key_tenant" TEXT NOT NULL, + "key_fingerprint" TEXT NOT NULL, + CONSTRAINT "tenant_fk" + FOREIGN KEY ("tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + CONSTRAINT "object_id_fk" + FOREIGN KEY ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + REFERENCES "package" ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + ON DELETE CASCADE, + CONSTRAINT "key_tenant_fk" + FOREIGN KEY ("key_tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + CONSTRAINT "key_fk" + FOREIGN KEY ("key_tenant", + "key_fingerprint") + REFERENCES "public_key" ("tenant", + "fingerprint") + INITIALLY DEFERRED); + +CREATE INDEX "package_build_config_bot_keys_object_id_i" + ON "package_build_config_bot_keys" ( + "tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision"); + +CREATE TABLE "package_other_repositories" ( + "tenant" TEXT NOT NULL, + "name" CITEXT NOT NULL, + "version_epoch" INTEGER NOT NULL, + "version_canonical_upstream" TEXT NOT NULL, + "version_canonical_release" TEXT NOT NULL COLLATE "C", + "version_revision" INTEGER NOT NULL, + "index" BIGINT NOT NULL, + "repository_tenant" TEXT NOT NULL, + "repository_canonical_name" TEXT NOT NULL, + CONSTRAINT "tenant_fk" + FOREIGN KEY ("tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + CONSTRAINT "object_id_fk" + FOREIGN KEY ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + REFERENCES "package" ("tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision") + ON DELETE CASCADE, + CONSTRAINT "repository_tenant_fk" + FOREIGN KEY ("repository_tenant") + REFERENCES "tenant" ("id") + INITIALLY DEFERRED, + CONSTRAINT "repository_fk" + FOREIGN KEY ("repository_tenant", + "repository_canonical_name") + REFERENCES "repository" ("tenant", + "canonical_name") + INITIALLY DEFERRED); + +CREATE INDEX "package_other_repositories_object_id_i" + ON "package_other_repositories" ( + "tenant", + "name", + "version_epoch", + "version_canonical_upstream", + "version_canonical_release", + "version_revision"); + +CREATE INDEX "package_other_repositories_index_i" + ON "package_other_repositories" ("index"); + +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 ('package', 34, FALSE); + diff --git a/load/load-options.cxx b/load/load-options.cxx new file mode 100644 index 0000000..99a6f77 --- /dev/null +++ b/load/load-options.cxx @@ -0,0 +1,1216 @@ +// -*- C++ -*- +// +// This file was generated by CLI, a command line interface +// compiler for C++. +// + +// Begin prologue. +// +#include <load/types-parsers.hxx> +// +// End prologue. + +#include <load/load-options.hxx> + +#include <map> +#include <set> +#include <string> +#include <vector> +#include <utility> +#include <ostream> +#include <sstream> +#include <cstring> + +namespace cli +{ + // unknown_option + // + unknown_option:: + ~unknown_option () noexcept + { + } + + void unknown_option:: + print (::std::ostream& os) const + { + os << "unknown option '" << option ().c_str () << "'"; + } + + const char* unknown_option:: + what () const noexcept + { + return "unknown option"; + } + + // unknown_argument + // + unknown_argument:: + ~unknown_argument () noexcept + { + } + + void unknown_argument:: + print (::std::ostream& os) const + { + os << "unknown argument '" << argument ().c_str () << "'"; + } + + const char* unknown_argument:: + what () const noexcept + { + return "unknown argument"; + } + + // missing_value + // + missing_value:: + ~missing_value () noexcept + { + } + + void missing_value:: + print (::std::ostream& os) const + { + os << "missing value for option '" << option ().c_str () << "'"; + } + + const char* missing_value:: + what () const noexcept + { + return "missing option value"; + } + + // invalid_value + // + invalid_value:: + ~invalid_value () noexcept + { + } + + 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 noexcept + { + return "invalid option value"; + } + + // eos_reached + // + void eos_reached:: + print (::std::ostream& os) const + { + os << what (); + } + + const char* eos_reached:: + what () const noexcept + { + 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_; + + ++start_position_; + return r; + } + else + throw eos_reached (); + } + + void argv_scanner:: + skip () + { + if (i_ < argc_) + { + ++i_; + ++start_position_; + } + else + throw eos_reached (); + } + + std::size_t argv_scanner:: + position () + { + return start_position_; + } + + 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, bool& xs, scanner& s) + { + const char* o (s.next ()); + + if (s.more ()) + { + const char* v (s.next ()); + + if (std::strcmp (v, "1") == 0 || + std::strcmp (v, "true") == 0 || + std::strcmp (v, "TRUE") == 0 || + std::strcmp (v, "True") == 0) + x = true; + else if (std::strcmp (v, "0") == 0 || + std::strcmp (v, "false") == 0 || + std::strcmp (v, "FALSE") == 0 || + std::strcmp (v, "False") == 0) + x = false; + else + throw invalid_value (o, v); + } + else + throw missing_value (o); + + xs = 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::pair<X, std::size_t> > + { + static void + parse (std::pair<X, std::size_t>& x, bool& xs, scanner& s) + { + x.second = s.position (); + parser<X>::parse (x.first, xs, s); + } + }; + + 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::size_t pos (s.position ()); + 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, false, pos); + parser<K>::parse (k, dummy, s); + } + + if (!vstr.empty ()) + { + av[1] = const_cast<char*> (vstr.c_str ()); + argv_scanner s (0, ac, av, false, pos); + parser<V>::parse (v, dummy, s); + } + + m[k] = v; + } + else + throw missing_value (o); + + xs = true; + } + }; + + template <typename K, typename V, typename C> + struct parser<std::multimap<K, V, C> > + { + static void + parse (std::multimap<K, V, C>& m, bool& xs, scanner& s) + { + const char* o (s.next ()); + + if (s.more ()) + { + std::size_t pos (s.position ()); + 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, false, pos); + parser<K>::parse (k, dummy, s); + } + + if (!vstr.empty ()) + { + av[1] = const_cast<char*> (vstr.c_str ()); + argv_scanner s (0, ac, av, false, pos); + parser<V>::parse (v, dummy, s); + } + + m.insert (typename std::multimap<K, V, C>::value_type (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, bool X::*M> + void + thunk (X& x, scanner& s) + { + s.next (); + x.*M = true; + } + + 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> + +// options +// + +options:: +options () +: ignore_unknown_ (), + force_ (), + shallow_ (), + ignore_unresolved_tests_ (), + tenant_ (), + tenant_specified_ (false), + tenant_load_ (), + private__ (), + interactive_ (), + interactive_specified_ (false), + service_id_ (), + service_id_specified_ (false), + service_type_ (), + service_type_specified_ (false), + service_data_ (), + service_data_specified_ (false), + overrides_file_ (), + overrides_file_specified_ (false), + db_user_ (), + db_user_specified_ (false), + db_password_ (), + db_password_specified_ (false), + db_name_ ("brep_package"), + db_name_specified_ (false), + db_host_ (), + db_host_specified_ (false), + db_port_ (0), + db_port_specified_ (false), + bpkg_ ("bpkg"), + bpkg_specified_ (false), + bpkg_option_ (), + bpkg_option_specified_ (false), + openssl_ ("openssl"), + openssl_specified_ (false), + openssl_option_ (), + openssl_option_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) +: ignore_unknown_ (), + force_ (), + shallow_ (), + ignore_unresolved_tests_ (), + tenant_ (), + tenant_specified_ (false), + tenant_load_ (), + private__ (), + interactive_ (), + interactive_specified_ (false), + service_id_ (), + service_id_specified_ (false), + service_type_ (), + service_type_specified_ (false), + service_data_ (), + service_data_specified_ (false), + overrides_file_ (), + overrides_file_specified_ (false), + db_user_ (), + db_user_specified_ (false), + db_password_ (), + db_password_specified_ (false), + db_name_ ("brep_package"), + db_name_specified_ (false), + db_host_ (), + db_host_specified_ (false), + db_port_ (0), + db_port_specified_ (false), + bpkg_ ("bpkg"), + bpkg_specified_ (false), + bpkg_option_ (), + bpkg_option_specified_ (false), + openssl_ ("openssl"), + openssl_specified_ (false), + openssl_option_ (), + openssl_option_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) +: ignore_unknown_ (), + force_ (), + shallow_ (), + ignore_unresolved_tests_ (), + tenant_ (), + tenant_specified_ (false), + tenant_load_ (), + private__ (), + interactive_ (), + interactive_specified_ (false), + service_id_ (), + service_id_specified_ (false), + service_type_ (), + service_type_specified_ (false), + service_data_ (), + service_data_specified_ (false), + overrides_file_ (), + overrides_file_specified_ (false), + db_user_ (), + db_user_specified_ (false), + db_password_ (), + db_password_specified_ (false), + db_name_ ("brep_package"), + db_name_specified_ (false), + db_host_ (), + db_host_specified_ (false), + db_port_ (0), + db_port_specified_ (false), + bpkg_ ("bpkg"), + bpkg_specified_ (false), + bpkg_option_ (), + bpkg_option_specified_ (false), + openssl_ ("openssl"), + openssl_specified_ (false), + openssl_option_ (), + openssl_option_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) +: ignore_unknown_ (), + force_ (), + shallow_ (), + ignore_unresolved_tests_ (), + tenant_ (), + tenant_specified_ (false), + tenant_load_ (), + private__ (), + interactive_ (), + interactive_specified_ (false), + service_id_ (), + service_id_specified_ (false), + service_type_ (), + service_type_specified_ (false), + service_data_ (), + service_data_specified_ (false), + overrides_file_ (), + overrides_file_specified_ (false), + db_user_ (), + db_user_specified_ (false), + db_password_ (), + db_password_specified_ (false), + db_name_ ("brep_package"), + db_name_specified_ (false), + db_host_ (), + db_host_specified_ (false), + db_port_ (0), + db_port_specified_ (false), + bpkg_ ("bpkg"), + bpkg_specified_ (false), + bpkg_option_ (), + bpkg_option_specified_ (false), + openssl_ ("openssl"), + openssl_specified_ (false), + openssl_option_ (), + openssl_option_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) +: ignore_unknown_ (), + force_ (), + shallow_ (), + ignore_unresolved_tests_ (), + tenant_ (), + tenant_specified_ (false), + tenant_load_ (), + private__ (), + interactive_ (), + interactive_specified_ (false), + service_id_ (), + service_id_specified_ (false), + service_type_ (), + service_type_specified_ (false), + service_data_ (), + service_data_specified_ (false), + overrides_file_ (), + overrides_file_specified_ (false), + db_user_ (), + db_user_specified_ (false), + db_password_ (), + db_password_specified_ (false), + db_name_ ("brep_package"), + db_name_specified_ (false), + db_host_ (), + db_host_specified_ (false), + db_port_ (0), + db_port_specified_ (false), + bpkg_ ("bpkg"), + bpkg_specified_ (false), + bpkg_option_ (), + bpkg_option_specified_ (false), + openssl_ ("openssl"), + openssl_specified_ (false), + openssl_option_ (), + openssl_option_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) +: ignore_unknown_ (), + force_ (), + shallow_ (), + ignore_unresolved_tests_ (), + tenant_ (), + tenant_specified_ (false), + tenant_load_ (), + private__ (), + interactive_ (), + interactive_specified_ (false), + service_id_ (), + service_id_specified_ (false), + service_type_ (), + service_type_specified_ (false), + service_data_ (), + service_data_specified_ (false), + overrides_file_ (), + overrides_file_specified_ (false), + db_user_ (), + db_user_specified_ (false), + db_password_ (), + db_password_specified_ (false), + db_name_ ("brep_package"), + db_name_specified_ (false), + db_host_ (), + db_host_specified_ (false), + db_port_ (0), + db_port_specified_ (false), + bpkg_ ("bpkg"), + bpkg_specified_ (false), + bpkg_option_ (), + bpkg_option_specified_ (false), + openssl_ ("openssl"), + openssl_specified_ (false), + openssl_option_ (), + openssl_option_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--ignore-unknown\033[0m Ignore unknown manifest entries." << ::std::endl; + + os << std::endl + << "\033[1m--force\033[0m Reload package information regardless of the" << ::std::endl + << " repository manifest file timestamps." << ::std::endl; + + os << std::endl + << "\033[1m--shallow\033[0m Don't load package information from prerequisite or" << ::std::endl + << " complement repositories, don't fail if unable to" << ::std::endl + << " resolve a package dependency, and don't detect" << ::std::endl + << " package dependency cycles." << ::std::endl; + + os << std::endl + << "\033[1m--ignore-unresolved-tests\033[0m Ignore tests, examples, and benchmarks package" << ::std::endl + << " manifest entries which cannot be resolved from the" << ::std::endl + << " main package's complement repositories, recursively." << ::std::endl + << " Note that in contrast to --shallow option, such" << ::std::endl + << " entries will be removed from the main package" << ::std::endl + << " manifests outright." << ::std::endl; + + os << std::endl + << "\033[1m--tenant\033[0m \033[4mid\033[0m Tenant the package and repository information should" << ::std::endl + << " be loaded in. If not specified, then the" << ::std::endl + << " single-tenant mode is assumed." << ::std::endl; + + os << std::endl + << "\033[1m--tenant-load\033[0m Load the repository and package information into the" << ::std::endl + << " pre-created empty tenant rather than into the newly" << ::std::endl + << " created one. Requires the \033[1m--tenant\033[0m option to be" << ::std::endl + << " specified." << ::std::endl; + + os << std::endl + << "\033[1m--private\033[0m Display the tenant packages in the web interface only" << ::std::endl + << " in the tenant view mode." << ::std::endl; + + os << std::endl + << "\033[1m--interactive\033[0m \033[4mbkp\033[0m Build the tenant packages interactively, stopping" << ::std::endl + << " builds at the specified breakpoint. Implies" << ::std::endl + << " \033[1m--private\033[0m." << ::std::endl; + + os << std::endl + << "\033[1m--service-id\033[0m \033[4mid\033[0m Third party service information to associate with the" << ::std::endl + << " being created tenant. Requires the \033[1m--tenant\033[0m and" << ::std::endl + << " \033[1m--service-type\033[0m options to be specified." << ::std::endl; + + os << std::endl + << "\033[1m--service-type\033[0m \033[4mtype\033[0m Type of the service to associate with the being" << ::std::endl + << " created tenant. Requires the \033[1m--service-id\033[0m option to" << ::std::endl + << " be specified." << ::std::endl; + + os << std::endl + << "\033[1m--service-data\033[0m \033[4mdata\033[0m Service data to associate with the being created" << ::std::endl + << " tenant. Requires the \033[1m--service-id\033[0m option to be" << ::std::endl + << " specified." << ::std::endl; + + os << std::endl + << "\033[1m--overrides-file\033[0m \033[4mfile\033[0m Read package manifest overrides from the specified" << ::std::endl + << " manifest fragment file and apply them to packages" << ::std::endl + << " being loaded." << ::std::endl; + + os << std::endl + << "\033[1m--db-user\033[0m|\033[1m-u\033[0m \033[4muser\033[0m Database user name. If not specified, then operating" << ::std::endl + << " system (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" << ::std::endl + << " without password is expected to work." << ::std::endl; + + os << std::endl + << "\033[1m--db-name\033[0m|\033[1m-n\033[0m \033[4mname\033[0m Database name. If not specified, then \033[1mbrep_package\033[0m is" << ::std::endl + << " used by default." << ::std::endl; + + os << std::endl + << "\033[1m--db-host\033[0m|\033[1m-h\033[0m \033[4mhost\033[0m Database host name, address, or socket. If not" << ::std::endl + << " specified, then connect to \033[1mlocalhost\033[0m using the" << ::std::endl + << " operating system-default mechanism (Unix-domain" << ::std::endl + << " socket, etc)." << ::std::endl; + + os << std::endl + << "\033[1m--db-port\033[0m|\033[1m-p\033[0m \033[4mport\033[0m Database port number. If not specified, the default" << ::std::endl + << " port is used." << ::std::endl; + + os << std::endl + << "\033[1m--bpkg\033[0m \033[4mpath\033[0m The package manager program to be used to fetch" << ::std::endl + << " repository information. This should be the path to" << ::std::endl + << " the \033[1mbpkg\033[0m executable. You can also specify additional" << ::std::endl + << " options that should be passed to the package manager" << ::std::endl + << " program with \033[1m--bpkg-option\033[0m. If the package manager" << ::std::endl + << " program is not explicitly specified, then \033[1mbrep-load\033[0m" << ::std::endl + << " will use \033[1mbpkg\033[0m by default." << ::std::endl; + + os << std::endl + << "\033[1m--bpkg-option\033[0m \033[4mopt\033[0m Additional option to be passed to the package manager" << ::std::endl + << " program. See \033[1m--bpkg\033[0m for more information on the" << ::std::endl + << " package manager program. Repeat this option to" << ::std::endl + << " specify multiple package manager options." << ::std::endl; + + os << std::endl + << "\033[1mopenssl\033[0m \033[4mpath\033[0m The openssl program to be used for crypto operations." << ::std::endl + << " You can also specify additional options that should" << ::std::endl + << " be passed to the openssl program with \033[1mopenssl-option\033[0m." << ::std::endl + << " If the openssl program is not explicitly specified," << ::std::endl + << " then \033[1mbrep-load\033[0m will use \033[1mopenssl\033[0m by default." << ::std::endl; + + os << std::endl + << "\033[1mopenssl-option\033[0m \033[4mopt\033[0m Additional option to be passed to the openssl program" << ::std::endl + << " (see \033[1mopenssl\033[0m for details). Repeat this option to" << ::std::endl + << " specify multiple openssl options." << ::std::endl; + + os << std::endl + << "\033[1m--pager\033[0m \033[4mpath\033[0m The pager program to be used to show long text." << ::std::endl + << " Commonly used pager programs are \033[1mless\033[0m and \033[1mmore\033[0m. You" << ::std::endl + << " can also specify additional options that should be" << ::std::endl + << " passed to the pager program with \033[1m--pager-option\033[0m. If" << ::std::endl + << " an empty string is specified as the pager program," << ::std::endl + << " then no pager will be used. If the pager program is" << ::std::endl + << " not explicitly specified, then \033[1mbrep-load\033[0m will try to" << ::std::endl + << " use \033[1mless\033[0m. If it is not available, then no pager will" << ::std::endl + << " 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." << ::std::endl + << " See \033[1m--pager\033[0m for more information on the pager" << ::std::endl + << " program. Repeat this option to specify multiple pager" << ::std::endl + << " 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_["--ignore-unknown"] = + &::cli::thunk< options, &options::ignore_unknown_ >; + _cli_options_map_["--force"] = + &::cli::thunk< options, &options::force_ >; + _cli_options_map_["--shallow"] = + &::cli::thunk< options, &options::shallow_ >; + _cli_options_map_["--ignore-unresolved-tests"] = + &::cli::thunk< options, &options::ignore_unresolved_tests_ >; + _cli_options_map_["--tenant"] = + &::cli::thunk< options, std::string, &options::tenant_, + &options::tenant_specified_ >; + _cli_options_map_["--tenant-load"] = + &::cli::thunk< options, &options::tenant_load_ >; + _cli_options_map_["--private"] = + &::cli::thunk< options, &options::private__ >; + _cli_options_map_["--interactive"] = + &::cli::thunk< options, std::string, &options::interactive_, + &options::interactive_specified_ >; + _cli_options_map_["--service-id"] = + &::cli::thunk< options, std::string, &options::service_id_, + &options::service_id_specified_ >; + _cli_options_map_["--service-type"] = + &::cli::thunk< options, std::string, &options::service_type_, + &options::service_type_specified_ >; + _cli_options_map_["--service-data"] = + &::cli::thunk< options, std::string, &options::service_data_, + &options::service_data_specified_ >; + _cli_options_map_["--overrides-file"] = + &::cli::thunk< options, brep::path, &options::overrides_file_, + &options::overrides_file_specified_ >; + _cli_options_map_["--db-user"] = + &::cli::thunk< options, std::string, &options::db_user_, + &options::db_user_specified_ >; + _cli_options_map_["-u"] = + &::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_["-n"] = + &::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_["-h"] = + &::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_["-p"] = + &::cli::thunk< options, std::uint16_t, &options::db_port_, + &options::db_port_specified_ >; + _cli_options_map_["--bpkg"] = + &::cli::thunk< options, brep::path, &options::bpkg_, + &options::bpkg_specified_ >; + _cli_options_map_["--bpkg-option"] = + &::cli::thunk< options, brep::strings, &options::bpkg_option_, + &options::bpkg_option_specified_ >; + _cli_options_map_["openssl"] = + &::cli::thunk< options, brep::path, &options::openssl_, + &options::openssl_specified_ >; + _cli_options_map_["openssl-option"] = + &::cli::thunk< options, brep::strings, &options::openssl_option_, + &options::openssl_option_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, &options::help_ >; + _cli_options_map_["--version"] = + &::cli::thunk< options, &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-load --help\033[0m" << ::std::endl + << "\033[1mbrep-load --version\033[0m" << ::std::endl + << "\033[1mbrep-load\033[0m [\033[4moptions\033[0m] \033[4mloadtab\033[0m\033[0m" << ::std::endl + << ::std::endl + << "\033[1mDESCRIPTION\033[0m" << ::std::endl + << ::std::endl + << "\033[1mbrep-load\033[0m reads the list of repositories from the specified \033[4mloadtab\033[0m" << ::std::endl + << "configuration file, fetches their manifest files, and loads the repository and" << ::std::endl + << "package information into the \033[1mpackage\033[0m database, suitable for consumption by the" << ::std::endl + << "\033[1mbrep\033[0m web module." << ::std::endl + << ::std::endl + << "Note that \033[1mbrep-load\033[0m expects the \033[1mpackage\033[0m database schema to have already been" << ::std::endl + << "created using \033[1mbrep-migrate(1)\033[0m." << ::std::endl + << ::std::endl + << "Also note that \033[1mbrep-load\033[0m requires \033[1mbpkg(1)\033[0m to fetch repository information. See" << ::std::endl + << "\033[1m--bpkg\033[0m for more information on the package manager program." << ::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-load\033[0m or some other \033[1mbrep\033[0m utility is already running. Try" << ::std::endl + << " 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/load/load-options.hxx b/load/load-options.hxx new file mode 100644 index 0000000..7b8426d --- /dev/null +++ b/load/load-options.hxx @@ -0,0 +1,719 @@ +// -*- C++ -*- +// +// This file was generated by CLI, a command line interface +// compiler for C++. +// + +#ifndef LOAD_LOAD_OPTIONS_HXX +#define LOAD_LOAD_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 () noexcept; + + unknown_option (const std::string& option); + + const std::string& + option () const; + + virtual void + print (::std::ostream&) const; + + virtual const char* + what () const noexcept; + + private: + std::string option_; + }; + + class unknown_argument: public exception + { + public: + virtual + ~unknown_argument () noexcept; + + unknown_argument (const std::string& argument); + + const std::string& + argument () const; + + virtual void + print (::std::ostream&) const; + + virtual const char* + what () const noexcept; + + private: + std::string argument_; + }; + + class missing_value: public exception + { + public: + virtual + ~missing_value () noexcept; + + missing_value (const std::string& option); + + const std::string& + option () const; + + virtual void + print (::std::ostream&) const; + + virtual const char* + what () const noexcept; + + private: + std::string option_; + }; + + class invalid_value: public exception + { + public: + virtual + ~invalid_value () noexcept; + + 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 noexcept; + + 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 noexcept; + }; + + // 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(). + // + // The position() function returns a monotonically-increasing + // number which, if stored, can later be used to determine the + // relative position of the argument returned by the following + // call to next(). Note that if multiple scanners are used to + // extract arguments from multiple sources, then the end + // position of the previous scanner should be used as the + // start position of the next. + // + class scanner + { + public: + virtual + ~scanner (); + + virtual bool + more () = 0; + + virtual const char* + peek () = 0; + + virtual const char* + next () = 0; + + virtual void + skip () = 0; + + virtual std::size_t + position () = 0; + }; + + class argv_scanner: public scanner + { + public: + argv_scanner (int& argc, + char** argv, + bool erase = false, + std::size_t start_position = 0); + + argv_scanner (int start, + int& argc, + char** argv, + bool erase = false, + std::size_t start_position = 0); + + int + end () const; + + virtual bool + more (); + + virtual const char* + peek (); + + virtual const char* + next (); + + virtual void + skip (); + + virtual std::size_t + position (); + + protected: + std::size_t start_position_; + int i_; + int& argc_; + char** argv_; + bool erase_; + }; + + template <typename X> + struct parser; +} + +#include <vector> + +#include <string> + +#include <cstdint> + +#include <libbrep/types.hxx> + +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 and modifiers. + // + const bool& + ignore_unknown () const; + + bool& + ignore_unknown (); + + void + ignore_unknown (const bool&); + + const bool& + force () const; + + bool& + force (); + + void + force (const bool&); + + const bool& + shallow () const; + + bool& + shallow (); + + void + shallow (const bool&); + + const bool& + ignore_unresolved_tests () const; + + bool& + ignore_unresolved_tests (); + + void + ignore_unresolved_tests (const bool&); + + const std::string& + tenant () const; + + std::string& + tenant (); + + void + tenant (const std::string&); + + bool + tenant_specified () const; + + void + tenant_specified (bool); + + const bool& + tenant_load () const; + + bool& + tenant_load (); + + void + tenant_load (const bool&); + + const bool& + private_ () const; + + bool& + private_ (); + + void + private_ (const bool&); + + const std::string& + interactive () const; + + std::string& + interactive (); + + void + interactive (const std::string&); + + bool + interactive_specified () const; + + void + interactive_specified (bool); + + const std::string& + service_id () const; + + std::string& + service_id (); + + void + service_id (const std::string&); + + bool + service_id_specified () const; + + void + service_id_specified (bool); + + const std::string& + service_type () const; + + std::string& + service_type (); + + void + service_type (const std::string&); + + bool + service_type_specified () const; + + void + service_type_specified (bool); + + const std::string& + service_data () const; + + std::string& + service_data (); + + void + service_data (const std::string&); + + bool + service_data_specified () const; + + void + service_data_specified (bool); + + const brep::path& + overrides_file () const; + + brep::path& + overrides_file (); + + void + overrides_file (const brep::path&); + + bool + overrides_file_specified () const; + + void + overrides_file_specified (bool); + + const std::string& + db_user () const; + + std::string& + db_user (); + + void + db_user (const std::string&); + + bool + db_user_specified () const; + + void + db_user_specified (bool); + + const std::string& + db_password () const; + + std::string& + db_password (); + + void + db_password (const std::string&); + + bool + db_password_specified () const; + + void + db_password_specified (bool); + + const std::string& + db_name () const; + + std::string& + db_name (); + + void + db_name (const std::string&); + + bool + db_name_specified () const; + + void + db_name_specified (bool); + + const std::string& + db_host () const; + + std::string& + db_host (); + + void + db_host (const std::string&); + + bool + db_host_specified () const; + + void + db_host_specified (bool); + + const std::uint16_t& + db_port () const; + + std::uint16_t& + db_port (); + + void + db_port (const std::uint16_t&); + + bool + db_port_specified () const; + + void + db_port_specified (bool); + + const brep::path& + bpkg () const; + + brep::path& + bpkg (); + + void + bpkg (const brep::path&); + + bool + bpkg_specified () const; + + void + bpkg_specified (bool); + + const brep::strings& + bpkg_option () const; + + brep::strings& + bpkg_option (); + + void + bpkg_option (const brep::strings&); + + bool + bpkg_option_specified () const; + + void + bpkg_option_specified (bool); + + const brep::path& + openssl () const; + + brep::path& + openssl (); + + void + openssl (const brep::path&); + + bool + openssl_specified () const; + + void + openssl_specified (bool); + + const brep::strings& + openssl_option () const; + + brep::strings& + openssl_option (); + + void + openssl_option (const brep::strings&); + + bool + openssl_option_specified () const; + + void + openssl_option_specified (bool); + + const std::string& + pager () const; + + std::string& + pager (); + + void + pager (const std::string&); + + bool + pager_specified () const; + + void + pager_specified (bool); + + const std::vector<std::string>& + pager_option () const; + + std::vector<std::string>& + pager_option (); + + void + pager_option (const std::vector<std::string>&); + + bool + pager_option_specified () const; + + void + pager_option_specified (bool); + + const bool& + help () const; + + bool& + help (); + + void + help (const bool&); + + const bool& + version () const; + + bool& + version (); + + void + version (const bool&); + + // 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 ignore_unknown_; + bool force_; + bool shallow_; + bool ignore_unresolved_tests_; + std::string tenant_; + bool tenant_specified_; + bool tenant_load_; + bool private__; + std::string interactive_; + bool interactive_specified_; + std::string service_id_; + bool service_id_specified_; + std::string service_type_; + bool service_type_specified_; + std::string service_data_; + bool service_data_specified_; + brep::path overrides_file_; + bool overrides_file_specified_; + 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_; + brep::path bpkg_; + bool bpkg_specified_; + brep::strings bpkg_option_; + bool bpkg_option_specified_; + brep::path openssl_; + bool openssl_specified_; + brep::strings openssl_option_; + bool openssl_option_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 <load/load-options.ixx> + +// Begin epilogue. +// +// +// End epilogue. + +#endif // LOAD_LOAD_OPTIONS_HXX diff --git a/load/load-options.ixx b/load/load-options.ixx new file mode 100644 index 0000000..256573d --- /dev/null +++ b/load/load-options.ixx @@ -0,0 +1,809 @@ +// -*- 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, + std::size_t sp) + : start_position_ (sp + 1), + i_ (1), + argc_ (argc), + argv_ (argv), + erase_ (erase) + { + } + + inline argv_scanner:: + argv_scanner (int start, + int& argc, + char** argv, + bool erase, + std::size_t sp) + : start_position_ (sp + static_cast<std::size_t> (start)), + i_ (start), + argc_ (argc), + argv_ (argv), + erase_ (erase) + { + } + + inline int argv_scanner:: + end () const + { + return i_; + } +} + +// options +// + +inline const bool& options:: +ignore_unknown () const +{ + return this->ignore_unknown_; +} + +inline bool& options:: +ignore_unknown () +{ + return this->ignore_unknown_; +} + +inline void options:: +ignore_unknown (const bool& x) +{ + this->ignore_unknown_ = x; +} + +inline const bool& options:: +force () const +{ + return this->force_; +} + +inline bool& options:: +force () +{ + return this->force_; +} + +inline void options:: +force (const bool& x) +{ + this->force_ = x; +} + +inline const bool& options:: +shallow () const +{ + return this->shallow_; +} + +inline bool& options:: +shallow () +{ + return this->shallow_; +} + +inline void options:: +shallow (const bool& x) +{ + this->shallow_ = x; +} + +inline const bool& options:: +ignore_unresolved_tests () const +{ + return this->ignore_unresolved_tests_; +} + +inline bool& options:: +ignore_unresolved_tests () +{ + return this->ignore_unresolved_tests_; +} + +inline void options:: +ignore_unresolved_tests (const bool& x) +{ + this->ignore_unresolved_tests_ = x; +} + +inline const std::string& options:: +tenant () const +{ + return this->tenant_; +} + +inline std::string& options:: +tenant () +{ + return this->tenant_; +} + +inline void options:: +tenant (const std::string& x) +{ + this->tenant_ = x; +} + +inline bool options:: +tenant_specified () const +{ + return this->tenant_specified_; +} + +inline void options:: +tenant_specified (bool x) +{ + this->tenant_specified_ = x; +} + +inline const bool& options:: +tenant_load () const +{ + return this->tenant_load_; +} + +inline bool& options:: +tenant_load () +{ + return this->tenant_load_; +} + +inline void options:: +tenant_load (const bool& x) +{ + this->tenant_load_ = x; +} + +inline const bool& options:: +private_ () const +{ + return this->private__; +} + +inline bool& options:: +private_ () +{ + return this->private__; +} + +inline void options:: +private_ (const bool& x) +{ + this->private__ = x; +} + +inline const std::string& options:: +interactive () const +{ + return this->interactive_; +} + +inline std::string& options:: +interactive () +{ + return this->interactive_; +} + +inline void options:: +interactive (const std::string& x) +{ + this->interactive_ = x; +} + +inline bool options:: +interactive_specified () const +{ + return this->interactive_specified_; +} + +inline void options:: +interactive_specified (bool x) +{ + this->interactive_specified_ = x; +} + +inline const std::string& options:: +service_id () const +{ + return this->service_id_; +} + +inline std::string& options:: +service_id () +{ + return this->service_id_; +} + +inline void options:: +service_id (const std::string& x) +{ + this->service_id_ = x; +} + +inline bool options:: +service_id_specified () const +{ + return this->service_id_specified_; +} + +inline void options:: +service_id_specified (bool x) +{ + this->service_id_specified_ = x; +} + +inline const std::string& options:: +service_type () const +{ + return this->service_type_; +} + +inline std::string& options:: +service_type () +{ + return this->service_type_; +} + +inline void options:: +service_type (const std::string& x) +{ + this->service_type_ = x; +} + +inline bool options:: +service_type_specified () const +{ + return this->service_type_specified_; +} + +inline void options:: +service_type_specified (bool x) +{ + this->service_type_specified_ = x; +} + +inline const std::string& options:: +service_data () const +{ + return this->service_data_; +} + +inline std::string& options:: +service_data () +{ + return this->service_data_; +} + +inline void options:: +service_data (const std::string& x) +{ + this->service_data_ = x; +} + +inline bool options:: +service_data_specified () const +{ + return this->service_data_specified_; +} + +inline void options:: +service_data_specified (bool x) +{ + this->service_data_specified_ = x; +} + +inline const brep::path& options:: +overrides_file () const +{ + return this->overrides_file_; +} + +inline brep::path& options:: +overrides_file () +{ + return this->overrides_file_; +} + +inline void options:: +overrides_file (const brep::path& x) +{ + this->overrides_file_ = x; +} + +inline bool options:: +overrides_file_specified () const +{ + return this->overrides_file_specified_; +} + +inline void options:: +overrides_file_specified (bool x) +{ + this->overrides_file_specified_ = x; +} + +inline const std::string& options:: +db_user () const +{ + return this->db_user_; +} + +inline std::string& options:: +db_user () +{ + return this->db_user_; +} + +inline void options:: +db_user (const std::string& x) +{ + this->db_user_ = x; +} + +inline bool options:: +db_user_specified () const +{ + return this->db_user_specified_; +} + +inline void options:: +db_user_specified (bool x) +{ + this->db_user_specified_ = x; +} + +inline const std::string& options:: +db_password () const +{ + return this->db_password_; +} + +inline std::string& options:: +db_password () +{ + return this->db_password_; +} + +inline void options:: +db_password (const std::string& x) +{ + this->db_password_ = x; +} + +inline bool options:: +db_password_specified () const +{ + return this->db_password_specified_; +} + +inline void options:: +db_password_specified (bool x) +{ + this->db_password_specified_ = x; +} + +inline const std::string& options:: +db_name () const +{ + return this->db_name_; +} + +inline std::string& options:: +db_name () +{ + return this->db_name_; +} + +inline void options:: +db_name (const std::string& x) +{ + this->db_name_ = x; +} + +inline bool options:: +db_name_specified () const +{ + return this->db_name_specified_; +} + +inline void options:: +db_name_specified (bool x) +{ + this->db_name_specified_ = x; +} + +inline const std::string& options:: +db_host () const +{ + return this->db_host_; +} + +inline std::string& options:: +db_host () +{ + return this->db_host_; +} + +inline void options:: +db_host (const std::string& x) +{ + this->db_host_ = x; +} + +inline bool options:: +db_host_specified () const +{ + return this->db_host_specified_; +} + +inline void options:: +db_host_specified (bool x) +{ + this->db_host_specified_ = x; +} + +inline const std::uint16_t& options:: +db_port () const +{ + return this->db_port_; +} + +inline std::uint16_t& options:: +db_port () +{ + return this->db_port_; +} + +inline void options:: +db_port (const std::uint16_t& x) +{ + this->db_port_ = x; +} + +inline bool options:: +db_port_specified () const +{ + return this->db_port_specified_; +} + +inline void options:: +db_port_specified (bool x) +{ + this->db_port_specified_ = x; +} + +inline const brep::path& options:: +bpkg () const +{ + return this->bpkg_; +} + +inline brep::path& options:: +bpkg () +{ + return this->bpkg_; +} + +inline void options:: +bpkg (const brep::path& x) +{ + this->bpkg_ = x; +} + +inline bool options:: +bpkg_specified () const +{ + return this->bpkg_specified_; +} + +inline void options:: +bpkg_specified (bool x) +{ + this->bpkg_specified_ = x; +} + +inline const brep::strings& options:: +bpkg_option () const +{ + return this->bpkg_option_; +} + +inline brep::strings& options:: +bpkg_option () +{ + return this->bpkg_option_; +} + +inline void options:: +bpkg_option (const brep::strings& x) +{ + this->bpkg_option_ = x; +} + +inline bool options:: +bpkg_option_specified () const +{ + return this->bpkg_option_specified_; +} + +inline void options:: +bpkg_option_specified (bool x) +{ + this->bpkg_option_specified_ = x; +} + +inline const brep::path& options:: +openssl () const +{ + return this->openssl_; +} + +inline brep::path& options:: +openssl () +{ + return this->openssl_; +} + +inline void options:: +openssl (const brep::path& x) +{ + this->openssl_ = x; +} + +inline bool options:: +openssl_specified () const +{ + return this->openssl_specified_; +} + +inline void options:: +openssl_specified (bool x) +{ + this->openssl_specified_ = x; +} + +inline const brep::strings& options:: +openssl_option () const +{ + return this->openssl_option_; +} + +inline brep::strings& options:: +openssl_option () +{ + return this->openssl_option_; +} + +inline void options:: +openssl_option (const brep::strings& x) +{ + this->openssl_option_ = x; +} + +inline bool options:: +openssl_option_specified () const +{ + return this->openssl_option_specified_; +} + +inline void options:: +openssl_option_specified (bool x) +{ + this->openssl_option_specified_ = x; +} + +inline const std::string& options:: +pager () const +{ + return this->pager_; +} + +inline std::string& options:: +pager () +{ + return this->pager_; +} + +inline void options:: +pager (const std::string& x) +{ + this->pager_ = x; +} + +inline bool options:: +pager_specified () const +{ + return this->pager_specified_; +} + +inline void options:: +pager_specified (bool x) +{ + this->pager_specified_ = x; +} + +inline const std::vector<std::string>& options:: +pager_option () const +{ + return this->pager_option_; +} + +inline std::vector<std::string>& options:: +pager_option () +{ + return this->pager_option_; +} + +inline void options:: +pager_option (const std::vector<std::string>& x) +{ + this->pager_option_ = x; +} + +inline bool options:: +pager_option_specified () const +{ + return this->pager_option_specified_; +} + +inline void options:: +pager_option_specified (bool x) +{ + this->pager_option_specified_ = x; +} + +inline const bool& options:: +help () const +{ + return this->help_; +} + +inline bool& options:: +help () +{ + return this->help_; +} + +inline void options:: +help (const bool& x) +{ + this->help_ = x; +} + +inline const bool& options:: +version () const +{ + return this->version_; +} + +inline bool& options:: +version () +{ + return this->version_; +} + +inline void options:: +version (const bool& x) +{ + this->version_ = x; +} + +// Begin epilogue. +// +// +// End epilogue. diff --git a/migrate/migrate-options.cxx b/migrate/migrate-options.cxx new file mode 100644 index 0000000..a8a4497 --- /dev/null +++ b/migrate/migrate-options.cxx @@ -0,0 +1,955 @@ +// -*- C++ -*- +// +// This file was generated by CLI, a command line interface +// compiler for C++. +// + +// Begin prologue. +// +// +// End prologue. + +#include <migrate/migrate-options.hxx> + +#include <map> +#include <set> +#include <string> +#include <vector> +#include <utility> +#include <ostream> +#include <sstream> +#include <cstring> + +namespace cli +{ + // unknown_option + // + unknown_option:: + ~unknown_option () noexcept + { + } + + void unknown_option:: + print (::std::ostream& os) const + { + os << "unknown option '" << option ().c_str () << "'"; + } + + const char* unknown_option:: + what () const noexcept + { + return "unknown option"; + } + + // unknown_argument + // + unknown_argument:: + ~unknown_argument () noexcept + { + } + + void unknown_argument:: + print (::std::ostream& os) const + { + os << "unknown argument '" << argument ().c_str () << "'"; + } + + const char* unknown_argument:: + what () const noexcept + { + return "unknown argument"; + } + + // missing_value + // + missing_value:: + ~missing_value () noexcept + { + } + + void missing_value:: + print (::std::ostream& os) const + { + os << "missing value for option '" << option ().c_str () << "'"; + } + + const char* missing_value:: + what () const noexcept + { + return "missing option value"; + } + + // invalid_value + // + invalid_value:: + ~invalid_value () noexcept + { + } + + 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 noexcept + { + return "invalid option value"; + } + + // eos_reached + // + void eos_reached:: + print (::std::ostream& os) const + { + os << what (); + } + + const char* eos_reached:: + what () const noexcept + { + 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_; + + ++start_position_; + return r; + } + else + throw eos_reached (); + } + + void argv_scanner:: + skip () + { + if (i_ < argc_) + { + ++i_; + ++start_position_; + } + else + throw eos_reached (); + } + + std::size_t argv_scanner:: + position () + { + return start_position_; + } + + 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, bool& xs, scanner& s) + { + const char* o (s.next ()); + + if (s.more ()) + { + const char* v (s.next ()); + + if (std::strcmp (v, "1") == 0 || + std::strcmp (v, "true") == 0 || + std::strcmp (v, "TRUE") == 0 || + std::strcmp (v, "True") == 0) + x = true; + else if (std::strcmp (v, "0") == 0 || + std::strcmp (v, "false") == 0 || + std::strcmp (v, "FALSE") == 0 || + std::strcmp (v, "False") == 0) + x = false; + else + throw invalid_value (o, v); + } + else + throw missing_value (o); + + xs = 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::pair<X, std::size_t> > + { + static void + parse (std::pair<X, std::size_t>& x, bool& xs, scanner& s) + { + x.second = s.position (); + parser<X>::parse (x.first, xs, s); + } + }; + + 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::size_t pos (s.position ()); + 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, false, pos); + parser<K>::parse (k, dummy, s); + } + + if (!vstr.empty ()) + { + av[1] = const_cast<char*> (vstr.c_str ()); + argv_scanner s (0, ac, av, false, pos); + parser<V>::parse (v, dummy, s); + } + + m[k] = v; + } + else + throw missing_value (o); + + xs = true; + } + }; + + template <typename K, typename V, typename C> + struct parser<std::multimap<K, V, C> > + { + static void + parse (std::multimap<K, V, C>& m, bool& xs, scanner& s) + { + const char* o (s.next ()); + + if (s.more ()) + { + std::size_t pos (s.position ()); + 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, false, pos); + parser<K>::parse (k, dummy, s); + } + + if (!vstr.empty ()) + { + av[1] = const_cast<char*> (vstr.c_str ()); + argv_scanner s (0, ac, av, false, pos); + parser<V>::parse (v, dummy, s); + } + + m.insert (typename std::multimap<K, V, C>::value_type (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, bool X::*M> + void + thunk (X& x, scanner& s) + { + s.next (); + x.*M = true; + } + + 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> + +// options +// + +options:: +options () +: recreate_ (), + drop_ (), + 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) +: recreate_ (), + drop_ (), + 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) +: recreate_ (), + drop_ (), + 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) +: recreate_ (), + drop_ (), + 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) +: recreate_ (), + drop_ (), + 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) +: recreate_ (), + drop_ (), + 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--recreate\033[0m Recreate the database schema (all the existing data will be" << ::std::endl + << " lost)." << ::std::endl; + + os << std::endl + << "\033[1m--drop\033[0m Drop the database schema (all the existing data will be" << ::std::endl + << " lost)." << ::std::endl; + + os << std::endl + << "\033[1m--db-user\033[0m|\033[1m-u\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[1m-n\033[0m \033[4mname\033[0m Database name. If not specified, then it is implicitly" << ::std::endl + << " derived by prefixing the schema name with \033[1mbrep_\033[0m." << ::std::endl; + + os << std::endl + << "\033[1m--db-host\033[0m|\033[1m-h\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[1m-p\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" << ::std::endl + << " \033[1mbrep-migrate\033[0m will try to use \033[1mless\033[0m. If it is not available," << ::std::endl + << " then no pager 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_["--recreate"] = + &::cli::thunk< options, &options::recreate_ >; + _cli_options_map_["--drop"] = + &::cli::thunk< options, &options::drop_ >; + _cli_options_map_["--db-user"] = + &::cli::thunk< options, std::string, &options::db_user_, + &options::db_user_specified_ >; + _cli_options_map_["-u"] = + &::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_["-n"] = + &::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_["-h"] = + &::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_["-p"] = + &::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, &options::help_ >; + _cli_options_map_["--version"] = + &::cli::thunk< options, &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-migrate --help\033[0m" << ::std::endl + << "\033[1mbrep-migrate --version\033[0m" << ::std::endl + << "\033[1mbrep-migrate\033[0m [\033[4moptions\033[0m] \033[4mschema\033[0m\033[0m" << ::std::endl + << ::std::endl + << "\033[1mDESCRIPTION\033[0m" << ::std::endl + << ::std::endl + << "In its default mode \033[1mbrep-migrate\033[0m creates the database schema if it doesn't" << ::std::endl + << "already exist. Otherwise, it migrates the existing schema and data to the" << ::std::endl + << "current version, if needed. The valid schema names are \033[1mpackage\033[0m and \033[1mbuild\033[0m." << ::std::endl + << ::std::endl + << "If the \033[1m--recreate\033[0m option is specified, then \033[1mbrep-migrate\033[0m instead recreates the" << ::std::endl + << "database schema. That is, it drops all the existing tables (and their data) and" << ::std::endl + << "then creates them from scratch." << ::std::endl + << ::std::endl + << "If the \033[1m--drop\033[0m option is specified, then \033[1mbrep-migrate\033[0m drops all the existing" << ::std::endl + << "tables (and their data)." << ::std::endl + << ::std::endl + << "The \033[1m--recreate\033[0m and \033[1m--drop\033[0m options are mutually exclusive. When specified, they" << ::std::endl + << "will cause \033[1mbrep-migrate\033[0m to fail if the database schema requires migration. In" << ::std::endl + << "this case you can either migrate the database first or drop the entire database" << ::std::endl + << "using, for example, \033[1mpsql(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-migrate\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/migrate/migrate-options.hxx b/migrate/migrate-options.hxx new file mode 100644 index 0000000..f901e93 --- /dev/null +++ b/migrate/migrate-options.hxx @@ -0,0 +1,420 @@ +// -*- C++ -*- +// +// This file was generated by CLI, a command line interface +// compiler for C++. +// + +#ifndef MIGRATE_MIGRATE_OPTIONS_HXX +#define MIGRATE_MIGRATE_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 () noexcept; + + unknown_option (const std::string& option); + + const std::string& + option () const; + + virtual void + print (::std::ostream&) const; + + virtual const char* + what () const noexcept; + + private: + std::string option_; + }; + + class unknown_argument: public exception + { + public: + virtual + ~unknown_argument () noexcept; + + unknown_argument (const std::string& argument); + + const std::string& + argument () const; + + virtual void + print (::std::ostream&) const; + + virtual const char* + what () const noexcept; + + private: + std::string argument_; + }; + + class missing_value: public exception + { + public: + virtual + ~missing_value () noexcept; + + missing_value (const std::string& option); + + const std::string& + option () const; + + virtual void + print (::std::ostream&) const; + + virtual const char* + what () const noexcept; + + private: + std::string option_; + }; + + class invalid_value: public exception + { + public: + virtual + ~invalid_value () noexcept; + + 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 noexcept; + + 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 noexcept; + }; + + // 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(). + // + // The position() function returns a monotonically-increasing + // number which, if stored, can later be used to determine the + // relative position of the argument returned by the following + // call to next(). Note that if multiple scanners are used to + // extract arguments from multiple sources, then the end + // position of the previous scanner should be used as the + // start position of the next. + // + class scanner + { + public: + virtual + ~scanner (); + + virtual bool + more () = 0; + + virtual const char* + peek () = 0; + + virtual const char* + next () = 0; + + virtual void + skip () = 0; + + virtual std::size_t + position () = 0; + }; + + class argv_scanner: public scanner + { + public: + argv_scanner (int& argc, + char** argv, + bool erase = false, + std::size_t start_position = 0); + + argv_scanner (int start, + int& argc, + char** argv, + bool erase = false, + std::size_t start_position = 0); + + int + end () const; + + virtual bool + more (); + + virtual const char* + peek (); + + virtual const char* + next (); + + virtual void + skip (); + + virtual std::size_t + position (); + + protected: + std::size_t start_position_; + 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& + recreate () const; + + const bool& + drop () 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 recreate_; + bool drop_; + 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 <migrate/migrate-options.ixx> + +// Begin epilogue. +// +// +// End epilogue. + +#endif // MIGRATE_MIGRATE_OPTIONS_HXX diff --git a/migrate/migrate-options.ixx b/migrate/migrate-options.ixx new file mode 100644 index 0000000..feebd8e --- /dev/null +++ b/migrate/migrate-options.ixx @@ -0,0 +1,263 @@ +// -*- 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, + std::size_t sp) + : start_position_ (sp + 1), + i_ (1), + argc_ (argc), + argv_ (argv), + erase_ (erase) + { + } + + inline argv_scanner:: + argv_scanner (int start, + int& argc, + char** argv, + bool erase, + std::size_t sp) + : start_position_ (sp + static_cast<std::size_t> (start)), + i_ (start), + argc_ (argc), + argv_ (argv), + erase_ (erase) + { + } + + inline int argv_scanner:: + end () const + { + return i_; + } +} + +// options +// + +inline const bool& options:: +recreate () const +{ + return this->recreate_; +} + +inline const bool& options:: +drop () const +{ + return this->drop_; +} + +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/mod/module-options.cxx b/mod/module-options.cxx new file mode 100644 index 0000000..65f75a8 --- /dev/null +++ b/mod/module-options.cxx @@ -0,0 +1,12576 @@ +// -*- C++ -*- +// +// This file was generated by CLI, a command line interface +// compiler for C++. +// + +// Begin prologue. +// +#include <mod/types-parsers.hxx> +// +// End prologue. + +#include <mod/module-options.hxx> + +#include <map> +#include <set> +#include <string> +#include <vector> +#include <utility> +#include <ostream> +#include <sstream> +#include <cstring> +#include <fstream> + +namespace brep +{ + namespace cli + { + // unknown_option + // + unknown_option:: + ~unknown_option () noexcept + { + } + + void unknown_option:: + print (::std::ostream& os) const + { + os << "unknown option '" << option ().c_str () << "'"; + } + + const char* unknown_option:: + what () const noexcept + { + return "unknown option"; + } + + // unknown_argument + // + unknown_argument:: + ~unknown_argument () noexcept + { + } + + void unknown_argument:: + print (::std::ostream& os) const + { + os << "unknown argument '" << argument ().c_str () << "'"; + } + + const char* unknown_argument:: + what () const noexcept + { + return "unknown argument"; + } + + // missing_value + // + missing_value:: + ~missing_value () noexcept + { + } + + void missing_value:: + print (::std::ostream& os) const + { + os << "missing value for option '" << option ().c_str () << "'"; + } + + const char* missing_value:: + what () const noexcept + { + return "missing option value"; + } + + // invalid_value + // + invalid_value:: + ~invalid_value () noexcept + { + } + + 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 noexcept + { + return "invalid option value"; + } + + // eos_reached + // + void eos_reached:: + print (::std::ostream& os) const + { + os << what (); + } + + const char* eos_reached:: + what () const noexcept + { + return "end of argument stream reached"; + } + + // file_io_failure + // + file_io_failure:: + ~file_io_failure () noexcept + { + } + + void file_io_failure:: + print (::std::ostream& os) const + { + os << "unable to open file '" << file ().c_str () << "' or read failure"; + } + + const char* file_io_failure:: + what () const noexcept + { + return "unable to open file or read failure"; + } + + // unmatched_quote + // + unmatched_quote:: + ~unmatched_quote () noexcept + { + } + + void unmatched_quote:: + print (::std::ostream& os) const + { + os << "unmatched quote in argument '" << argument ().c_str () << "'"; + } + + const char* unmatched_quote:: + what () const noexcept + { + return "unmatched quote"; + } + + // 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_; + + ++start_position_; + return r; + } + else + throw eos_reached (); + } + + void argv_scanner:: + skip () + { + if (i_ < argc_) + { + ++i_; + ++start_position_; + } + else + throw eos_reached (); + } + + std::size_t argv_scanner:: + position () + { + return start_position_; + } + + // argv_file_scanner + // + int argv_file_scanner::zero_argc_ = 0; + std::string argv_file_scanner::empty_string_; + + bool argv_file_scanner:: + more () + { + if (!args_.empty ()) + return true; + + while (base::more ()) + { + // See if the next argument is the file option. + // + const char* a (base::peek ()); + const option_info* oi = 0; + const char* ov = 0; + + if (!skip_) + { + if ((oi = find (a)) != 0) + { + base::next (); + + if (!base::more ()) + throw missing_value (a); + + ov = base::next (); + } + } + + if (oi != 0) + { + if (oi->search_func != 0) + { + std::string f (oi->search_func (ov, oi->arg)); + + if (!f.empty ()) + load (f); + } + else + load (ov); + + if (!args_.empty ()) + return true; + } + else + { + if (!skip_) + skip_ = (std::strcmp (a, "--") == 0); + + return true; + } + } + + return false; + } + + const char* argv_file_scanner:: + peek () + { + if (!more ()) + throw eos_reached (); + + return args_.empty () ? base::peek () : args_.front ().value.c_str (); + } + + const std::string& argv_file_scanner:: + peek_file () + { + if (!more ()) + throw eos_reached (); + + return args_.empty () ? empty_string_ : *args_.front ().file; + } + + std::size_t argv_file_scanner:: + peek_line () + { + if (!more ()) + throw eos_reached (); + + return args_.empty () ? 0 : args_.front ().line; + } + + const char* argv_file_scanner:: + next () + { + if (!more ()) + throw eos_reached (); + + if (args_.empty ()) + return base::next (); + else + { + hold_[i_ == 0 ? ++i_ : --i_].swap (args_.front ().value); + args_.pop_front (); + ++start_position_; + return hold_[i_].c_str (); + } + } + + void argv_file_scanner:: + skip () + { + if (!more ()) + throw eos_reached (); + + if (args_.empty ()) + return base::skip (); + else + { + args_.pop_front (); + ++start_position_; + } + } + + const argv_file_scanner::option_info* argv_file_scanner:: + find (const char* a) const + { + for (std::size_t i (0); i < options_count_; ++i) + if (std::strcmp (a, options_[i].option) == 0) + return &options_[i]; + + return 0; + } + + std::size_t argv_file_scanner:: + position () + { + return start_position_; + } + + void argv_file_scanner:: + load (const std::string& file) + { + using namespace std; + + ifstream is (file.c_str ()); + + if (!is.is_open ()) + throw file_io_failure (file); + + files_.push_back (file); + + arg a; + a.file = &*files_.rbegin (); + + for (a.line = 1; !is.eof (); ++a.line) + { + string line; + getline (is, line); + + if (is.fail () && !is.eof ()) + throw file_io_failure (file); + + string::size_type n (line.size ()); + + // Trim the line from leading and trailing whitespaces. + // + if (n != 0) + { + const char* f (line.c_str ()); + const char* l (f + n); + + const char* of (f); + while (f < l && (*f == ' ' || *f == '\t' || *f == '\r')) + ++f; + + --l; + + const char* ol (l); + while (l > f && (*l == ' ' || *l == '\t' || *l == '\r')) + --l; + + if (f != of || l != ol) + line = f <= l ? string (f, l - f + 1) : string (); + } + + // Ignore empty lines, those that start with #. + // + if (line.empty () || line[0] == '#') + continue; + + string::size_type p (string::npos); + p = line.find (' '); + + string s1; + if (p != string::npos) + { + s1.assign (line, 0, p); + + // Skip leading whitespaces in the argument. + // + n = line.size (); + for (++p; p < n; ++p) + { + char c (line[p]); + if (c != ' ' && c != '\t' && c != '\r') + break; + } + } + else if (!skip_) + skip_ = (line == "--"); + + string s2 (line, p != string::npos ? p : 0); + + // If the string (which is an option value or argument) is + // wrapped in quotes, remove them. + // + n = s2.size (); + char cf (s2[0]), cl (s2[n - 1]); + + if (cf == '"' || cf == '\'' || cl == '"' || cl == '\'') + { + if (n == 1 || cf != cl) + throw unmatched_quote (s2); + + s2 = string (s2, 1, n - 2); + } + + if (!s1.empty ()) + { + // See if this is another file option. + // + const option_info* oi; + if (!skip_ && (oi = find (s1.c_str ()))) + { + if (s2.empty ()) + throw missing_value (oi->option); + + if (oi->search_func != 0) + { + string f (oi->search_func (s2.c_str (), oi->arg)); + if (!f.empty ()) + load (f); + } + else + { + // If the path of the file being parsed is not simple and the + // path of the file that needs to be loaded is relative, then + // complete the latter using the former as a base. + // +#ifndef _WIN32 + string::size_type p (file.find_last_of ('/')); + bool c (p != string::npos && s2[0] != '/'); +#else + string::size_type p (file.find_last_of ("/\\")); + bool c (p != string::npos && s2[1] != ':'); +#endif + if (c) + s2.insert (0, file, 0, p + 1); + + load (s2); + } + + continue; + } + + a.value = s1; + args_.push_back (a); + } + + a.value = s2; + args_.push_back (a); + } + } + + void options:: + push_back (const option& o) + { + container_type::size_type n (size ()); + container_type::push_back (o); + map_[o.name ()] = n; + + for (option_names::const_iterator i (o.aliases ().begin ()); + i != o.aliases ().end (); ++i) + map_[*i] = n; + } + + 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, bool& xs, scanner& s) + { + const char* o (s.next ()); + + if (s.more ()) + { + const char* v (s.next ()); + + if (std::strcmp (v, "1") == 0 || + std::strcmp (v, "true") == 0 || + std::strcmp (v, "TRUE") == 0 || + std::strcmp (v, "True") == 0) + x = true; + else if (std::strcmp (v, "0") == 0 || + std::strcmp (v, "false") == 0 || + std::strcmp (v, "FALSE") == 0 || + std::strcmp (v, "False") == 0) + x = false; + else + throw invalid_value (o, v); + } + else + throw missing_value (o); + + xs = 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::pair<X, std::size_t> > + { + static void + parse (std::pair<X, std::size_t>& x, bool& xs, scanner& s) + { + x.second = s.position (); + parser<X>::parse (x.first, xs, s); + } + }; + + 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::size_t pos (s.position ()); + 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, false, pos); + parser<K>::parse (k, dummy, s); + } + + if (!vstr.empty ()) + { + av[1] = const_cast<char*> (vstr.c_str ()); + argv_scanner s (0, ac, av, false, pos); + parser<V>::parse (v, dummy, s); + } + + m[k] = v; + } + else + throw missing_value (o); + + xs = true; + } + }; + + template <typename K, typename V, typename C> + struct parser<std::multimap<K, V, C> > + { + static void + parse (std::multimap<K, V, C>& m, bool& xs, scanner& s) + { + const char* o (s.next ()); + + if (s.more ()) + { + std::size_t pos (s.position ()); + 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, false, pos); + parser<K>::parse (k, dummy, s); + } + + if (!vstr.empty ()) + { + av[1] = const_cast<char*> (vstr.c_str ()); + argv_scanner s (0, ac, av, false, pos); + parser<V>::parse (v, dummy, s); + } + + m.insert (typename std::multimap<K, V, C>::value_type (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, bool X::*M> + void + thunk (X& x, scanner& s) + { + s.next (); + x.*M = true; + } + + 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> + +namespace brep +{ + namespace options + { + // repository_email + // + + repository_email:: + repository_email () + : email_ (), + email_specified_ (false) + { + } + + repository_email:: + repository_email (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : email_ (), + email_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + repository_email:: + repository_email (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : email_ (), + email_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + repository_email:: + repository_email (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : email_ (), + email_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + repository_email:: + repository_email (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : email_ (), + email_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + repository_email:: + repository_email (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : email_ (), + email_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para repository_email:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "email <email> Repository email." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_repository_email_desc_type: ::brep::cli::options + { + _cli_repository_email_desc_type () + { + ::brep::options::repository_email::fill (*this); + } + }; + + void repository_email:: + fill (::brep::cli::options& os) + { + // email + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("email", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& repository_email:: + description () + { + static _cli_repository_email_desc_type _cli_repository_email_desc_; + return _cli_repository_email_desc_; + } + + typedef + std::map<std::string, void (*) (repository_email&, ::brep::cli::scanner&)> + _cli_repository_email_map; + + static _cli_repository_email_map _cli_repository_email_map_; + + struct _cli_repository_email_map_init + { + _cli_repository_email_map_init () + { + _cli_repository_email_map_["email"] = + &::brep::cli::thunk< repository_email, string, &repository_email::email_, + &repository_email::email_specified_ >; + } + }; + + static _cli_repository_email_map_init _cli_repository_email_map_init_; + + bool repository_email:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_repository_email_map::const_iterator i (_cli_repository_email_map_.find (o)); + + if (i != _cli_repository_email_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool repository_email:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // repository_url + // + + repository_url:: + repository_url () + : host_ (), + host_specified_ (false), + root_ ("/"), + root_specified_ (false) + { + } + + repository_url:: + repository_url (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : host_ (), + host_specified_ (false), + root_ ("/"), + root_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + repository_url:: + repository_url (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : host_ (), + host_specified_ (false), + root_ ("/"), + root_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + repository_url:: + repository_url (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : host_ (), + host_specified_ (false), + root_ ("/"), + root_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + repository_url:: + repository_url (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : host_ (), + host_specified_ (false), + root_ ("/"), + root_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + repository_url:: + repository_url (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : host_ (), + host_specified_ (false), + root_ ("/"), + root_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para repository_url:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "host <host> Repository host." << ::std::endl; + + os << "root <path> Repository root." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_repository_url_desc_type: ::brep::cli::options + { + _cli_repository_url_desc_type () + { + ::brep::options::repository_url::fill (*this); + } + }; + + void repository_url:: + fill (::brep::cli::options& os) + { + // host + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("host", a, false, dv); + os.push_back (o); + } + + // root + // + { + ::brep::cli::option_names a; + std::string dv ("/"); + ::brep::cli::option o ("root", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& repository_url:: + description () + { + static _cli_repository_url_desc_type _cli_repository_url_desc_; + return _cli_repository_url_desc_; + } + + typedef + std::map<std::string, void (*) (repository_url&, ::brep::cli::scanner&)> + _cli_repository_url_map; + + static _cli_repository_url_map _cli_repository_url_map_; + + struct _cli_repository_url_map_init + { + _cli_repository_url_map_init () + { + _cli_repository_url_map_["host"] = + &::brep::cli::thunk< repository_url, string, &repository_url::host_, + &repository_url::host_specified_ >; + _cli_repository_url_map_["root"] = + &::brep::cli::thunk< repository_url, dir_path, &repository_url::root_, + &repository_url::root_specified_ >; + } + }; + + static _cli_repository_url_map_init _cli_repository_url_map_init_; + + bool repository_url:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_repository_url_map::const_iterator i (_cli_repository_url_map_.find (o)); + + if (i != _cli_repository_url_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool repository_url:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // build_email_notification + // + + build_email_notification:: + build_email_notification () + : build_toolchain_email_ (), + build_toolchain_email_specified_ (false) + { + } + + build_email_notification:: + build_email_notification (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_toolchain_email_ (), + build_toolchain_email_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + build_email_notification:: + build_email_notification (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_toolchain_email_ (), + build_toolchain_email_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + build_email_notification:: + build_email_notification (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_toolchain_email_ (), + build_toolchain_email_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_email_notification:: + build_email_notification (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_toolchain_email_ (), + build_toolchain_email_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_email_notification:: + build_email_notification (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_toolchain_email_ (), + build_toolchain_email_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para build_email_notification:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + // repository_email base + // + p = ::brep::options::repository_email::print_usage (os, p); + + // repository_url base + // + p = ::brep::options::repository_url::print_usage (os, p); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "build-toolchain-email <name>=<mode> Enable or disable package build" << ::std::endl + << " notification emails." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_build_email_notification_desc_type: ::brep::cli::options + { + _cli_build_email_notification_desc_type () + { + ::brep::options::build_email_notification::fill (*this); + } + }; + + void build_email_notification:: + fill (::brep::cli::options& os) + { + // repository_email base + // + ::brep::options::repository_email::fill (os); + + // repository_url base + // + ::brep::options::repository_url::fill (os); + + // build-toolchain-email + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("build-toolchain-email", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& build_email_notification:: + description () + { + static _cli_build_email_notification_desc_type _cli_build_email_notification_desc_; + return _cli_build_email_notification_desc_; + } + + typedef + std::map<std::string, void (*) (build_email_notification&, ::brep::cli::scanner&)> + _cli_build_email_notification_map; + + static _cli_build_email_notification_map _cli_build_email_notification_map_; + + struct _cli_build_email_notification_map_init + { + _cli_build_email_notification_map_init () + { + _cli_build_email_notification_map_["build-toolchain-email"] = + &::brep::cli::thunk< build_email_notification, std::map<string, build_email>, &build_email_notification::build_toolchain_email_, + &build_email_notification::build_toolchain_email_specified_ >; + } + }; + + static _cli_build_email_notification_map_init _cli_build_email_notification_map_init_; + + bool build_email_notification:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_build_email_notification_map::const_iterator i (_cli_build_email_notification_map_.find (o)); + + if (i != _cli_build_email_notification_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // repository_email base + // + if (::brep::options::repository_email::_parse (o, s)) + return true; + + // repository_url base + // + if (::brep::options::repository_url::_parse (o, s)) + return true; + + return false; + } + + bool build_email_notification:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // handler + // + + handler:: + handler () + : tenant_name_ ("tenant"), + tenant_name_specified_ (false), + verbosity_ (0), + verbosity_specified_ (false) + { + } + + handler:: + handler (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : tenant_name_ ("tenant"), + tenant_name_specified_ (false), + verbosity_ (0), + verbosity_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + handler:: + handler (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : tenant_name_ ("tenant"), + tenant_name_specified_ (false), + verbosity_ (0), + verbosity_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + handler:: + handler (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : tenant_name_ ("tenant"), + tenant_name_specified_ (false), + verbosity_ (0), + verbosity_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + handler:: + handler (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : tenant_name_ ("tenant"), + tenant_name_specified_ (false), + verbosity_ (0), + verbosity_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + handler:: + handler (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : tenant_name_ ("tenant"), + tenant_name_specified_ (false), + verbosity_ (0), + verbosity_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para handler:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "tenant-name <name> Name to call the tenant values" << ::std::endl + << " on web pages." << ::std::endl; + + os << "verbosity <level> Trace verbosity level." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_handler_desc_type: ::brep::cli::options + { + _cli_handler_desc_type () + { + ::brep::options::handler::fill (*this); + } + }; + + void handler:: + fill (::brep::cli::options& os) + { + // tenant-name + // + { + ::brep::cli::option_names a; + std::string dv ("tenant"); + ::brep::cli::option o ("tenant-name", a, false, dv); + os.push_back (o); + } + + // verbosity + // + { + ::brep::cli::option_names a; + std::string dv ("0"); + ::brep::cli::option o ("verbosity", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& handler:: + description () + { + static _cli_handler_desc_type _cli_handler_desc_; + return _cli_handler_desc_; + } + + typedef + std::map<std::string, void (*) (handler&, ::brep::cli::scanner&)> + _cli_handler_map; + + static _cli_handler_map _cli_handler_map_; + + struct _cli_handler_map_init + { + _cli_handler_map_init () + { + _cli_handler_map_["tenant-name"] = + &::brep::cli::thunk< handler, string, &handler::tenant_name_, + &handler::tenant_name_specified_ >; + _cli_handler_map_["verbosity"] = + &::brep::cli::thunk< handler, uint16_t, &handler::verbosity_, + &handler::verbosity_specified_ >; + } + }; + + static _cli_handler_map_init _cli_handler_map_init_; + + bool handler:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_handler_map::const_iterator i (_cli_handler_map_.find (o)); + + if (i != _cli_handler_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool handler:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // openssl_options + // + + openssl_options:: + openssl_options () + : openssl_ ("openssl"), + openssl_specified_ (false), + openssl_option_ (), + openssl_option_specified_ (false), + openssl_envvar_ (), + openssl_envvar_specified_ (false) + { + } + + openssl_options:: + openssl_options (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : openssl_ ("openssl"), + openssl_specified_ (false), + openssl_option_ (), + openssl_option_specified_ (false), + openssl_envvar_ (), + openssl_envvar_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + openssl_options:: + openssl_options (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : openssl_ ("openssl"), + openssl_specified_ (false), + openssl_option_ (), + openssl_option_specified_ (false), + openssl_envvar_ (), + openssl_envvar_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + openssl_options:: + openssl_options (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : openssl_ ("openssl"), + openssl_specified_ (false), + openssl_option_ (), + openssl_option_specified_ (false), + openssl_envvar_ (), + openssl_envvar_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + openssl_options:: + openssl_options (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : openssl_ ("openssl"), + openssl_specified_ (false), + openssl_option_ (), + openssl_option_specified_ (false), + openssl_envvar_ (), + openssl_envvar_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + openssl_options:: + openssl_options (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : openssl_ ("openssl"), + openssl_specified_ (false), + openssl_option_ (), + openssl_option_specified_ (false), + openssl_envvar_ (), + openssl_envvar_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para openssl_options:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "openssl <path> The openssl program to be used" << ::std::endl + << " for crypto operations." << ::std::endl; + + os << "openssl-option <opt> Additional option to be passed" << ::std::endl + << " to the openssl program (see" << ::std::endl + << " openssl for details)." << ::std::endl; + + os << "openssl-envvar <name>[=value] Environment variable to be set" << ::std::endl + << " (<name>=<value>) or unset (just" << ::std::endl + << " <name>) for the openssl program" << ::std::endl + << " (see openssl for details)." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_openssl_options_desc_type: ::brep::cli::options + { + _cli_openssl_options_desc_type () + { + ::brep::options::openssl_options::fill (*this); + } + }; + + void openssl_options:: + fill (::brep::cli::options& os) + { + // openssl + // + { + ::brep::cli::option_names a; + std::string dv ("openssl"); + ::brep::cli::option o ("openssl", a, false, dv); + os.push_back (o); + } + + // openssl-option + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("openssl-option", a, false, dv); + os.push_back (o); + } + + // openssl-envvar + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("openssl-envvar", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& openssl_options:: + description () + { + static _cli_openssl_options_desc_type _cli_openssl_options_desc_; + return _cli_openssl_options_desc_; + } + + typedef + std::map<std::string, void (*) (openssl_options&, ::brep::cli::scanner&)> + _cli_openssl_options_map; + + static _cli_openssl_options_map _cli_openssl_options_map_; + + struct _cli_openssl_options_map_init + { + _cli_openssl_options_map_init () + { + _cli_openssl_options_map_["openssl"] = + &::brep::cli::thunk< openssl_options, path, &openssl_options::openssl_, + &openssl_options::openssl_specified_ >; + _cli_openssl_options_map_["openssl-option"] = + &::brep::cli::thunk< openssl_options, strings, &openssl_options::openssl_option_, + &openssl_options::openssl_option_specified_ >; + _cli_openssl_options_map_["openssl-envvar"] = + &::brep::cli::thunk< openssl_options, strings, &openssl_options::openssl_envvar_, + &openssl_options::openssl_envvar_specified_ >; + } + }; + + static _cli_openssl_options_map_init _cli_openssl_options_map_init_; + + bool openssl_options:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_openssl_options_map::const_iterator i (_cli_openssl_options_map_.find (o)); + + if (i != _cli_openssl_options_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool openssl_options:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // package_db + // + + package_db:: + package_db () + : package_db_user_ (), + package_db_user_specified_ (false), + package_db_role_ ("brep"), + package_db_role_specified_ (false), + package_db_password_ (), + package_db_password_specified_ (false), + package_db_name_ ("brep_package"), + package_db_name_specified_ (false), + package_db_host_ (), + package_db_host_specified_ (false), + package_db_port_ (0), + package_db_port_specified_ (false), + package_db_max_connections_ (5), + package_db_max_connections_specified_ (false), + package_db_retry_ (10), + package_db_retry_specified_ (false) + { + } + + package_db:: + package_db (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : package_db_user_ (), + package_db_user_specified_ (false), + package_db_role_ ("brep"), + package_db_role_specified_ (false), + package_db_password_ (), + package_db_password_specified_ (false), + package_db_name_ ("brep_package"), + package_db_name_specified_ (false), + package_db_host_ (), + package_db_host_specified_ (false), + package_db_port_ (0), + package_db_port_specified_ (false), + package_db_max_connections_ (5), + package_db_max_connections_specified_ (false), + package_db_retry_ (10), + package_db_retry_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + package_db:: + package_db (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : package_db_user_ (), + package_db_user_specified_ (false), + package_db_role_ ("brep"), + package_db_role_specified_ (false), + package_db_password_ (), + package_db_password_specified_ (false), + package_db_name_ ("brep_package"), + package_db_name_specified_ (false), + package_db_host_ (), + package_db_host_specified_ (false), + package_db_port_ (0), + package_db_port_specified_ (false), + package_db_max_connections_ (5), + package_db_max_connections_specified_ (false), + package_db_retry_ (10), + package_db_retry_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + package_db:: + package_db (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : package_db_user_ (), + package_db_user_specified_ (false), + package_db_role_ ("brep"), + package_db_role_specified_ (false), + package_db_password_ (), + package_db_password_specified_ (false), + package_db_name_ ("brep_package"), + package_db_name_specified_ (false), + package_db_host_ (), + package_db_host_specified_ (false), + package_db_port_ (0), + package_db_port_specified_ (false), + package_db_max_connections_ (5), + package_db_max_connections_specified_ (false), + package_db_retry_ (10), + package_db_retry_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + package_db:: + package_db (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : package_db_user_ (), + package_db_user_specified_ (false), + package_db_role_ ("brep"), + package_db_role_specified_ (false), + package_db_password_ (), + package_db_password_specified_ (false), + package_db_name_ ("brep_package"), + package_db_name_specified_ (false), + package_db_host_ (), + package_db_host_specified_ (false), + package_db_port_ (0), + package_db_port_specified_ (false), + package_db_max_connections_ (5), + package_db_max_connections_specified_ (false), + package_db_retry_ (10), + package_db_retry_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + package_db:: + package_db (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : package_db_user_ (), + package_db_user_specified_ (false), + package_db_role_ ("brep"), + package_db_role_specified_ (false), + package_db_password_ (), + package_db_password_specified_ (false), + package_db_name_ ("brep_package"), + package_db_name_specified_ (false), + package_db_host_ (), + package_db_host_specified_ (false), + package_db_port_ (0), + package_db_port_specified_ (false), + package_db_max_connections_ (5), + package_db_max_connections_specified_ (false), + package_db_retry_ (10), + package_db_retry_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para package_db:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "package-db-user <user> Package database login user" << ::std::endl + << " name." << ::std::endl; + + os << "package-db-role <user> Package database execution user" << ::std::endl + << " name." << ::std::endl; + + os << "package-db-password <pass> Package database password." << ::std::endl; + + os << "package-db-name <name> Package database name." << ::std::endl; + + os << "package-db-host <host> Package database host name," << ::std::endl + << " address, or socket." << ::std::endl; + + os << "package-db-port <port> Package database port number." << ::std::endl; + + os << "package-db-max-connections <num> The maximum number of concurrent" << ::std::endl + << " package database connections per" << ::std::endl + << " web server process." << ::std::endl; + + os << "package-db-retry <num> The maximum number of times to" << ::std::endl + << " retry package database" << ::std::endl + << " transactions in the face of" << ::std::endl + << " recoverable failures (deadlock," << ::std::endl + << " loss of connection, etc)." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_package_db_desc_type: ::brep::cli::options + { + _cli_package_db_desc_type () + { + ::brep::options::package_db::fill (*this); + } + }; + + void package_db:: + fill (::brep::cli::options& os) + { + // package-db-user + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("package-db-user", a, false, dv); + os.push_back (o); + } + + // package-db-role + // + { + ::brep::cli::option_names a; + std::string dv ("brep"); + ::brep::cli::option o ("package-db-role", a, false, dv); + os.push_back (o); + } + + // package-db-password + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("package-db-password", a, false, dv); + os.push_back (o); + } + + // package-db-name + // + { + ::brep::cli::option_names a; + std::string dv ("brep_package"); + ::brep::cli::option o ("package-db-name", a, false, dv); + os.push_back (o); + } + + // package-db-host + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("package-db-host", a, false, dv); + os.push_back (o); + } + + // package-db-port + // + { + ::brep::cli::option_names a; + std::string dv ("0"); + ::brep::cli::option o ("package-db-port", a, false, dv); + os.push_back (o); + } + + // package-db-max-connections + // + { + ::brep::cli::option_names a; + std::string dv ("5"); + ::brep::cli::option o ("package-db-max-connections", a, false, dv); + os.push_back (o); + } + + // package-db-retry + // + { + ::brep::cli::option_names a; + std::string dv ("10"); + ::brep::cli::option o ("package-db-retry", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& package_db:: + description () + { + static _cli_package_db_desc_type _cli_package_db_desc_; + return _cli_package_db_desc_; + } + + typedef + std::map<std::string, void (*) (package_db&, ::brep::cli::scanner&)> + _cli_package_db_map; + + static _cli_package_db_map _cli_package_db_map_; + + struct _cli_package_db_map_init + { + _cli_package_db_map_init () + { + _cli_package_db_map_["package-db-user"] = + &::brep::cli::thunk< package_db, string, &package_db::package_db_user_, + &package_db::package_db_user_specified_ >; + _cli_package_db_map_["package-db-role"] = + &::brep::cli::thunk< package_db, string, &package_db::package_db_role_, + &package_db::package_db_role_specified_ >; + _cli_package_db_map_["package-db-password"] = + &::brep::cli::thunk< package_db, string, &package_db::package_db_password_, + &package_db::package_db_password_specified_ >; + _cli_package_db_map_["package-db-name"] = + &::brep::cli::thunk< package_db, string, &package_db::package_db_name_, + &package_db::package_db_name_specified_ >; + _cli_package_db_map_["package-db-host"] = + &::brep::cli::thunk< package_db, string, &package_db::package_db_host_, + &package_db::package_db_host_specified_ >; + _cli_package_db_map_["package-db-port"] = + &::brep::cli::thunk< package_db, uint16_t, &package_db::package_db_port_, + &package_db::package_db_port_specified_ >; + _cli_package_db_map_["package-db-max-connections"] = + &::brep::cli::thunk< package_db, size_t, &package_db::package_db_max_connections_, + &package_db::package_db_max_connections_specified_ >; + _cli_package_db_map_["package-db-retry"] = + &::brep::cli::thunk< package_db, size_t, &package_db::package_db_retry_, + &package_db::package_db_retry_specified_ >; + } + }; + + static _cli_package_db_map_init _cli_package_db_map_init_; + + bool package_db:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_package_db_map::const_iterator i (_cli_package_db_map_.find (o)); + + if (i != _cli_package_db_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool package_db:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // build + // + + build:: + build () + : build_config_ (), + build_config_specified_ (false), + build_bot_agent_keys_ (), + build_bot_agent_keys_specified_ (false), + build_forced_rebuild_timeout_ (600), + build_forced_rebuild_timeout_specified_ (false), + build_soft_rebuild_timeout_ (86400), + build_soft_rebuild_timeout_specified_ (false), + build_alt_soft_rebuild_timeout_ (), + build_alt_soft_rebuild_timeout_specified_ (false), + build_alt_soft_rebuild_start_ (), + build_alt_soft_rebuild_start_specified_ (false), + build_alt_soft_rebuild_stop_ (), + build_alt_soft_rebuild_stop_specified_ (false), + build_hard_rebuild_timeout_ (604800), + build_hard_rebuild_timeout_specified_ (false), + build_alt_hard_rebuild_timeout_ (), + build_alt_hard_rebuild_timeout_specified_ (false), + build_alt_hard_rebuild_start_ (), + build_alt_hard_rebuild_start_specified_ (false), + build_alt_hard_rebuild_stop_ (), + build_alt_hard_rebuild_stop_specified_ (false), + build_queued_timeout_ (30), + build_queued_timeout_specified_ (false) + { + } + + build:: + build (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_config_ (), + build_config_specified_ (false), + build_bot_agent_keys_ (), + build_bot_agent_keys_specified_ (false), + build_forced_rebuild_timeout_ (600), + build_forced_rebuild_timeout_specified_ (false), + build_soft_rebuild_timeout_ (86400), + build_soft_rebuild_timeout_specified_ (false), + build_alt_soft_rebuild_timeout_ (), + build_alt_soft_rebuild_timeout_specified_ (false), + build_alt_soft_rebuild_start_ (), + build_alt_soft_rebuild_start_specified_ (false), + build_alt_soft_rebuild_stop_ (), + build_alt_soft_rebuild_stop_specified_ (false), + build_hard_rebuild_timeout_ (604800), + build_hard_rebuild_timeout_specified_ (false), + build_alt_hard_rebuild_timeout_ (), + build_alt_hard_rebuild_timeout_specified_ (false), + build_alt_hard_rebuild_start_ (), + build_alt_hard_rebuild_start_specified_ (false), + build_alt_hard_rebuild_stop_ (), + build_alt_hard_rebuild_stop_specified_ (false), + build_queued_timeout_ (30), + build_queued_timeout_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + build:: + build (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_config_ (), + build_config_specified_ (false), + build_bot_agent_keys_ (), + build_bot_agent_keys_specified_ (false), + build_forced_rebuild_timeout_ (600), + build_forced_rebuild_timeout_specified_ (false), + build_soft_rebuild_timeout_ (86400), + build_soft_rebuild_timeout_specified_ (false), + build_alt_soft_rebuild_timeout_ (), + build_alt_soft_rebuild_timeout_specified_ (false), + build_alt_soft_rebuild_start_ (), + build_alt_soft_rebuild_start_specified_ (false), + build_alt_soft_rebuild_stop_ (), + build_alt_soft_rebuild_stop_specified_ (false), + build_hard_rebuild_timeout_ (604800), + build_hard_rebuild_timeout_specified_ (false), + build_alt_hard_rebuild_timeout_ (), + build_alt_hard_rebuild_timeout_specified_ (false), + build_alt_hard_rebuild_start_ (), + build_alt_hard_rebuild_start_specified_ (false), + build_alt_hard_rebuild_stop_ (), + build_alt_hard_rebuild_stop_specified_ (false), + build_queued_timeout_ (30), + build_queued_timeout_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + build:: + build (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_config_ (), + build_config_specified_ (false), + build_bot_agent_keys_ (), + build_bot_agent_keys_specified_ (false), + build_forced_rebuild_timeout_ (600), + build_forced_rebuild_timeout_specified_ (false), + build_soft_rebuild_timeout_ (86400), + build_soft_rebuild_timeout_specified_ (false), + build_alt_soft_rebuild_timeout_ (), + build_alt_soft_rebuild_timeout_specified_ (false), + build_alt_soft_rebuild_start_ (), + build_alt_soft_rebuild_start_specified_ (false), + build_alt_soft_rebuild_stop_ (), + build_alt_soft_rebuild_stop_specified_ (false), + build_hard_rebuild_timeout_ (604800), + build_hard_rebuild_timeout_specified_ (false), + build_alt_hard_rebuild_timeout_ (), + build_alt_hard_rebuild_timeout_specified_ (false), + build_alt_hard_rebuild_start_ (), + build_alt_hard_rebuild_start_specified_ (false), + build_alt_hard_rebuild_stop_ (), + build_alt_hard_rebuild_stop_specified_ (false), + build_queued_timeout_ (30), + build_queued_timeout_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build:: + build (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_config_ (), + build_config_specified_ (false), + build_bot_agent_keys_ (), + build_bot_agent_keys_specified_ (false), + build_forced_rebuild_timeout_ (600), + build_forced_rebuild_timeout_specified_ (false), + build_soft_rebuild_timeout_ (86400), + build_soft_rebuild_timeout_specified_ (false), + build_alt_soft_rebuild_timeout_ (), + build_alt_soft_rebuild_timeout_specified_ (false), + build_alt_soft_rebuild_start_ (), + build_alt_soft_rebuild_start_specified_ (false), + build_alt_soft_rebuild_stop_ (), + build_alt_soft_rebuild_stop_specified_ (false), + build_hard_rebuild_timeout_ (604800), + build_hard_rebuild_timeout_specified_ (false), + build_alt_hard_rebuild_timeout_ (), + build_alt_hard_rebuild_timeout_specified_ (false), + build_alt_hard_rebuild_start_ (), + build_alt_hard_rebuild_start_specified_ (false), + build_alt_hard_rebuild_stop_ (), + build_alt_hard_rebuild_stop_specified_ (false), + build_queued_timeout_ (30), + build_queued_timeout_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build:: + build (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_config_ (), + build_config_specified_ (false), + build_bot_agent_keys_ (), + build_bot_agent_keys_specified_ (false), + build_forced_rebuild_timeout_ (600), + build_forced_rebuild_timeout_specified_ (false), + build_soft_rebuild_timeout_ (86400), + build_soft_rebuild_timeout_specified_ (false), + build_alt_soft_rebuild_timeout_ (), + build_alt_soft_rebuild_timeout_specified_ (false), + build_alt_soft_rebuild_start_ (), + build_alt_soft_rebuild_start_specified_ (false), + build_alt_soft_rebuild_stop_ (), + build_alt_soft_rebuild_stop_specified_ (false), + build_hard_rebuild_timeout_ (604800), + build_hard_rebuild_timeout_specified_ (false), + build_alt_hard_rebuild_timeout_ (), + build_alt_hard_rebuild_timeout_specified_ (false), + build_alt_hard_rebuild_start_ (), + build_alt_hard_rebuild_start_specified_ (false), + build_alt_hard_rebuild_stop_ (), + build_alt_hard_rebuild_stop_specified_ (false), + build_queued_timeout_ (30), + build_queued_timeout_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para build:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + // openssl_options base + // + p = ::brep::options::openssl_options::print_usage (os, p); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "build-config <buildtab> Build configuration file." << ::std::endl; + + os << "build-bot-agent-keys <dir> Directory containing build bot" << ::std::endl + << " agent public keys." << ::std::endl; + + os << "build-forced-rebuild-timeout <seconds> Time to wait before considering" << ::std::endl + << " a package for a forced rebuild." << ::std::endl; + + os << "build-soft-rebuild-timeout <seconds> Time to wait before considering" << ::std::endl + << " a package for a soft rebuild" << ::std::endl + << " (only to be performed if the" << ::std::endl + << " build environment or any of the" << ::std::endl + << " package dependencies have" << ::std::endl + << " changed)." << ::std::endl; + + os << "build-alt-soft-rebuild-timeout <seconds> Alternative package soft rebuild" << ::std::endl + << " timeout to use instead of the" << ::std::endl + << " soft rebuild timeout (see" << ::std::endl + << " build-soft-rebuild-timeout for" << ::std::endl + << " details) during the time" << ::std::endl + << " interval specified with the" << ::std::endl + << " build-alt-soft-rebuild-start and" << ::std::endl + << " build-alt-soft-rebuild-stop" << ::std::endl + << " options." << ::std::endl; + + os << "build-alt-soft-rebuild-start <hours>:<minutes> The start time of the" << ::std::endl + << " alternative package soft rebuild" << ::std::endl + << " timeout (see" << ::std::endl + << " build-alt-soft-rebuild-timeout" << ::std::endl + << " for details)." << ::std::endl; + + os << "build-alt-soft-rebuild-stop <hours>:<minutes> The end time of the alternative" << ::std::endl + << " package soft rebuild timeout" << ::std::endl + << " (see" << ::std::endl + << " build-alt-soft-rebuild-timeout" << ::std::endl + << " for details)." << ::std::endl; + + os << "build-hard-rebuild-timeout <seconds> Time to wait before considering" << ::std::endl + << " a package for a hard rebuild (to" << ::std::endl + << " be performed unconditionally)." << ::std::endl; + + os << "build-alt-hard-rebuild-timeout <seconds> Alternative package hard rebuild" << ::std::endl + << " timeout." << ::std::endl; + + os << "build-alt-hard-rebuild-start <hours>:<minutes> The start time of the" << ::std::endl + << " alternative package hard rebuild" << ::std::endl + << " timeout (see" << ::std::endl + << " build-alt-hard-rebuild-timeout" << ::std::endl + << " for details)." << ::std::endl; + + os << "build-alt-hard-rebuild-stop <hours>:<minutes> The end time of the alternative" << ::std::endl + << " package hard rebuild timeout" << ::std::endl + << " (see" << ::std::endl + << " build-alt-hard-rebuild-timeout" << ::std::endl + << " for details)." << ::std::endl; + + os << "build-queued-timeout <seconds> Time to wait before assuming the" << ::std::endl + << " queued notifications are" << ::std::endl + << " delivered for package CI" << ::std::endl + << " requests submitted via" << ::std::endl + << " third-party services (GitHub," << ::std::endl + << " etc)." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_build_desc_type: ::brep::cli::options + { + _cli_build_desc_type () + { + ::brep::options::build::fill (*this); + } + }; + + void build:: + fill (::brep::cli::options& os) + { + // openssl_options base + // + ::brep::options::openssl_options::fill (os); + + // build-config + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("build-config", a, false, dv); + os.push_back (o); + } + + // build-bot-agent-keys + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("build-bot-agent-keys", a, false, dv); + os.push_back (o); + } + + // build-forced-rebuild-timeout + // + { + ::brep::cli::option_names a; + std::string dv ("600"); + ::brep::cli::option o ("build-forced-rebuild-timeout", a, false, dv); + os.push_back (o); + } + + // build-soft-rebuild-timeout + // + { + ::brep::cli::option_names a; + std::string dv ("86400"); + ::brep::cli::option o ("build-soft-rebuild-timeout", a, false, dv); + os.push_back (o); + } + + // build-alt-soft-rebuild-timeout + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("build-alt-soft-rebuild-timeout", a, false, dv); + os.push_back (o); + } + + // build-alt-soft-rebuild-start + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("build-alt-soft-rebuild-start", a, false, dv); + os.push_back (o); + } + + // build-alt-soft-rebuild-stop + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("build-alt-soft-rebuild-stop", a, false, dv); + os.push_back (o); + } + + // build-hard-rebuild-timeout + // + { + ::brep::cli::option_names a; + std::string dv ("604800"); + ::brep::cli::option o ("build-hard-rebuild-timeout", a, false, dv); + os.push_back (o); + } + + // build-alt-hard-rebuild-timeout + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("build-alt-hard-rebuild-timeout", a, false, dv); + os.push_back (o); + } + + // build-alt-hard-rebuild-start + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("build-alt-hard-rebuild-start", a, false, dv); + os.push_back (o); + } + + // build-alt-hard-rebuild-stop + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("build-alt-hard-rebuild-stop", a, false, dv); + os.push_back (o); + } + + // build-queued-timeout + // + { + ::brep::cli::option_names a; + std::string dv ("30"); + ::brep::cli::option o ("build-queued-timeout", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& build:: + description () + { + static _cli_build_desc_type _cli_build_desc_; + return _cli_build_desc_; + } + + typedef + std::map<std::string, void (*) (build&, ::brep::cli::scanner&)> + _cli_build_map; + + static _cli_build_map _cli_build_map_; + + struct _cli_build_map_init + { + _cli_build_map_init () + { + _cli_build_map_["build-config"] = + &::brep::cli::thunk< build, path, &build::build_config_, + &build::build_config_specified_ >; + _cli_build_map_["build-bot-agent-keys"] = + &::brep::cli::thunk< build, dir_path, &build::build_bot_agent_keys_, + &build::build_bot_agent_keys_specified_ >; + _cli_build_map_["build-forced-rebuild-timeout"] = + &::brep::cli::thunk< build, size_t, &build::build_forced_rebuild_timeout_, + &build::build_forced_rebuild_timeout_specified_ >; + _cli_build_map_["build-soft-rebuild-timeout"] = + &::brep::cli::thunk< build, size_t, &build::build_soft_rebuild_timeout_, + &build::build_soft_rebuild_timeout_specified_ >; + _cli_build_map_["build-alt-soft-rebuild-timeout"] = + &::brep::cli::thunk< build, size_t, &build::build_alt_soft_rebuild_timeout_, + &build::build_alt_soft_rebuild_timeout_specified_ >; + _cli_build_map_["build-alt-soft-rebuild-start"] = + &::brep::cli::thunk< build, duration, &build::build_alt_soft_rebuild_start_, + &build::build_alt_soft_rebuild_start_specified_ >; + _cli_build_map_["build-alt-soft-rebuild-stop"] = + &::brep::cli::thunk< build, duration, &build::build_alt_soft_rebuild_stop_, + &build::build_alt_soft_rebuild_stop_specified_ >; + _cli_build_map_["build-hard-rebuild-timeout"] = + &::brep::cli::thunk< build, size_t, &build::build_hard_rebuild_timeout_, + &build::build_hard_rebuild_timeout_specified_ >; + _cli_build_map_["build-alt-hard-rebuild-timeout"] = + &::brep::cli::thunk< build, size_t, &build::build_alt_hard_rebuild_timeout_, + &build::build_alt_hard_rebuild_timeout_specified_ >; + _cli_build_map_["build-alt-hard-rebuild-start"] = + &::brep::cli::thunk< build, duration, &build::build_alt_hard_rebuild_start_, + &build::build_alt_hard_rebuild_start_specified_ >; + _cli_build_map_["build-alt-hard-rebuild-stop"] = + &::brep::cli::thunk< build, duration, &build::build_alt_hard_rebuild_stop_, + &build::build_alt_hard_rebuild_stop_specified_ >; + _cli_build_map_["build-queued-timeout"] = + &::brep::cli::thunk< build, size_t, &build::build_queued_timeout_, + &build::build_queued_timeout_specified_ >; + } + }; + + static _cli_build_map_init _cli_build_map_init_; + + bool build:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_build_map::const_iterator i (_cli_build_map_.find (o)); + + if (i != _cli_build_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // openssl_options base + // + if (::brep::options::openssl_options::_parse (o, s)) + return true; + + return false; + } + + bool build:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // build_db + // + + build_db:: + build_db () + : build_db_user_ (), + build_db_user_specified_ (false), + build_db_role_ ("brep"), + build_db_role_specified_ (false), + build_db_password_ (), + build_db_password_specified_ (false), + build_db_name_ ("brep_build"), + build_db_name_specified_ (false), + build_db_host_ (), + build_db_host_specified_ (false), + build_db_port_ (0), + build_db_port_specified_ (false), + build_db_max_connections_ (5), + build_db_max_connections_specified_ (false), + build_db_retry_ (10), + build_db_retry_specified_ (false) + { + } + + build_db:: + build_db (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_db_user_ (), + build_db_user_specified_ (false), + build_db_role_ ("brep"), + build_db_role_specified_ (false), + build_db_password_ (), + build_db_password_specified_ (false), + build_db_name_ ("brep_build"), + build_db_name_specified_ (false), + build_db_host_ (), + build_db_host_specified_ (false), + build_db_port_ (0), + build_db_port_specified_ (false), + build_db_max_connections_ (5), + build_db_max_connections_specified_ (false), + build_db_retry_ (10), + build_db_retry_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + build_db:: + build_db (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_db_user_ (), + build_db_user_specified_ (false), + build_db_role_ ("brep"), + build_db_role_specified_ (false), + build_db_password_ (), + build_db_password_specified_ (false), + build_db_name_ ("brep_build"), + build_db_name_specified_ (false), + build_db_host_ (), + build_db_host_specified_ (false), + build_db_port_ (0), + build_db_port_specified_ (false), + build_db_max_connections_ (5), + build_db_max_connections_specified_ (false), + build_db_retry_ (10), + build_db_retry_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + build_db:: + build_db (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_db_user_ (), + build_db_user_specified_ (false), + build_db_role_ ("brep"), + build_db_role_specified_ (false), + build_db_password_ (), + build_db_password_specified_ (false), + build_db_name_ ("brep_build"), + build_db_name_specified_ (false), + build_db_host_ (), + build_db_host_specified_ (false), + build_db_port_ (0), + build_db_port_specified_ (false), + build_db_max_connections_ (5), + build_db_max_connections_specified_ (false), + build_db_retry_ (10), + build_db_retry_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_db:: + build_db (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_db_user_ (), + build_db_user_specified_ (false), + build_db_role_ ("brep"), + build_db_role_specified_ (false), + build_db_password_ (), + build_db_password_specified_ (false), + build_db_name_ ("brep_build"), + build_db_name_specified_ (false), + build_db_host_ (), + build_db_host_specified_ (false), + build_db_port_ (0), + build_db_port_specified_ (false), + build_db_max_connections_ (5), + build_db_max_connections_specified_ (false), + build_db_retry_ (10), + build_db_retry_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_db:: + build_db (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_db_user_ (), + build_db_user_specified_ (false), + build_db_role_ ("brep"), + build_db_role_specified_ (false), + build_db_password_ (), + build_db_password_specified_ (false), + build_db_name_ ("brep_build"), + build_db_name_specified_ (false), + build_db_host_ (), + build_db_host_specified_ (false), + build_db_port_ (0), + build_db_port_specified_ (false), + build_db_max_connections_ (5), + build_db_max_connections_specified_ (false), + build_db_retry_ (10), + build_db_retry_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para build_db:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "build-db-user <user> Build database login user name." << ::std::endl; + + os << "build-db-role <user> Build database execution user" << ::std::endl + << " name." << ::std::endl; + + os << "build-db-password <pass> Build database password." << ::std::endl; + + os << "build-db-name <name> Build database name." << ::std::endl; + + os << "build-db-host <host> Build database host name," << ::std::endl + << " address, or socket." << ::std::endl; + + os << "build-db-port <port> Build database port number." << ::std::endl; + + os << "build-db-max-connections <num> The maximum number of concurrent" << ::std::endl + << " build database connections per" << ::std::endl + << " web server process." << ::std::endl; + + os << "build-db-retry <num> The maximum number of times to" << ::std::endl + << " retry build database" << ::std::endl + << " transactions in the face of" << ::std::endl + << " recoverable failures (deadlock," << ::std::endl + << " loss of connection, etc)." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_build_db_desc_type: ::brep::cli::options + { + _cli_build_db_desc_type () + { + ::brep::options::build_db::fill (*this); + } + }; + + void build_db:: + fill (::brep::cli::options& os) + { + // build-db-user + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("build-db-user", a, false, dv); + os.push_back (o); + } + + // build-db-role + // + { + ::brep::cli::option_names a; + std::string dv ("brep"); + ::brep::cli::option o ("build-db-role", a, false, dv); + os.push_back (o); + } + + // build-db-password + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("build-db-password", a, false, dv); + os.push_back (o); + } + + // build-db-name + // + { + ::brep::cli::option_names a; + std::string dv ("brep_build"); + ::brep::cli::option o ("build-db-name", a, false, dv); + os.push_back (o); + } + + // build-db-host + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("build-db-host", a, false, dv); + os.push_back (o); + } + + // build-db-port + // + { + ::brep::cli::option_names a; + std::string dv ("0"); + ::brep::cli::option o ("build-db-port", a, false, dv); + os.push_back (o); + } + + // build-db-max-connections + // + { + ::brep::cli::option_names a; + std::string dv ("5"); + ::brep::cli::option o ("build-db-max-connections", a, false, dv); + os.push_back (o); + } + + // build-db-retry + // + { + ::brep::cli::option_names a; + std::string dv ("10"); + ::brep::cli::option o ("build-db-retry", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& build_db:: + description () + { + static _cli_build_db_desc_type _cli_build_db_desc_; + return _cli_build_db_desc_; + } + + typedef + std::map<std::string, void (*) (build_db&, ::brep::cli::scanner&)> + _cli_build_db_map; + + static _cli_build_db_map _cli_build_db_map_; + + struct _cli_build_db_map_init + { + _cli_build_db_map_init () + { + _cli_build_db_map_["build-db-user"] = + &::brep::cli::thunk< build_db, string, &build_db::build_db_user_, + &build_db::build_db_user_specified_ >; + _cli_build_db_map_["build-db-role"] = + &::brep::cli::thunk< build_db, string, &build_db::build_db_role_, + &build_db::build_db_role_specified_ >; + _cli_build_db_map_["build-db-password"] = + &::brep::cli::thunk< build_db, string, &build_db::build_db_password_, + &build_db::build_db_password_specified_ >; + _cli_build_db_map_["build-db-name"] = + &::brep::cli::thunk< build_db, string, &build_db::build_db_name_, + &build_db::build_db_name_specified_ >; + _cli_build_db_map_["build-db-host"] = + &::brep::cli::thunk< build_db, string, &build_db::build_db_host_, + &build_db::build_db_host_specified_ >; + _cli_build_db_map_["build-db-port"] = + &::brep::cli::thunk< build_db, uint16_t, &build_db::build_db_port_, + &build_db::build_db_port_specified_ >; + _cli_build_db_map_["build-db-max-connections"] = + &::brep::cli::thunk< build_db, size_t, &build_db::build_db_max_connections_, + &build_db::build_db_max_connections_specified_ >; + _cli_build_db_map_["build-db-retry"] = + &::brep::cli::thunk< build_db, size_t, &build_db::build_db_retry_, + &build_db::build_db_retry_specified_ >; + } + }; + + static _cli_build_db_map_init _cli_build_db_map_init_; + + bool build_db:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_build_db_map::const_iterator i (_cli_build_db_map_.find (o)); + + if (i != _cli_build_db_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool build_db:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // build_upload + // + + build_upload:: + build_upload () + : upload_data_ (), + upload_data_specified_ (false), + upload_max_size_ (), + upload_max_size_specified_ (false), + upload_email_ (), + upload_email_specified_ (false), + upload_handler_ (), + upload_handler_specified_ (false), + upload_handler_argument_ (), + upload_handler_argument_specified_ (false), + upload_handler_timeout_ (), + upload_handler_timeout_specified_ (false), + upload_toolchain_exclude_ (), + upload_toolchain_exclude_specified_ (false), + upload_repository_exclude_ (), + upload_repository_exclude_specified_ (false) + { + } + + build_upload:: + build_upload (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : upload_data_ (), + upload_data_specified_ (false), + upload_max_size_ (), + upload_max_size_specified_ (false), + upload_email_ (), + upload_email_specified_ (false), + upload_handler_ (), + upload_handler_specified_ (false), + upload_handler_argument_ (), + upload_handler_argument_specified_ (false), + upload_handler_timeout_ (), + upload_handler_timeout_specified_ (false), + upload_toolchain_exclude_ (), + upload_toolchain_exclude_specified_ (false), + upload_repository_exclude_ (), + upload_repository_exclude_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + build_upload:: + build_upload (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : upload_data_ (), + upload_data_specified_ (false), + upload_max_size_ (), + upload_max_size_specified_ (false), + upload_email_ (), + upload_email_specified_ (false), + upload_handler_ (), + upload_handler_specified_ (false), + upload_handler_argument_ (), + upload_handler_argument_specified_ (false), + upload_handler_timeout_ (), + upload_handler_timeout_specified_ (false), + upload_toolchain_exclude_ (), + upload_toolchain_exclude_specified_ (false), + upload_repository_exclude_ (), + upload_repository_exclude_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + build_upload:: + build_upload (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : upload_data_ (), + upload_data_specified_ (false), + upload_max_size_ (), + upload_max_size_specified_ (false), + upload_email_ (), + upload_email_specified_ (false), + upload_handler_ (), + upload_handler_specified_ (false), + upload_handler_argument_ (), + upload_handler_argument_specified_ (false), + upload_handler_timeout_ (), + upload_handler_timeout_specified_ (false), + upload_toolchain_exclude_ (), + upload_toolchain_exclude_specified_ (false), + upload_repository_exclude_ (), + upload_repository_exclude_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_upload:: + build_upload (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : upload_data_ (), + upload_data_specified_ (false), + upload_max_size_ (), + upload_max_size_specified_ (false), + upload_email_ (), + upload_email_specified_ (false), + upload_handler_ (), + upload_handler_specified_ (false), + upload_handler_argument_ (), + upload_handler_argument_specified_ (false), + upload_handler_timeout_ (), + upload_handler_timeout_specified_ (false), + upload_toolchain_exclude_ (), + upload_toolchain_exclude_specified_ (false), + upload_repository_exclude_ (), + upload_repository_exclude_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_upload:: + build_upload (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : upload_data_ (), + upload_data_specified_ (false), + upload_max_size_ (), + upload_max_size_specified_ (false), + upload_email_ (), + upload_email_specified_ (false), + upload_handler_ (), + upload_handler_specified_ (false), + upload_handler_argument_ (), + upload_handler_argument_specified_ (false), + upload_handler_timeout_ (), + upload_handler_timeout_specified_ (false), + upload_toolchain_exclude_ (), + upload_toolchain_exclude_specified_ (false), + upload_repository_exclude_ (), + upload_repository_exclude_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para build_upload:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "upload-data <type>=<dir> The directory to save upload" << ::std::endl + << " data to for the specified upload" << ::std::endl + << " type." << ::std::endl; + + os << "upload-max-size <type>=<bytes> The maximum size of the upload" << ::std::endl + << " data accepted for the specified" << ::std::endl + << " upload type." << ::std::endl; + + os << "upload-email <type>=<email> The build artifacts upload" << ::std::endl + << " email." << ::std::endl; + + os << "upload-handler <type>=<path> The handler program to be" << ::std::endl + << " executed on build artifacts" << ::std::endl + << " upload of the specified type." << ::std::endl; + + os << "upload-handler-argument <type>=<arg> Additional arguments to be" << ::std::endl + << " passed to the upload handler" << ::std::endl + << " program for the specified upload" << ::std::endl + << " type (see upload-handler for" << ::std::endl + << " details)." << ::std::endl; + + os << "upload-handler-timeout <type>=<seconds> The upload handler program" << ::std::endl + << " timeout in seconds for the" << ::std::endl + << " specified upload type." << ::std::endl; + + os << "upload-toolchain-exclude <type>=<name> Disable upload of the specified" << ::std::endl + << " type for the specified toolchain" << ::std::endl + << " name." << ::std::endl; + + os << "upload-repository-exclude <type>=<name> Disable upload of the specified" << ::std::endl + << " type for packages from the" << ::std::endl + << " repository with the specified" << ::std::endl + << " canonical name." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_build_upload_desc_type: ::brep::cli::options + { + _cli_build_upload_desc_type () + { + ::brep::options::build_upload::fill (*this); + } + }; + + void build_upload:: + fill (::brep::cli::options& os) + { + // upload-data + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("upload-data", a, false, dv); + os.push_back (o); + } + + // upload-max-size + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("upload-max-size", a, false, dv); + os.push_back (o); + } + + // upload-email + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("upload-email", a, false, dv); + os.push_back (o); + } + + // upload-handler + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("upload-handler", a, false, dv); + os.push_back (o); + } + + // upload-handler-argument + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("upload-handler-argument", a, false, dv); + os.push_back (o); + } + + // upload-handler-timeout + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("upload-handler-timeout", a, false, dv); + os.push_back (o); + } + + // upload-toolchain-exclude + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("upload-toolchain-exclude", a, false, dv); + os.push_back (o); + } + + // upload-repository-exclude + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("upload-repository-exclude", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& build_upload:: + description () + { + static _cli_build_upload_desc_type _cli_build_upload_desc_; + return _cli_build_upload_desc_; + } + + typedef + std::map<std::string, void (*) (build_upload&, ::brep::cli::scanner&)> + _cli_build_upload_map; + + static _cli_build_upload_map _cli_build_upload_map_; + + struct _cli_build_upload_map_init + { + _cli_build_upload_map_init () + { + _cli_build_upload_map_["upload-data"] = + &::brep::cli::thunk< build_upload, std::map<string, dir_path>, &build_upload::upload_data_, + &build_upload::upload_data_specified_ >; + _cli_build_upload_map_["upload-max-size"] = + &::brep::cli::thunk< build_upload, std::map<string, size_t>, &build_upload::upload_max_size_, + &build_upload::upload_max_size_specified_ >; + _cli_build_upload_map_["upload-email"] = + &::brep::cli::thunk< build_upload, std::map<string, string>, &build_upload::upload_email_, + &build_upload::upload_email_specified_ >; + _cli_build_upload_map_["upload-handler"] = + &::brep::cli::thunk< build_upload, std::map<string, path>, &build_upload::upload_handler_, + &build_upload::upload_handler_specified_ >; + _cli_build_upload_map_["upload-handler-argument"] = + &::brep::cli::thunk< build_upload, std::multimap<string, string>, &build_upload::upload_handler_argument_, + &build_upload::upload_handler_argument_specified_ >; + _cli_build_upload_map_["upload-handler-timeout"] = + &::brep::cli::thunk< build_upload, std::map<string, size_t>, &build_upload::upload_handler_timeout_, + &build_upload::upload_handler_timeout_specified_ >; + _cli_build_upload_map_["upload-toolchain-exclude"] = + &::brep::cli::thunk< build_upload, std::multimap<string, string>, &build_upload::upload_toolchain_exclude_, + &build_upload::upload_toolchain_exclude_specified_ >; + _cli_build_upload_map_["upload-repository-exclude"] = + &::brep::cli::thunk< build_upload, std::multimap<string, string>, &build_upload::upload_repository_exclude_, + &build_upload::upload_repository_exclude_specified_ >; + } + }; + + static _cli_build_upload_map_init _cli_build_upload_map_init_; + + bool build_upload:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_build_upload_map::const_iterator i (_cli_build_upload_map_.find (o)); + + if (i != _cli_build_upload_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool build_upload:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // page + // + + page:: + page () + : logo_ (), + logo_specified_ (false), + menu_ (), + menu_specified_ (false) + { + } + + page:: + page (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : logo_ (), + logo_specified_ (false), + menu_ (), + menu_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + page:: + page (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : logo_ (), + logo_specified_ (false), + menu_ (), + menu_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + page:: + page (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : logo_ (), + logo_specified_ (false), + menu_ (), + menu_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + page:: + page (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : logo_ (), + logo_specified_ (false), + menu_ (), + menu_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + page:: + page (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : logo_ (), + logo_specified_ (false), + menu_ (), + menu_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para page:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "logo <xhtml> Web page logo." << ::std::endl; + + os << "menu <label=link> Web page menu." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_page_desc_type: ::brep::cli::options + { + _cli_page_desc_type () + { + ::brep::options::page::fill (*this); + } + }; + + void page:: + fill (::brep::cli::options& os) + { + // logo + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("logo", a, false, dv); + os.push_back (o); + } + + // menu + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("menu", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& page:: + description () + { + static _cli_page_desc_type _cli_page_desc_; + return _cli_page_desc_; + } + + typedef + std::map<std::string, void (*) (page&, ::brep::cli::scanner&)> + _cli_page_map; + + static _cli_page_map _cli_page_map_; + + struct _cli_page_map_init + { + _cli_page_map_init () + { + _cli_page_map_["logo"] = + &::brep::cli::thunk< page, web::xhtml::fragment, &page::logo_, + &page::logo_specified_ >; + _cli_page_map_["menu"] = + &::brep::cli::thunk< page, vector<page_menu>, &page::menu_, + &page::menu_specified_ >; + } + }; + + static _cli_page_map_init _cli_page_map_init_; + + bool page:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_page_map::const_iterator i (_cli_page_map_.find (o)); + + if (i != _cli_page_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool page:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // search + // + + search:: + search () + : search_page_entries_ (20), + search_page_entries_specified_ (false), + search_pages_ (5), + search_pages_specified_ (false) + { + } + + search:: + search (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : search_page_entries_ (20), + search_page_entries_specified_ (false), + search_pages_ (5), + search_pages_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + search:: + search (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : search_page_entries_ (20), + search_page_entries_specified_ (false), + search_pages_ (5), + search_pages_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + search:: + search (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : search_page_entries_ (20), + search_page_entries_specified_ (false), + search_pages_ (5), + search_pages_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + search:: + search (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : search_page_entries_ (20), + search_page_entries_specified_ (false), + search_pages_ (5), + search_pages_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + search:: + search (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : search_page_entries_ (20), + search_page_entries_specified_ (false), + search_pages_ (5), + search_pages_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para search:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "search-page-entries <num> Number of packages per page." << ::std::endl; + + os << "search-pages <num> Number of pages in navigation" << ::std::endl + << " (pager)." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_search_desc_type: ::brep::cli::options + { + _cli_search_desc_type () + { + ::brep::options::search::fill (*this); + } + }; + + void search:: + fill (::brep::cli::options& os) + { + // search-page-entries + // + { + ::brep::cli::option_names a; + std::string dv ("20"); + ::brep::cli::option o ("search-page-entries", a, false, dv); + os.push_back (o); + } + + // search-pages + // + { + ::brep::cli::option_names a; + std::string dv ("5"); + ::brep::cli::option o ("search-pages", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& search:: + description () + { + static _cli_search_desc_type _cli_search_desc_; + return _cli_search_desc_; + } + + typedef + std::map<std::string, void (*) (search&, ::brep::cli::scanner&)> + _cli_search_map; + + static _cli_search_map _cli_search_map_; + + struct _cli_search_map_init + { + _cli_search_map_init () + { + _cli_search_map_["search-page-entries"] = + &::brep::cli::thunk< search, uint16_t, &search::search_page_entries_, + &search::search_page_entries_specified_ >; + _cli_search_map_["search-pages"] = + &::brep::cli::thunk< search, uint16_t, &search::search_pages_, + &search::search_pages_specified_ >; + } + }; + + static _cli_search_map_init _cli_search_map_init_; + + bool search:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_search_map::const_iterator i (_cli_search_map_.find (o)); + + if (i != _cli_search_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool search:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // package + // + + package:: + package () + : package_description_ (500), + package_description_specified_ (false), + package_changes_ (5000), + package_changes_specified_ (false) + { + } + + package:: + package (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : package_description_ (500), + package_description_specified_ (false), + package_changes_ (5000), + package_changes_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + package:: + package (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : package_description_ (500), + package_description_specified_ (false), + package_changes_ (5000), + package_changes_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + package:: + package (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : package_description_ (500), + package_description_specified_ (false), + package_changes_ (5000), + package_changes_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + package:: + package (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : package_description_ (500), + package_description_specified_ (false), + package_changes_ (5000), + package_changes_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + package:: + package (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : package_description_ (500), + package_description_specified_ (false), + package_changes_ (5000), + package_changes_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para package:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "package-description <len> Number of package description" << ::std::endl + << " characters to display in brief" << ::std::endl + << " pages." << ::std::endl; + + os << "package-changes <len> Number of package changes" << ::std::endl + << " characters to display in brief" << ::std::endl + << " pages." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_package_desc_type: ::brep::cli::options + { + _cli_package_desc_type () + { + ::brep::options::package::fill (*this); + } + }; + + void package:: + fill (::brep::cli::options& os) + { + // package-description + // + { + ::brep::cli::option_names a; + std::string dv ("500"); + ::brep::cli::option o ("package-description", a, false, dv); + os.push_back (o); + } + + // package-changes + // + { + ::brep::cli::option_names a; + std::string dv ("5000"); + ::brep::cli::option o ("package-changes", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& package:: + description () + { + static _cli_package_desc_type _cli_package_desc_; + return _cli_package_desc_; + } + + typedef + std::map<std::string, void (*) (package&, ::brep::cli::scanner&)> + _cli_package_map; + + static _cli_package_map _cli_package_map_; + + struct _cli_package_map_init + { + _cli_package_map_init () + { + _cli_package_map_["package-description"] = + &::brep::cli::thunk< package, uint16_t, &package::package_description_, + &package::package_description_specified_ >; + _cli_package_map_["package-changes"] = + &::brep::cli::thunk< package, uint16_t, &package::package_changes_, + &package::package_changes_specified_ >; + } + }; + + static _cli_package_map_init _cli_package_map_init_; + + bool package:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_package_map::const_iterator i (_cli_package_map_.find (o)); + + if (i != _cli_package_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool package:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // packages + // + + packages:: + packages () + : search_title_ ("Packages"), + search_title_specified_ (false), + search_description_ (), + search_description_specified_ (false) + { + } + + packages:: + packages (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : search_title_ ("Packages"), + search_title_specified_ (false), + search_description_ (), + search_description_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + packages:: + packages (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : search_title_ ("Packages"), + search_title_specified_ (false), + search_description_ (), + search_description_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + packages:: + packages (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : search_title_ ("Packages"), + search_title_specified_ (false), + search_description_ (), + search_description_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + packages:: + packages (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : search_title_ ("Packages"), + search_title_specified_ (false), + search_description_ (), + search_description_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + packages:: + packages (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : search_title_ ("Packages"), + search_title_specified_ (false), + search_description_ (), + search_description_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para packages:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + // search base + // + p = ::brep::options::search::print_usage (os, p); + + // package_db base + // + p = ::brep::options::package_db::print_usage (os, p); + + // page base + // + p = ::brep::options::page::print_usage (os, p); + + // repository_url base + // + p = ::brep::options::repository_url::print_usage (os, p); + + // handler base + // + p = ::brep::options::handler::print_usage (os, p); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "search-title <text> Package search page title." << ::std::endl; + + os << "search-description <xhtml> Package search page description." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_packages_desc_type: ::brep::cli::options + { + _cli_packages_desc_type () + { + ::brep::options::packages::fill (*this); + } + }; + + void packages:: + fill (::brep::cli::options& os) + { + // search base + // + ::brep::options::search::fill (os); + + // package_db base + // + ::brep::options::package_db::fill (os); + + // page base + // + ::brep::options::page::fill (os); + + // repository_url base + // + ::brep::options::repository_url::fill (os); + + // handler base + // + ::brep::options::handler::fill (os); + + // search-title + // + { + ::brep::cli::option_names a; + std::string dv ("Packages"); + ::brep::cli::option o ("search-title", a, false, dv); + os.push_back (o); + } + + // search-description + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("search-description", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& packages:: + description () + { + static _cli_packages_desc_type _cli_packages_desc_; + return _cli_packages_desc_; + } + + typedef + std::map<std::string, void (*) (packages&, ::brep::cli::scanner&)> + _cli_packages_map; + + static _cli_packages_map _cli_packages_map_; + + struct _cli_packages_map_init + { + _cli_packages_map_init () + { + _cli_packages_map_["search-title"] = + &::brep::cli::thunk< packages, string, &packages::search_title_, + &packages::search_title_specified_ >; + _cli_packages_map_["search-description"] = + &::brep::cli::thunk< packages, web::xhtml::fragment, &packages::search_description_, + &packages::search_description_specified_ >; + } + }; + + static _cli_packages_map_init _cli_packages_map_init_; + + bool packages:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_packages_map::const_iterator i (_cli_packages_map_.find (o)); + + if (i != _cli_packages_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // search base + // + if (::brep::options::search::_parse (o, s)) + return true; + + // package_db base + // + if (::brep::options::package_db::_parse (o, s)) + return true; + + // page base + // + if (::brep::options::page::_parse (o, s)) + return true; + + // repository_url base + // + if (::brep::options::repository_url::_parse (o, s)) + return true; + + // handler base + // + if (::brep::options::handler::_parse (o, s)) + return true; + + return false; + } + + bool packages:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // package_details + // + + package_details:: + package_details () + { + } + + package_details:: + package_details (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + package_details:: + package_details (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + package_details:: + package_details (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + package_details:: + package_details (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + package_details:: + package_details (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para package_details:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + // package base + // + p = ::brep::options::package::print_usage (os, p); + + // package_db base + // + p = ::brep::options::package_db::print_usage (os, p); + + // search base + // + p = ::brep::options::search::print_usage (os, p); + + // page base + // + p = ::brep::options::page::print_usage (os, p); + + // repository_url base + // + p = ::brep::options::repository_url::print_usage (os, p); + + // handler base + // + p = ::brep::options::handler::print_usage (os, p); + + return p; + } + + struct _cli_package_details_desc_type: ::brep::cli::options + { + _cli_package_details_desc_type () + { + ::brep::options::package_details::fill (*this); + } + }; + + void package_details:: + fill (::brep::cli::options& os) + { + // package base + // + ::brep::options::package::fill (os); + + // package_db base + // + ::brep::options::package_db::fill (os); + + // search base + // + ::brep::options::search::fill (os); + + // page base + // + ::brep::options::page::fill (os); + + // repository_url base + // + ::brep::options::repository_url::fill (os); + + // handler base + // + ::brep::options::handler::fill (os); + } + + const ::brep::cli::options& package_details:: + description () + { + static _cli_package_details_desc_type _cli_package_details_desc_; + return _cli_package_details_desc_; + } + + typedef + std::map<std::string, void (*) (package_details&, ::brep::cli::scanner&)> + _cli_package_details_map; + + static _cli_package_details_map _cli_package_details_map_; + + struct _cli_package_details_map_init + { + _cli_package_details_map_init () + { + } + }; + + static _cli_package_details_map_init _cli_package_details_map_init_; + + bool package_details:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_package_details_map::const_iterator i (_cli_package_details_map_.find (o)); + + if (i != _cli_package_details_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // package base + // + if (::brep::options::package::_parse (o, s)) + return true; + + // package_db base + // + if (::brep::options::package_db::_parse (o, s)) + return true; + + // search base + // + if (::brep::options::search::_parse (o, s)) + return true; + + // page base + // + if (::brep::options::page::_parse (o, s)) + return true; + + // repository_url base + // + if (::brep::options::repository_url::_parse (o, s)) + return true; + + // handler base + // + if (::brep::options::handler::_parse (o, s)) + return true; + + return false; + } + + bool package_details:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // package_version_details + // + + package_version_details:: + package_version_details () + : bindist_root_ (), + bindist_root_specified_ (false), + bindist_url_ (), + bindist_url_specified_ (false) + { + } + + package_version_details:: + package_version_details (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : bindist_root_ (), + bindist_root_specified_ (false), + bindist_url_ (), + bindist_url_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + package_version_details:: + package_version_details (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : bindist_root_ (), + bindist_root_specified_ (false), + bindist_url_ (), + bindist_url_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + package_version_details:: + package_version_details (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : bindist_root_ (), + bindist_root_specified_ (false), + bindist_url_ (), + bindist_url_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + package_version_details:: + package_version_details (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : bindist_root_ (), + bindist_root_specified_ (false), + bindist_url_ (), + bindist_url_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + package_version_details:: + package_version_details (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : bindist_root_ (), + bindist_root_specified_ (false), + bindist_url_ (), + bindist_url_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para package_version_details:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + // package base + // + p = ::brep::options::package::print_usage (os, p); + + // package_db base + // + p = ::brep::options::package_db::print_usage (os, p); + + // build base + // + p = ::brep::options::build::print_usage (os, p); + + // build_db base + // + p = ::brep::options::build_db::print_usage (os, p); + + // page base + // + p = ::brep::options::page::print_usage (os, p); + + // repository_url base + // + p = ::brep::options::repository_url::print_usage (os, p); + + // handler base + // + p = ::brep::options::handler::print_usage (os, p); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "bindist-root <dir> The root directory where the" << ::std::endl + << " uploaded binary distribution" << ::std::endl + << " packages are saved to under the" << ::std::endl + << " following directory hierarchy:" << ::std::endl + << ::std::endl + << " [<tenant>/]<distribution>/<os-re" << ::std::endl + << " ease>/<project>/<package>/<versi" << ::std::endl + << " n>/<package-config>" << ::std::endl + << ::std::endl + << " The package configuration" << ::std::endl + << " directory symlinks that match" << ::std::endl + << " these paths are mapped to web" << ::std::endl + << " URLs based on the bindist-url" << ::std::endl + << " value and displayed on the" << ::std::endl + << " package version details page." << ::std::endl; + + os << "bindist-url <url> The root URL of the directory" << ::std::endl + << " specified with the bindist-root" << ::std::endl + << " option." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_package_version_details_desc_type: ::brep::cli::options + { + _cli_package_version_details_desc_type () + { + ::brep::options::package_version_details::fill (*this); + } + }; + + void package_version_details:: + fill (::brep::cli::options& os) + { + // package base + // + ::brep::options::package::fill (os); + + // package_db base + // + ::brep::options::package_db::fill (os); + + // build base + // + ::brep::options::build::fill (os); + + // build_db base + // + ::brep::options::build_db::fill (os); + + // page base + // + ::brep::options::page::fill (os); + + // repository_url base + // + ::brep::options::repository_url::fill (os); + + // handler base + // + ::brep::options::handler::fill (os); + + // bindist-root + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("bindist-root", a, false, dv); + os.push_back (o); + } + + // bindist-url + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("bindist-url", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& package_version_details:: + description () + { + static _cli_package_version_details_desc_type _cli_package_version_details_desc_; + return _cli_package_version_details_desc_; + } + + typedef + std::map<std::string, void (*) (package_version_details&, ::brep::cli::scanner&)> + _cli_package_version_details_map; + + static _cli_package_version_details_map _cli_package_version_details_map_; + + struct _cli_package_version_details_map_init + { + _cli_package_version_details_map_init () + { + _cli_package_version_details_map_["bindist-root"] = + &::brep::cli::thunk< package_version_details, dir_path, &package_version_details::bindist_root_, + &package_version_details::bindist_root_specified_ >; + _cli_package_version_details_map_["bindist-url"] = + &::brep::cli::thunk< package_version_details, string, &package_version_details::bindist_url_, + &package_version_details::bindist_url_specified_ >; + } + }; + + static _cli_package_version_details_map_init _cli_package_version_details_map_init_; + + bool package_version_details:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_package_version_details_map::const_iterator i (_cli_package_version_details_map_.find (o)); + + if (i != _cli_package_version_details_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // package base + // + if (::brep::options::package::_parse (o, s)) + return true; + + // package_db base + // + if (::brep::options::package_db::_parse (o, s)) + return true; + + // build base + // + if (::brep::options::build::_parse (o, s)) + return true; + + // build_db base + // + if (::brep::options::build_db::_parse (o, s)) + return true; + + // page base + // + if (::brep::options::page::_parse (o, s)) + return true; + + // repository_url base + // + if (::brep::options::repository_url::_parse (o, s)) + return true; + + // handler base + // + if (::brep::options::handler::_parse (o, s)) + return true; + + return false; + } + + bool package_version_details:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // repository_details + // + + repository_details:: + repository_details () + { + } + + repository_details:: + repository_details (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + repository_details:: + repository_details (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + repository_details:: + repository_details (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + repository_details:: + repository_details (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + repository_details:: + repository_details (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para repository_details:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + // package_db base + // + p = ::brep::options::package_db::print_usage (os, p); + + // page base + // + p = ::brep::options::page::print_usage (os, p); + + // repository_url base + // + p = ::brep::options::repository_url::print_usage (os, p); + + // handler base + // + p = ::brep::options::handler::print_usage (os, p); + + return p; + } + + struct _cli_repository_details_desc_type: ::brep::cli::options + { + _cli_repository_details_desc_type () + { + ::brep::options::repository_details::fill (*this); + } + }; + + void repository_details:: + fill (::brep::cli::options& os) + { + // package_db base + // + ::brep::options::package_db::fill (os); + + // page base + // + ::brep::options::page::fill (os); + + // repository_url base + // + ::brep::options::repository_url::fill (os); + + // handler base + // + ::brep::options::handler::fill (os); + } + + const ::brep::cli::options& repository_details:: + description () + { + static _cli_repository_details_desc_type _cli_repository_details_desc_; + return _cli_repository_details_desc_; + } + + typedef + std::map<std::string, void (*) (repository_details&, ::brep::cli::scanner&)> + _cli_repository_details_map; + + static _cli_repository_details_map _cli_repository_details_map_; + + struct _cli_repository_details_map_init + { + _cli_repository_details_map_init () + { + } + }; + + static _cli_repository_details_map_init _cli_repository_details_map_init_; + + bool repository_details:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_repository_details_map::const_iterator i (_cli_repository_details_map_.find (o)); + + if (i != _cli_repository_details_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // package_db base + // + if (::brep::options::package_db::_parse (o, s)) + return true; + + // page base + // + if (::brep::options::page::_parse (o, s)) + return true; + + // repository_url base + // + if (::brep::options::repository_url::_parse (o, s)) + return true; + + // handler base + // + if (::brep::options::handler::_parse (o, s)) + return true; + + return false; + } + + bool repository_details:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // build_task + // + + build_task:: + build_task () + : build_task_request_max_size_ (102400), + build_task_request_max_size_specified_ (false), + build_result_timeout_ (10800), + build_result_timeout_specified_ (false), + build_interactive_login_ (), + build_interactive_login_specified_ (false), + build_package_order_ (build_order::stable), + build_package_order_specified_ (false) + { + } + + build_task:: + build_task (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_task_request_max_size_ (102400), + build_task_request_max_size_specified_ (false), + build_result_timeout_ (10800), + build_result_timeout_specified_ (false), + build_interactive_login_ (), + build_interactive_login_specified_ (false), + build_package_order_ (build_order::stable), + build_package_order_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + build_task:: + build_task (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_task_request_max_size_ (102400), + build_task_request_max_size_specified_ (false), + build_result_timeout_ (10800), + build_result_timeout_specified_ (false), + build_interactive_login_ (), + build_interactive_login_specified_ (false), + build_package_order_ (build_order::stable), + build_package_order_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + build_task:: + build_task (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_task_request_max_size_ (102400), + build_task_request_max_size_specified_ (false), + build_result_timeout_ (10800), + build_result_timeout_specified_ (false), + build_interactive_login_ (), + build_interactive_login_specified_ (false), + build_package_order_ (build_order::stable), + build_package_order_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_task:: + build_task (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_task_request_max_size_ (102400), + build_task_request_max_size_specified_ (false), + build_result_timeout_ (10800), + build_result_timeout_specified_ (false), + build_interactive_login_ (), + build_interactive_login_specified_ (false), + build_package_order_ (build_order::stable), + build_package_order_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_task:: + build_task (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_task_request_max_size_ (102400), + build_task_request_max_size_specified_ (false), + build_result_timeout_ (10800), + build_result_timeout_specified_ (false), + build_interactive_login_ (), + build_interactive_login_specified_ (false), + build_package_order_ (build_order::stable), + build_package_order_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para build_task:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + // build base + // + p = ::brep::options::build::print_usage (os, p); + + // build_db base + // + p = ::brep::options::build_db::print_usage (os, p); + + // build_upload base + // + p = ::brep::options::build_upload::print_usage (os, p); + + // build_email_notification base + // + p = ::brep::options::build_email_notification::print_usage (os, p); + + // handler base + // + p = ::brep::options::handler::print_usage (os, p); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "build-task-request-max-size <bytes> The maximum size of the build" << ::std::endl + << " task request manifest accepted." << ::std::endl; + + os << "build-result-timeout <seconds> Time to wait before considering" << ::std::endl + << " the expected task result lost." << ::std::endl; + + os << "build-interactive-login </regex/replacement/> Regular expressions for" << ::std::endl + << " transforming the interactive" << ::std::endl + << " build login information, for" << ::std::endl + << " example, into the actual command" << ::std::endl + << " that can be used by the user." << ::std::endl; + + os << "build-package-order <order> Order in which packages are" << ::std::endl + << " considered for build." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_build_task_desc_type: ::brep::cli::options + { + _cli_build_task_desc_type () + { + ::brep::options::build_task::fill (*this); + } + }; + + void build_task:: + fill (::brep::cli::options& os) + { + // build base + // + ::brep::options::build::fill (os); + + // build_db base + // + ::brep::options::build_db::fill (os); + + // build_upload base + // + ::brep::options::build_upload::fill (os); + + // build_email_notification base + // + ::brep::options::build_email_notification::fill (os); + + // handler base + // + ::brep::options::handler::fill (os); + + // build-task-request-max-size + // + { + ::brep::cli::option_names a; + std::string dv ("102400"); + ::brep::cli::option o ("build-task-request-max-size", a, false, dv); + os.push_back (o); + } + + // build-result-timeout + // + { + ::brep::cli::option_names a; + std::string dv ("10800"); + ::brep::cli::option o ("build-result-timeout", a, false, dv); + os.push_back (o); + } + + // build-interactive-login + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("build-interactive-login", a, false, dv); + os.push_back (o); + } + + // build-package-order + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("build-package-order", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& build_task:: + description () + { + static _cli_build_task_desc_type _cli_build_task_desc_; + return _cli_build_task_desc_; + } + + typedef + std::map<std::string, void (*) (build_task&, ::brep::cli::scanner&)> + _cli_build_task_map; + + static _cli_build_task_map _cli_build_task_map_; + + struct _cli_build_task_map_init + { + _cli_build_task_map_init () + { + _cli_build_task_map_["build-task-request-max-size"] = + &::brep::cli::thunk< build_task, size_t, &build_task::build_task_request_max_size_, + &build_task::build_task_request_max_size_specified_ >; + _cli_build_task_map_["build-result-timeout"] = + &::brep::cli::thunk< build_task, size_t, &build_task::build_result_timeout_, + &build_task::build_result_timeout_specified_ >; + _cli_build_task_map_["build-interactive-login"] = + &::brep::cli::thunk< build_task, vector<pair<std::regex, string>>, &build_task::build_interactive_login_, + &build_task::build_interactive_login_specified_ >; + _cli_build_task_map_["build-package-order"] = + &::brep::cli::thunk< build_task, build_order, &build_task::build_package_order_, + &build_task::build_package_order_specified_ >; + } + }; + + static _cli_build_task_map_init _cli_build_task_map_init_; + + bool build_task:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_build_task_map::const_iterator i (_cli_build_task_map_.find (o)); + + if (i != _cli_build_task_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // build base + // + if (::brep::options::build::_parse (o, s)) + return true; + + // build_db base + // + if (::brep::options::build_db::_parse (o, s)) + return true; + + // build_upload base + // + if (::brep::options::build_upload::_parse (o, s)) + return true; + + // build_email_notification base + // + if (::brep::options::build_email_notification::_parse (o, s)) + return true; + + // handler base + // + if (::brep::options::handler::_parse (o, s)) + return true; + + return false; + } + + bool build_task:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // build_result + // + + build_result:: + build_result () + : build_result_request_max_size_ (10485760), + build_result_request_max_size_specified_ (false) + { + } + + build_result:: + build_result (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_result_request_max_size_ (10485760), + build_result_request_max_size_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + build_result:: + build_result (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_result_request_max_size_ (10485760), + build_result_request_max_size_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + build_result:: + build_result (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_result_request_max_size_ (10485760), + build_result_request_max_size_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_result:: + build_result (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_result_request_max_size_ (10485760), + build_result_request_max_size_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_result:: + build_result (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_result_request_max_size_ (10485760), + build_result_request_max_size_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para build_result:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + // build base + // + p = ::brep::options::build::print_usage (os, p); + + // build_db base + // + p = ::brep::options::build_db::print_usage (os, p); + + // build_email_notification base + // + p = ::brep::options::build_email_notification::print_usage (os, p); + + // handler base + // + p = ::brep::options::handler::print_usage (os, p); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "build-result-request-max-size <bytes> The maximum size of the build" << ::std::endl + << " result manifest accepted." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_build_result_desc_type: ::brep::cli::options + { + _cli_build_result_desc_type () + { + ::brep::options::build_result::fill (*this); + } + }; + + void build_result:: + fill (::brep::cli::options& os) + { + // build base + // + ::brep::options::build::fill (os); + + // build_db base + // + ::brep::options::build_db::fill (os); + + // build_email_notification base + // + ::brep::options::build_email_notification::fill (os); + + // handler base + // + ::brep::options::handler::fill (os); + + // build-result-request-max-size + // + { + ::brep::cli::option_names a; + std::string dv ("10485760"); + ::brep::cli::option o ("build-result-request-max-size", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& build_result:: + description () + { + static _cli_build_result_desc_type _cli_build_result_desc_; + return _cli_build_result_desc_; + } + + typedef + std::map<std::string, void (*) (build_result&, ::brep::cli::scanner&)> + _cli_build_result_map; + + static _cli_build_result_map _cli_build_result_map_; + + struct _cli_build_result_map_init + { + _cli_build_result_map_init () + { + _cli_build_result_map_["build-result-request-max-size"] = + &::brep::cli::thunk< build_result, size_t, &build_result::build_result_request_max_size_, + &build_result::build_result_request_max_size_specified_ >; + } + }; + + static _cli_build_result_map_init _cli_build_result_map_init_; + + bool build_result:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_build_result_map::const_iterator i (_cli_build_result_map_.find (o)); + + if (i != _cli_build_result_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // build base + // + if (::brep::options::build::_parse (o, s)) + return true; + + // build_db base + // + if (::brep::options::build_db::_parse (o, s)) + return true; + + // build_email_notification base + // + if (::brep::options::build_email_notification::_parse (o, s)) + return true; + + // handler base + // + if (::brep::options::handler::_parse (o, s)) + return true; + + return false; + } + + bool build_result:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // build_log + // + + build_log:: + build_log () + { + } + + build_log:: + build_log (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + build_log:: + build_log (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + build_log:: + build_log (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_log:: + build_log (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_log:: + build_log (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para build_log:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + // build base + // + p = ::brep::options::build::print_usage (os, p); + + // build_db base + // + p = ::brep::options::build_db::print_usage (os, p); + + // repository_url base + // + p = ::brep::options::repository_url::print_usage (os, p); + + // handler base + // + p = ::brep::options::handler::print_usage (os, p); + + return p; + } + + struct _cli_build_log_desc_type: ::brep::cli::options + { + _cli_build_log_desc_type () + { + ::brep::options::build_log::fill (*this); + } + }; + + void build_log:: + fill (::brep::cli::options& os) + { + // build base + // + ::brep::options::build::fill (os); + + // build_db base + // + ::brep::options::build_db::fill (os); + + // repository_url base + // + ::brep::options::repository_url::fill (os); + + // handler base + // + ::brep::options::handler::fill (os); + } + + const ::brep::cli::options& build_log:: + description () + { + static _cli_build_log_desc_type _cli_build_log_desc_; + return _cli_build_log_desc_; + } + + typedef + std::map<std::string, void (*) (build_log&, ::brep::cli::scanner&)> + _cli_build_log_map; + + static _cli_build_log_map _cli_build_log_map_; + + struct _cli_build_log_map_init + { + _cli_build_log_map_init () + { + } + }; + + static _cli_build_log_map_init _cli_build_log_map_init_; + + bool build_log:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_build_log_map::const_iterator i (_cli_build_log_map_.find (o)); + + if (i != _cli_build_log_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // build base + // + if (::brep::options::build::_parse (o, s)) + return true; + + // build_db base + // + if (::brep::options::build_db::_parse (o, s)) + return true; + + // repository_url base + // + if (::brep::options::repository_url::_parse (o, s)) + return true; + + // handler base + // + if (::brep::options::handler::_parse (o, s)) + return true; + + return false; + } + + bool build_log:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // build_force + // + + build_force:: + build_force () + { + } + + build_force:: + build_force (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + build_force:: + build_force (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + build_force:: + build_force (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_force:: + build_force (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_force:: + build_force (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para build_force:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + // build base + // + p = ::brep::options::build::print_usage (os, p); + + // build_db base + // + p = ::brep::options::build_db::print_usage (os, p); + + // handler base + // + p = ::brep::options::handler::print_usage (os, p); + + return p; + } + + struct _cli_build_force_desc_type: ::brep::cli::options + { + _cli_build_force_desc_type () + { + ::brep::options::build_force::fill (*this); + } + }; + + void build_force:: + fill (::brep::cli::options& os) + { + // build base + // + ::brep::options::build::fill (os); + + // build_db base + // + ::brep::options::build_db::fill (os); + + // handler base + // + ::brep::options::handler::fill (os); + } + + const ::brep::cli::options& build_force:: + description () + { + static _cli_build_force_desc_type _cli_build_force_desc_; + return _cli_build_force_desc_; + } + + typedef + std::map<std::string, void (*) (build_force&, ::brep::cli::scanner&)> + _cli_build_force_map; + + static _cli_build_force_map _cli_build_force_map_; + + struct _cli_build_force_map_init + { + _cli_build_force_map_init () + { + } + }; + + static _cli_build_force_map_init _cli_build_force_map_init_; + + bool build_force:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_build_force_map::const_iterator i (_cli_build_force_map_.find (o)); + + if (i != _cli_build_force_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // build base + // + if (::brep::options::build::_parse (o, s)) + return true; + + // build_db base + // + if (::brep::options::build_db::_parse (o, s)) + return true; + + // handler base + // + if (::brep::options::handler::_parse (o, s)) + return true; + + return false; + } + + bool build_force:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // builds + // + + builds:: + builds () + : build_page_entries_ (20), + build_page_entries_specified_ (false), + build_pages_ (5), + build_pages_specified_ (false) + { + } + + builds:: + builds (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_page_entries_ (20), + build_page_entries_specified_ (false), + build_pages_ (5), + build_pages_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + builds:: + builds (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_page_entries_ (20), + build_page_entries_specified_ (false), + build_pages_ (5), + build_pages_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + builds:: + builds (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_page_entries_ (20), + build_page_entries_specified_ (false), + build_pages_ (5), + build_pages_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + builds:: + builds (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_page_entries_ (20), + build_page_entries_specified_ (false), + build_pages_ (5), + build_pages_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + builds:: + builds (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_page_entries_ (20), + build_page_entries_specified_ (false), + build_pages_ (5), + build_pages_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para builds:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + // build base + // + p = ::brep::options::build::print_usage (os, p); + + // build_db base + // + p = ::brep::options::build_db::print_usage (os, p); + + // page base + // + p = ::brep::options::page::print_usage (os, p); + + // repository_url base + // + p = ::brep::options::repository_url::print_usage (os, p); + + // handler base + // + p = ::brep::options::handler::print_usage (os, p); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "build-page-entries <num> Number of builds per page." << ::std::endl; + + os << "build-pages <num> Number of pages in navigation" << ::std::endl + << " (pager)." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_builds_desc_type: ::brep::cli::options + { + _cli_builds_desc_type () + { + ::brep::options::builds::fill (*this); + } + }; + + void builds:: + fill (::brep::cli::options& os) + { + // build base + // + ::brep::options::build::fill (os); + + // build_db base + // + ::brep::options::build_db::fill (os); + + // page base + // + ::brep::options::page::fill (os); + + // repository_url base + // + ::brep::options::repository_url::fill (os); + + // handler base + // + ::brep::options::handler::fill (os); + + // build-page-entries + // + { + ::brep::cli::option_names a; + std::string dv ("20"); + ::brep::cli::option o ("build-page-entries", a, false, dv); + os.push_back (o); + } + + // build-pages + // + { + ::brep::cli::option_names a; + std::string dv ("5"); + ::brep::cli::option o ("build-pages", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& builds:: + description () + { + static _cli_builds_desc_type _cli_builds_desc_; + return _cli_builds_desc_; + } + + typedef + std::map<std::string, void (*) (builds&, ::brep::cli::scanner&)> + _cli_builds_map; + + static _cli_builds_map _cli_builds_map_; + + struct _cli_builds_map_init + { + _cli_builds_map_init () + { + _cli_builds_map_["build-page-entries"] = + &::brep::cli::thunk< builds, uint16_t, &builds::build_page_entries_, + &builds::build_page_entries_specified_ >; + _cli_builds_map_["build-pages"] = + &::brep::cli::thunk< builds, uint16_t, &builds::build_pages_, + &builds::build_pages_specified_ >; + } + }; + + static _cli_builds_map_init _cli_builds_map_init_; + + bool builds:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_builds_map::const_iterator i (_cli_builds_map_.find (o)); + + if (i != _cli_builds_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // build base + // + if (::brep::options::build::_parse (o, s)) + return true; + + // build_db base + // + if (::brep::options::build_db::_parse (o, s)) + return true; + + // page base + // + if (::brep::options::page::_parse (o, s)) + return true; + + // repository_url base + // + if (::brep::options::repository_url::_parse (o, s)) + return true; + + // handler base + // + if (::brep::options::handler::_parse (o, s)) + return true; + + return false; + } + + bool builds:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // build_configs + // + + build_configs:: + build_configs () + : build_config_page_entries_ (20), + build_config_page_entries_specified_ (false), + build_config_pages_ (5), + build_config_pages_specified_ (false) + { + } + + build_configs:: + build_configs (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_config_page_entries_ (20), + build_config_page_entries_specified_ (false), + build_config_pages_ (5), + build_config_pages_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + build_configs:: + build_configs (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_config_page_entries_ (20), + build_config_page_entries_specified_ (false), + build_config_pages_ (5), + build_config_pages_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + build_configs:: + build_configs (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_config_page_entries_ (20), + build_config_page_entries_specified_ (false), + build_config_pages_ (5), + build_config_pages_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_configs:: + build_configs (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_config_page_entries_ (20), + build_config_page_entries_specified_ (false), + build_config_pages_ (5), + build_config_pages_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_configs:: + build_configs (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_config_page_entries_ (20), + build_config_page_entries_specified_ (false), + build_config_pages_ (5), + build_config_pages_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para build_configs:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + // build base + // + p = ::brep::options::build::print_usage (os, p); + + // page base + // + p = ::brep::options::page::print_usage (os, p); + + // repository_url base + // + p = ::brep::options::repository_url::print_usage (os, p); + + // handler base + // + p = ::brep::options::handler::print_usage (os, p); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "build-config-page-entries <num> Number of build configurations" << ::std::endl + << " per page." << ::std::endl; + + os << "build-config-pages <num> Number of pages in navigation" << ::std::endl + << " (pager)." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_build_configs_desc_type: ::brep::cli::options + { + _cli_build_configs_desc_type () + { + ::brep::options::build_configs::fill (*this); + } + }; + + void build_configs:: + fill (::brep::cli::options& os) + { + // build base + // + ::brep::options::build::fill (os); + + // page base + // + ::brep::options::page::fill (os); + + // repository_url base + // + ::brep::options::repository_url::fill (os); + + // handler base + // + ::brep::options::handler::fill (os); + + // build-config-page-entries + // + { + ::brep::cli::option_names a; + std::string dv ("20"); + ::brep::cli::option o ("build-config-page-entries", a, false, dv); + os.push_back (o); + } + + // build-config-pages + // + { + ::brep::cli::option_names a; + std::string dv ("5"); + ::brep::cli::option o ("build-config-pages", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& build_configs:: + description () + { + static _cli_build_configs_desc_type _cli_build_configs_desc_; + return _cli_build_configs_desc_; + } + + typedef + std::map<std::string, void (*) (build_configs&, ::brep::cli::scanner&)> + _cli_build_configs_map; + + static _cli_build_configs_map _cli_build_configs_map_; + + struct _cli_build_configs_map_init + { + _cli_build_configs_map_init () + { + _cli_build_configs_map_["build-config-page-entries"] = + &::brep::cli::thunk< build_configs, uint16_t, &build_configs::build_config_page_entries_, + &build_configs::build_config_page_entries_specified_ >; + _cli_build_configs_map_["build-config-pages"] = + &::brep::cli::thunk< build_configs, uint16_t, &build_configs::build_config_pages_, + &build_configs::build_config_pages_specified_ >; + } + }; + + static _cli_build_configs_map_init _cli_build_configs_map_init_; + + bool build_configs:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_build_configs_map::const_iterator i (_cli_build_configs_map_.find (o)); + + if (i != _cli_build_configs_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // build base + // + if (::brep::options::build::_parse (o, s)) + return true; + + // page base + // + if (::brep::options::page::_parse (o, s)) + return true; + + // repository_url base + // + if (::brep::options::repository_url::_parse (o, s)) + return true; + + // handler base + // + if (::brep::options::handler::_parse (o, s)) + return true; + + return false; + } + + bool build_configs:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // submit + // + + submit:: + submit () + : submit_data_ (), + submit_data_specified_ (false), + submit_temp_ (), + submit_temp_specified_ (false), + submit_max_size_ (10485760), + submit_max_size_specified_ (false), + submit_form_ (), + submit_form_specified_ (false), + submit_email_ (), + submit_email_specified_ (false), + submit_handler_ (), + submit_handler_specified_ (false), + submit_handler_argument_ (), + submit_handler_argument_specified_ (false), + submit_handler_timeout_ (), + submit_handler_timeout_specified_ (false) + { + } + + submit:: + submit (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : submit_data_ (), + submit_data_specified_ (false), + submit_temp_ (), + submit_temp_specified_ (false), + submit_max_size_ (10485760), + submit_max_size_specified_ (false), + submit_form_ (), + submit_form_specified_ (false), + submit_email_ (), + submit_email_specified_ (false), + submit_handler_ (), + submit_handler_specified_ (false), + submit_handler_argument_ (), + submit_handler_argument_specified_ (false), + submit_handler_timeout_ (), + submit_handler_timeout_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + submit:: + submit (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : submit_data_ (), + submit_data_specified_ (false), + submit_temp_ (), + submit_temp_specified_ (false), + submit_max_size_ (10485760), + submit_max_size_specified_ (false), + submit_form_ (), + submit_form_specified_ (false), + submit_email_ (), + submit_email_specified_ (false), + submit_handler_ (), + submit_handler_specified_ (false), + submit_handler_argument_ (), + submit_handler_argument_specified_ (false), + submit_handler_timeout_ (), + submit_handler_timeout_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + submit:: + submit (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : submit_data_ (), + submit_data_specified_ (false), + submit_temp_ (), + submit_temp_specified_ (false), + submit_max_size_ (10485760), + submit_max_size_specified_ (false), + submit_form_ (), + submit_form_specified_ (false), + submit_email_ (), + submit_email_specified_ (false), + submit_handler_ (), + submit_handler_specified_ (false), + submit_handler_argument_ (), + submit_handler_argument_specified_ (false), + submit_handler_timeout_ (), + submit_handler_timeout_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + submit:: + submit (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : submit_data_ (), + submit_data_specified_ (false), + submit_temp_ (), + submit_temp_specified_ (false), + submit_max_size_ (10485760), + submit_max_size_specified_ (false), + submit_form_ (), + submit_form_specified_ (false), + submit_email_ (), + submit_email_specified_ (false), + submit_handler_ (), + submit_handler_specified_ (false), + submit_handler_argument_ (), + submit_handler_argument_specified_ (false), + submit_handler_timeout_ (), + submit_handler_timeout_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + submit:: + submit (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : submit_data_ (), + submit_data_specified_ (false), + submit_temp_ (), + submit_temp_specified_ (false), + submit_max_size_ (10485760), + submit_max_size_specified_ (false), + submit_form_ (), + submit_form_specified_ (false), + submit_email_ (), + submit_email_specified_ (false), + submit_handler_ (), + submit_handler_specified_ (false), + submit_handler_argument_ (), + submit_handler_argument_specified_ (false), + submit_handler_timeout_ (), + submit_handler_timeout_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para submit:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + // page base + // + p = ::brep::options::page::print_usage (os, p); + + // repository_email base + // + p = ::brep::options::repository_email::print_usage (os, p); + + // repository_url base + // + p = ::brep::options::repository_url::print_usage (os, p); + + // handler base + // + p = ::brep::options::handler::print_usage (os, p); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "submit-data <dir> The directory to save final" << ::std::endl + << " submission data to." << ::std::endl; + + os << "submit-temp <dir> The directory to save temporary" << ::std::endl + << " submission data to." << ::std::endl; + + os << "submit-max-size <bytes> The maximum size of the" << ::std::endl + << " submission data accepted." << ::std::endl; + + os << "submit-form <file> The package submission form" << ::std::endl + << " fragment." << ::std::endl; + + os << "submit-email <email> The package submission email." << ::std::endl; + + os << "submit-handler <path> The handler program to be" << ::std::endl + << " executed on package submission." << ::std::endl; + + os << "submit-handler-argument <arg> Additional arguments to be" << ::std::endl + << " passed to the submission handler" << ::std::endl + << " program (see submit-handler for" << ::std::endl + << " details)." << ::std::endl; + + os << "submit-handler-timeout <seconds> The submission handler program" << ::std::endl + << " timeout in seconds." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_submit_desc_type: ::brep::cli::options + { + _cli_submit_desc_type () + { + ::brep::options::submit::fill (*this); + } + }; + + void submit:: + fill (::brep::cli::options& os) + { + // page base + // + ::brep::options::page::fill (os); + + // repository_email base + // + ::brep::options::repository_email::fill (os); + + // repository_url base + // + ::brep::options::repository_url::fill (os); + + // handler base + // + ::brep::options::handler::fill (os); + + // submit-data + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("submit-data", a, false, dv); + os.push_back (o); + } + + // submit-temp + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("submit-temp", a, false, dv); + os.push_back (o); + } + + // submit-max-size + // + { + ::brep::cli::option_names a; + std::string dv ("10485760"); + ::brep::cli::option o ("submit-max-size", a, false, dv); + os.push_back (o); + } + + // submit-form + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("submit-form", a, false, dv); + os.push_back (o); + } + + // submit-email + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("submit-email", a, false, dv); + os.push_back (o); + } + + // submit-handler + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("submit-handler", a, false, dv); + os.push_back (o); + } + + // submit-handler-argument + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("submit-handler-argument", a, false, dv); + os.push_back (o); + } + + // submit-handler-timeout + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("submit-handler-timeout", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& submit:: + description () + { + static _cli_submit_desc_type _cli_submit_desc_; + return _cli_submit_desc_; + } + + typedef + std::map<std::string, void (*) (submit&, ::brep::cli::scanner&)> + _cli_submit_map; + + static _cli_submit_map _cli_submit_map_; + + struct _cli_submit_map_init + { + _cli_submit_map_init () + { + _cli_submit_map_["submit-data"] = + &::brep::cli::thunk< submit, dir_path, &submit::submit_data_, + &submit::submit_data_specified_ >; + _cli_submit_map_["submit-temp"] = + &::brep::cli::thunk< submit, dir_path, &submit::submit_temp_, + &submit::submit_temp_specified_ >; + _cli_submit_map_["submit-max-size"] = + &::brep::cli::thunk< submit, size_t, &submit::submit_max_size_, + &submit::submit_max_size_specified_ >; + _cli_submit_map_["submit-form"] = + &::brep::cli::thunk< submit, path, &submit::submit_form_, + &submit::submit_form_specified_ >; + _cli_submit_map_["submit-email"] = + &::brep::cli::thunk< submit, string, &submit::submit_email_, + &submit::submit_email_specified_ >; + _cli_submit_map_["submit-handler"] = + &::brep::cli::thunk< submit, path, &submit::submit_handler_, + &submit::submit_handler_specified_ >; + _cli_submit_map_["submit-handler-argument"] = + &::brep::cli::thunk< submit, strings, &submit::submit_handler_argument_, + &submit::submit_handler_argument_specified_ >; + _cli_submit_map_["submit-handler-timeout"] = + &::brep::cli::thunk< submit, size_t, &submit::submit_handler_timeout_, + &submit::submit_handler_timeout_specified_ >; + } + }; + + static _cli_submit_map_init _cli_submit_map_init_; + + bool submit:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_submit_map::const_iterator i (_cli_submit_map_.find (o)); + + if (i != _cli_submit_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // page base + // + if (::brep::options::page::_parse (o, s)) + return true; + + // repository_email base + // + if (::brep::options::repository_email::_parse (o, s)) + return true; + + // repository_url base + // + if (::brep::options::repository_url::_parse (o, s)) + return true; + + // handler base + // + if (::brep::options::handler::_parse (o, s)) + return true; + + return false; + } + + bool submit:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // ci_start + // + + ci_start:: + ci_start () + : ci_data_ (), + ci_data_specified_ (false), + ci_email_ (), + ci_email_specified_ (false), + ci_handler_ (), + ci_handler_specified_ (false), + ci_handler_argument_ (), + ci_handler_argument_specified_ (false), + ci_handler_timeout_ (), + ci_handler_timeout_specified_ (false) + { + } + + ci_start:: + ci_start (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : ci_data_ (), + ci_data_specified_ (false), + ci_email_ (), + ci_email_specified_ (false), + ci_handler_ (), + ci_handler_specified_ (false), + ci_handler_argument_ (), + ci_handler_argument_specified_ (false), + ci_handler_timeout_ (), + ci_handler_timeout_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + ci_start:: + ci_start (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : ci_data_ (), + ci_data_specified_ (false), + ci_email_ (), + ci_email_specified_ (false), + ci_handler_ (), + ci_handler_specified_ (false), + ci_handler_argument_ (), + ci_handler_argument_specified_ (false), + ci_handler_timeout_ (), + ci_handler_timeout_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + ci_start:: + ci_start (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : ci_data_ (), + ci_data_specified_ (false), + ci_email_ (), + ci_email_specified_ (false), + ci_handler_ (), + ci_handler_specified_ (false), + ci_handler_argument_ (), + ci_handler_argument_specified_ (false), + ci_handler_timeout_ (), + ci_handler_timeout_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + ci_start:: + ci_start (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : ci_data_ (), + ci_data_specified_ (false), + ci_email_ (), + ci_email_specified_ (false), + ci_handler_ (), + ci_handler_specified_ (false), + ci_handler_argument_ (), + ci_handler_argument_specified_ (false), + ci_handler_timeout_ (), + ci_handler_timeout_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + ci_start:: + ci_start (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : ci_data_ (), + ci_data_specified_ (false), + ci_email_ (), + ci_email_specified_ (false), + ci_handler_ (), + ci_handler_specified_ (false), + ci_handler_argument_ (), + ci_handler_argument_specified_ (false), + ci_handler_timeout_ (), + ci_handler_timeout_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para ci_start:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + // repository_email base + // + p = ::brep::options::repository_email::print_usage (os, p); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "ci-data <dir> The directory to save CI request" << ::std::endl + << " data to." << ::std::endl; + + os << "ci-email <email> The package CI email." << ::std::endl; + + os << "ci-handler <path> The handler program to be" << ::std::endl + << " executed on CI request." << ::std::endl; + + os << "ci-handler-argument <arg> Additional arguments to be" << ::std::endl + << " passed to the CI handler program" << ::std::endl + << " (see ci-handler for details)." << ::std::endl; + + os << "ci-handler-timeout <seconds> The CI handler program timeout" << ::std::endl + << " in seconds." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_ci_start_desc_type: ::brep::cli::options + { + _cli_ci_start_desc_type () + { + ::brep::options::ci_start::fill (*this); + } + }; + + void ci_start:: + fill (::brep::cli::options& os) + { + // repository_email base + // + ::brep::options::repository_email::fill (os); + + // ci-data + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("ci-data", a, false, dv); + os.push_back (o); + } + + // ci-email + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("ci-email", a, false, dv); + os.push_back (o); + } + + // ci-handler + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("ci-handler", a, false, dv); + os.push_back (o); + } + + // ci-handler-argument + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("ci-handler-argument", a, false, dv); + os.push_back (o); + } + + // ci-handler-timeout + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("ci-handler-timeout", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& ci_start:: + description () + { + static _cli_ci_start_desc_type _cli_ci_start_desc_; + return _cli_ci_start_desc_; + } + + typedef + std::map<std::string, void (*) (ci_start&, ::brep::cli::scanner&)> + _cli_ci_start_map; + + static _cli_ci_start_map _cli_ci_start_map_; + + struct _cli_ci_start_map_init + { + _cli_ci_start_map_init () + { + _cli_ci_start_map_["ci-data"] = + &::brep::cli::thunk< ci_start, dir_path, &ci_start::ci_data_, + &ci_start::ci_data_specified_ >; + _cli_ci_start_map_["ci-email"] = + &::brep::cli::thunk< ci_start, string, &ci_start::ci_email_, + &ci_start::ci_email_specified_ >; + _cli_ci_start_map_["ci-handler"] = + &::brep::cli::thunk< ci_start, path, &ci_start::ci_handler_, + &ci_start::ci_handler_specified_ >; + _cli_ci_start_map_["ci-handler-argument"] = + &::brep::cli::thunk< ci_start, strings, &ci_start::ci_handler_argument_, + &ci_start::ci_handler_argument_specified_ >; + _cli_ci_start_map_["ci-handler-timeout"] = + &::brep::cli::thunk< ci_start, size_t, &ci_start::ci_handler_timeout_, + &ci_start::ci_handler_timeout_specified_ >; + } + }; + + static _cli_ci_start_map_init _cli_ci_start_map_init_; + + bool ci_start:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_ci_start_map::const_iterator i (_cli_ci_start_map_.find (o)); + + if (i != _cli_ci_start_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // repository_email base + // + if (::brep::options::repository_email::_parse (o, s)) + return true; + + return false; + } + + bool ci_start:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // ci_cancel + // + + ci_cancel:: + ci_cancel () + { + } + + ci_cancel:: + ci_cancel (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + ci_cancel:: + ci_cancel (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + ci_cancel:: + ci_cancel (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + ci_cancel:: + ci_cancel (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + ci_cancel:: + ci_cancel (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para ci_cancel:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + return p; + } + + struct _cli_ci_cancel_desc_type: ::brep::cli::options + { + _cli_ci_cancel_desc_type () + { + ::brep::options::ci_cancel::fill (*this); + } + }; + + void ci_cancel:: + fill (::brep::cli::options&) + { + } + + const ::brep::cli::options& ci_cancel:: + description () + { + static _cli_ci_cancel_desc_type _cli_ci_cancel_desc_; + return _cli_ci_cancel_desc_; + } + + typedef + std::map<std::string, void (*) (ci_cancel&, ::brep::cli::scanner&)> + _cli_ci_cancel_map; + + static _cli_ci_cancel_map _cli_ci_cancel_map_; + + struct _cli_ci_cancel_map_init + { + _cli_ci_cancel_map_init () + { + } + }; + + static _cli_ci_cancel_map_init _cli_ci_cancel_map_init_; + + bool ci_cancel:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_ci_cancel_map::const_iterator i (_cli_ci_cancel_map_.find (o)); + + if (i != _cli_ci_cancel_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool ci_cancel:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // ci + // + + ci:: + ci () + : ci_form_ (), + ci_form_specified_ (false) + { + } + + ci:: + ci (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : ci_form_ (), + ci_form_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + ci:: + ci (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : ci_form_ (), + ci_form_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + ci:: + ci (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : ci_form_ (), + ci_form_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + ci:: + ci (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : ci_form_ (), + ci_form_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + ci:: + ci (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : ci_form_ (), + ci_form_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para ci:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + // ci_start base + // + p = ::brep::options::ci_start::print_usage (os, p); + + // build base + // + p = ::brep::options::build::print_usage (os, p); + + // build_db base + // + p = ::brep::options::build_db::print_usage (os, p); + + // page base + // + p = ::brep::options::page::print_usage (os, p); + + // repository_url base + // + p = ::brep::options::repository_url::print_usage (os, p); + + // handler base + // + p = ::brep::options::handler::print_usage (os, p); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "ci-form <file> The package CI form fragment." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_ci_desc_type: ::brep::cli::options + { + _cli_ci_desc_type () + { + ::brep::options::ci::fill (*this); + } + }; + + void ci:: + fill (::brep::cli::options& os) + { + // ci_start base + // + ::brep::options::ci_start::fill (os); + + // build base + // + ::brep::options::build::fill (os); + + // build_db base + // + ::brep::options::build_db::fill (os); + + // page base + // + ::brep::options::page::fill (os); + + // repository_url base + // + ::brep::options::repository_url::fill (os); + + // handler base + // + ::brep::options::handler::fill (os); + + // ci-form + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("ci-form", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& ci:: + description () + { + static _cli_ci_desc_type _cli_ci_desc_; + return _cli_ci_desc_; + } + + typedef + std::map<std::string, void (*) (ci&, ::brep::cli::scanner&)> + _cli_ci_map; + + static _cli_ci_map _cli_ci_map_; + + struct _cli_ci_map_init + { + _cli_ci_map_init () + { + _cli_ci_map_["ci-form"] = + &::brep::cli::thunk< ci, path, &ci::ci_form_, + &ci::ci_form_specified_ >; + } + }; + + static _cli_ci_map_init _cli_ci_map_init_; + + bool ci:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_ci_map::const_iterator i (_cli_ci_map_.find (o)); + + if (i != _cli_ci_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // ci_start base + // + if (::brep::options::ci_start::_parse (o, s)) + return true; + + // build base + // + if (::brep::options::build::_parse (o, s)) + return true; + + // build_db base + // + if (::brep::options::build_db::_parse (o, s)) + return true; + + // page base + // + if (::brep::options::page::_parse (o, s)) + return true; + + // repository_url base + // + if (::brep::options::repository_url::_parse (o, s)) + return true; + + // handler base + // + if (::brep::options::handler::_parse (o, s)) + return true; + + return false; + } + + bool ci:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // ci_github + // + + ci_github:: + ci_github () + { + } + + ci_github:: + ci_github (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + ci_github:: + ci_github (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + ci_github:: + ci_github (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + ci_github:: + ci_github (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + ci_github:: + ci_github (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para ci_github:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + // ci_start base + // + p = ::brep::options::ci_start::print_usage (os, p); + + // ci_cancel base + // + p = ::brep::options::ci_cancel::print_usage (os, p); + + // build base + // + p = ::brep::options::build::print_usage (os, p); + + // build_db base + // + p = ::brep::options::build_db::print_usage (os, p); + + // handler base + // + p = ::brep::options::handler::print_usage (os, p); + + return p; + } + + struct _cli_ci_github_desc_type: ::brep::cli::options + { + _cli_ci_github_desc_type () + { + ::brep::options::ci_github::fill (*this); + } + }; + + void ci_github:: + fill (::brep::cli::options& os) + { + // ci_start base + // + ::brep::options::ci_start::fill (os); + + // ci_cancel base + // + ::brep::options::ci_cancel::fill (os); + + // build base + // + ::brep::options::build::fill (os); + + // build_db base + // + ::brep::options::build_db::fill (os); + + // handler base + // + ::brep::options::handler::fill (os); + } + + const ::brep::cli::options& ci_github:: + description () + { + static _cli_ci_github_desc_type _cli_ci_github_desc_; + return _cli_ci_github_desc_; + } + + typedef + std::map<std::string, void (*) (ci_github&, ::brep::cli::scanner&)> + _cli_ci_github_map; + + static _cli_ci_github_map _cli_ci_github_map_; + + struct _cli_ci_github_map_init + { + _cli_ci_github_map_init () + { + } + }; + + static _cli_ci_github_map_init _cli_ci_github_map_init_; + + bool ci_github:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_ci_github_map::const_iterator i (_cli_ci_github_map_.find (o)); + + if (i != _cli_ci_github_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // ci_start base + // + if (::brep::options::ci_start::_parse (o, s)) + return true; + + // ci_cancel base + // + if (::brep::options::ci_cancel::_parse (o, s)) + return true; + + // build base + // + if (::brep::options::build::_parse (o, s)) + return true; + + // build_db base + // + if (::brep::options::build_db::_parse (o, s)) + return true; + + // handler base + // + if (::brep::options::handler::_parse (o, s)) + return true; + + return false; + } + + bool ci_github:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // upload + // + + upload:: + upload () + { + } + + upload:: + upload (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + upload:: + upload (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + upload:: + upload (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + upload:: + upload (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + upload:: + upload (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para upload:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + // build base + // + p = ::brep::options::build::print_usage (os, p); + + // build_db base + // + p = ::brep::options::build_db::print_usage (os, p); + + // build_upload base + // + p = ::brep::options::build_upload::print_usage (os, p); + + // repository_email base + // + p = ::brep::options::repository_email::print_usage (os, p); + + // handler base + // + p = ::brep::options::handler::print_usage (os, p); + + return p; + } + + struct _cli_upload_desc_type: ::brep::cli::options + { + _cli_upload_desc_type () + { + ::brep::options::upload::fill (*this); + } + }; + + void upload:: + fill (::brep::cli::options& os) + { + // build base + // + ::brep::options::build::fill (os); + + // build_db base + // + ::brep::options::build_db::fill (os); + + // build_upload base + // + ::brep::options::build_upload::fill (os); + + // repository_email base + // + ::brep::options::repository_email::fill (os); + + // handler base + // + ::brep::options::handler::fill (os); + } + + const ::brep::cli::options& upload:: + description () + { + static _cli_upload_desc_type _cli_upload_desc_; + return _cli_upload_desc_; + } + + typedef + std::map<std::string, void (*) (upload&, ::brep::cli::scanner&)> + _cli_upload_map; + + static _cli_upload_map _cli_upload_map_; + + struct _cli_upload_map_init + { + _cli_upload_map_init () + { + } + }; + + static _cli_upload_map_init _cli_upload_map_init_; + + bool upload:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_upload_map::const_iterator i (_cli_upload_map_.find (o)); + + if (i != _cli_upload_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // build base + // + if (::brep::options::build::_parse (o, s)) + return true; + + // build_db base + // + if (::brep::options::build_db::_parse (o, s)) + return true; + + // build_upload base + // + if (::brep::options::build_upload::_parse (o, s)) + return true; + + // repository_email base + // + if (::brep::options::repository_email::_parse (o, s)) + return true; + + // handler base + // + if (::brep::options::handler::_parse (o, s)) + return true; + + return false; + } + + bool upload:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // repository_root + // + + repository_root:: + repository_root () + : root_global_view_ ("packages"), + root_global_view_specified_ (false), + root_tenant_view_ ("packages"), + root_tenant_view_specified_ (false) + { + } + + repository_root:: + repository_root (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : root_global_view_ ("packages"), + root_global_view_specified_ (false), + root_tenant_view_ ("packages"), + root_tenant_view_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + repository_root:: + repository_root (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : root_global_view_ ("packages"), + root_global_view_specified_ (false), + root_tenant_view_ ("packages"), + root_tenant_view_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + repository_root:: + repository_root (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : root_global_view_ ("packages"), + root_global_view_specified_ (false), + root_tenant_view_ ("packages"), + root_tenant_view_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + repository_root:: + repository_root (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : root_global_view_ ("packages"), + root_global_view_specified_ (false), + root_tenant_view_ ("packages"), + root_tenant_view_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + repository_root:: + repository_root (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : root_global_view_ ("packages"), + root_global_view_specified_ (false), + root_tenant_view_ ("packages"), + root_tenant_view_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para repository_root:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + // repository_url base + // + p = ::brep::options::repository_url::print_usage (os, p); + + // handler base + // + p = ::brep::options::handler::print_usage (os, p); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "root-global-view <service> The default view to display for" << ::std::endl + << " the global repository root." << ::std::endl; + + os << "root-tenant-view <service> The default view to display for" << ::std::endl + << " the tenant repository root." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_repository_root_desc_type: ::brep::cli::options + { + _cli_repository_root_desc_type () + { + ::brep::options::repository_root::fill (*this); + } + }; + + void repository_root:: + fill (::brep::cli::options& os) + { + // repository_url base + // + ::brep::options::repository_url::fill (os); + + // handler base + // + ::brep::options::handler::fill (os); + + // root-global-view + // + { + ::brep::cli::option_names a; + std::string dv ("packages"); + ::brep::cli::option o ("root-global-view", a, false, dv); + os.push_back (o); + } + + // root-tenant-view + // + { + ::brep::cli::option_names a; + std::string dv ("packages"); + ::brep::cli::option o ("root-tenant-view", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& repository_root:: + description () + { + static _cli_repository_root_desc_type _cli_repository_root_desc_; + return _cli_repository_root_desc_; + } + + typedef + std::map<std::string, void (*) (repository_root&, ::brep::cli::scanner&)> + _cli_repository_root_map; + + static _cli_repository_root_map _cli_repository_root_map_; + + struct _cli_repository_root_map_init + { + _cli_repository_root_map_init () + { + _cli_repository_root_map_["root-global-view"] = + &::brep::cli::thunk< repository_root, string, &repository_root::root_global_view_, + &repository_root::root_global_view_specified_ >; + _cli_repository_root_map_["root-tenant-view"] = + &::brep::cli::thunk< repository_root, string, &repository_root::root_tenant_view_, + &repository_root::root_tenant_view_specified_ >; + } + }; + + static _cli_repository_root_map_init _cli_repository_root_map_init_; + + bool repository_root:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_repository_root_map::const_iterator i (_cli_repository_root_map_.find (o)); + + if (i != _cli_repository_root_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // repository_url base + // + if (::brep::options::repository_url::_parse (o, s)) + return true; + + // handler base + // + if (::brep::options::handler::_parse (o, s)) + return true; + + return false; + } + + bool repository_root:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + } + + namespace params + { + // packages + // + + packages:: + packages () + : page_ (), + page_specified_ (false), + q_ (), + q_specified_ (false) + { + } + + packages:: + packages (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : page_ (), + page_specified_ (false), + q_ (), + q_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + packages:: + packages (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : page_ (), + page_specified_ (false), + q_ (), + q_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + packages:: + packages (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : page_ (), + page_specified_ (false), + q_ (), + q_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + packages:: + packages (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : page_ (), + page_specified_ (false), + q_ (), + q_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + packages:: + packages (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : page_ (), + page_specified_ (false), + q_ (), + q_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para packages:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "page|p <arg>" << std::endl; + + os << "q|_ <arg>" << std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_packages_desc_type: ::brep::cli::options + { + _cli_packages_desc_type () + { + ::brep::params::packages::fill (*this); + } + }; + + void packages:: + fill (::brep::cli::options& os) + { + // page + // + { + ::brep::cli::option_names a; + a.push_back ("p"); + std::string dv; + ::brep::cli::option o ("page", a, false, dv); + os.push_back (o); + } + + // q + // + { + ::brep::cli::option_names a; + a.push_back ("_"); + std::string dv; + ::brep::cli::option o ("q", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& packages:: + description () + { + static _cli_packages_desc_type _cli_packages_desc_; + return _cli_packages_desc_; + } + + typedef + std::map<std::string, void (*) (packages&, ::brep::cli::scanner&)> + _cli_packages_map; + + static _cli_packages_map _cli_packages_map_; + + struct _cli_packages_map_init + { + _cli_packages_map_init () + { + _cli_packages_map_["page"] = + &::brep::cli::thunk< packages, uint16_t, &packages::page_, + &packages::page_specified_ >; + _cli_packages_map_["p"] = + &::brep::cli::thunk< packages, uint16_t, &packages::page_, + &packages::page_specified_ >; + _cli_packages_map_["q"] = + &::brep::cli::thunk< packages, string, &packages::q_, + &packages::q_specified_ >; + _cli_packages_map_["_"] = + &::brep::cli::thunk< packages, string, &packages::q_, + &packages::q_specified_ >; + } + }; + + static _cli_packages_map_init _cli_packages_map_init_; + + bool packages:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_packages_map::const_iterator i (_cli_packages_map_.find (o)); + + if (i != _cli_packages_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool packages:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // package_details + // + + package_details:: + package_details () + : page_ (), + page_specified_ (false), + query_ (), + query_specified_ (false), + form_ (page_form::brief), + form_specified_ (false) + { + } + + package_details:: + package_details (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : page_ (), + page_specified_ (false), + query_ (), + query_specified_ (false), + form_ (page_form::brief), + form_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + package_details:: + package_details (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : page_ (), + page_specified_ (false), + query_ (), + query_specified_ (false), + form_ (page_form::brief), + form_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + package_details:: + package_details (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : page_ (), + page_specified_ (false), + query_ (), + query_specified_ (false), + form_ (page_form::brief), + form_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + package_details:: + package_details (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : page_ (), + page_specified_ (false), + query_ (), + query_specified_ (false), + form_ (page_form::brief), + form_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + package_details:: + package_details (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : page_ (), + page_specified_ (false), + query_ (), + query_specified_ (false), + form_ (page_form::brief), + form_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para package_details:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "page|p <arg>" << std::endl; + + os << "query|q <arg>" << std::endl; + + os << "form|f <arg>" << std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_package_details_desc_type: ::brep::cli::options + { + _cli_package_details_desc_type () + { + ::brep::params::package_details::fill (*this); + } + }; + + void package_details:: + fill (::brep::cli::options& os) + { + // page + // + { + ::brep::cli::option_names a; + a.push_back ("p"); + std::string dv; + ::brep::cli::option o ("page", a, false, dv); + os.push_back (o); + } + + // query + // + { + ::brep::cli::option_names a; + a.push_back ("q"); + std::string dv; + ::brep::cli::option o ("query", a, false, dv); + os.push_back (o); + } + + // form + // + { + ::brep::cli::option_names a; + a.push_back ("f"); + std::string dv; + ::brep::cli::option o ("form", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& package_details:: + description () + { + static _cli_package_details_desc_type _cli_package_details_desc_; + return _cli_package_details_desc_; + } + + typedef + std::map<std::string, void (*) (package_details&, ::brep::cli::scanner&)> + _cli_package_details_map; + + static _cli_package_details_map _cli_package_details_map_; + + struct _cli_package_details_map_init + { + _cli_package_details_map_init () + { + _cli_package_details_map_["page"] = + &::brep::cli::thunk< package_details, uint16_t, &package_details::page_, + &package_details::page_specified_ >; + _cli_package_details_map_["p"] = + &::brep::cli::thunk< package_details, uint16_t, &package_details::page_, + &package_details::page_specified_ >; + _cli_package_details_map_["query"] = + &::brep::cli::thunk< package_details, string, &package_details::query_, + &package_details::query_specified_ >; + _cli_package_details_map_["q"] = + &::brep::cli::thunk< package_details, string, &package_details::query_, + &package_details::query_specified_ >; + _cli_package_details_map_["form"] = + &::brep::cli::thunk< package_details, page_form, &package_details::form_, + &package_details::form_specified_ >; + _cli_package_details_map_["f"] = + &::brep::cli::thunk< package_details, page_form, &package_details::form_, + &package_details::form_specified_ >; + } + }; + + static _cli_package_details_map_init _cli_package_details_map_init_; + + bool package_details:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_package_details_map::const_iterator i (_cli_package_details_map_.find (o)); + + if (i != _cli_package_details_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool package_details:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // package_version_details + // + + package_version_details:: + package_version_details () + : form_ (page_form::brief), + form_specified_ (false) + { + } + + package_version_details:: + package_version_details (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : form_ (page_form::brief), + form_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + package_version_details:: + package_version_details (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : form_ (page_form::brief), + form_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + package_version_details:: + package_version_details (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : form_ (page_form::brief), + form_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + package_version_details:: + package_version_details (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : form_ (page_form::brief), + form_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + package_version_details:: + package_version_details (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : form_ (page_form::brief), + form_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para package_version_details:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "form|f <arg>" << std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_package_version_details_desc_type: ::brep::cli::options + { + _cli_package_version_details_desc_type () + { + ::brep::params::package_version_details::fill (*this); + } + }; + + void package_version_details:: + fill (::brep::cli::options& os) + { + // form + // + { + ::brep::cli::option_names a; + a.push_back ("f"); + std::string dv; + ::brep::cli::option o ("form", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& package_version_details:: + description () + { + static _cli_package_version_details_desc_type _cli_package_version_details_desc_; + return _cli_package_version_details_desc_; + } + + typedef + std::map<std::string, void (*) (package_version_details&, ::brep::cli::scanner&)> + _cli_package_version_details_map; + + static _cli_package_version_details_map _cli_package_version_details_map_; + + struct _cli_package_version_details_map_init + { + _cli_package_version_details_map_init () + { + _cli_package_version_details_map_["form"] = + &::brep::cli::thunk< package_version_details, page_form, &package_version_details::form_, + &package_version_details::form_specified_ >; + _cli_package_version_details_map_["f"] = + &::brep::cli::thunk< package_version_details, page_form, &package_version_details::form_, + &package_version_details::form_specified_ >; + } + }; + + static _cli_package_version_details_map_init _cli_package_version_details_map_init_; + + bool package_version_details:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_package_version_details_map::const_iterator i (_cli_package_version_details_map_.find (o)); + + if (i != _cli_package_version_details_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool package_version_details:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // repository_details + // + + repository_details:: + repository_details () + { + } + + repository_details:: + repository_details (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + repository_details:: + repository_details (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + repository_details:: + repository_details (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + repository_details:: + repository_details (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + repository_details:: + repository_details (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para repository_details:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + return p; + } + + struct _cli_repository_details_desc_type: ::brep::cli::options + { + _cli_repository_details_desc_type () + { + ::brep::params::repository_details::fill (*this); + } + }; + + void repository_details:: + fill (::brep::cli::options&) + { + } + + const ::brep::cli::options& repository_details:: + description () + { + static _cli_repository_details_desc_type _cli_repository_details_desc_; + return _cli_repository_details_desc_; + } + + typedef + std::map<std::string, void (*) (repository_details&, ::brep::cli::scanner&)> + _cli_repository_details_map; + + static _cli_repository_details_map _cli_repository_details_map_; + + struct _cli_repository_details_map_init + { + _cli_repository_details_map_init () + { + } + }; + + static _cli_repository_details_map_init _cli_repository_details_map_init_; + + bool repository_details:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_repository_details_map::const_iterator i (_cli_repository_details_map_.find (o)); + + if (i != _cli_repository_details_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool repository_details:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // build_task + // + + build_task:: + build_task () + : repository_ (), + repository_specified_ (false), + interactive_ (bbot::interactive_mode::both), + interactive_specified_ (false) + { + } + + build_task:: + build_task (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : repository_ (), + repository_specified_ (false), + interactive_ (bbot::interactive_mode::both), + interactive_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + build_task:: + build_task (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : repository_ (), + repository_specified_ (false), + interactive_ (bbot::interactive_mode::both), + interactive_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + build_task:: + build_task (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : repository_ (), + repository_specified_ (false), + interactive_ (bbot::interactive_mode::both), + interactive_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_task:: + build_task (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : repository_ (), + repository_specified_ (false), + interactive_ (bbot::interactive_mode::both), + interactive_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_task:: + build_task (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : repository_ (), + repository_specified_ (false), + interactive_ (bbot::interactive_mode::both), + interactive_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para build_task:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "repository|r <arg>" << std::endl; + + os << "interactive <arg>" << std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_build_task_desc_type: ::brep::cli::options + { + _cli_build_task_desc_type () + { + ::brep::params::build_task::fill (*this); + } + }; + + void build_task:: + fill (::brep::cli::options& os) + { + // repository + // + { + ::brep::cli::option_names a; + a.push_back ("r"); + std::string dv; + ::brep::cli::option o ("repository", a, false, dv); + os.push_back (o); + } + + // interactive + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("interactive", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& build_task:: + description () + { + static _cli_build_task_desc_type _cli_build_task_desc_; + return _cli_build_task_desc_; + } + + typedef + std::map<std::string, void (*) (build_task&, ::brep::cli::scanner&)> + _cli_build_task_map; + + static _cli_build_task_map _cli_build_task_map_; + + struct _cli_build_task_map_init + { + _cli_build_task_map_init () + { + _cli_build_task_map_["repository"] = + &::brep::cli::thunk< build_task, vector<string>, &build_task::repository_, + &build_task::repository_specified_ >; + _cli_build_task_map_["r"] = + &::brep::cli::thunk< build_task, vector<string>, &build_task::repository_, + &build_task::repository_specified_ >; + _cli_build_task_map_["interactive"] = + &::brep::cli::thunk< build_task, bbot::interactive_mode, &build_task::interactive_, + &build_task::interactive_specified_ >; + } + }; + + static _cli_build_task_map_init _cli_build_task_map_init_; + + bool build_task:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_build_task_map::const_iterator i (_cli_build_task_map_.find (o)); + + if (i != _cli_build_task_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool build_task:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // build_result + // + + build_result:: + build_result () + { + } + + build_result:: + build_result (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + build_result:: + build_result (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + build_result:: + build_result (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_result:: + build_result (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_result:: + build_result (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para build_result:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + return p; + } + + struct _cli_build_result_desc_type: ::brep::cli::options + { + _cli_build_result_desc_type () + { + ::brep::params::build_result::fill (*this); + } + }; + + void build_result:: + fill (::brep::cli::options&) + { + } + + const ::brep::cli::options& build_result:: + description () + { + static _cli_build_result_desc_type _cli_build_result_desc_; + return _cli_build_result_desc_; + } + + typedef + std::map<std::string, void (*) (build_result&, ::brep::cli::scanner&)> + _cli_build_result_map; + + static _cli_build_result_map _cli_build_result_map_; + + struct _cli_build_result_map_init + { + _cli_build_result_map_init () + { + } + }; + + static _cli_build_result_map_init _cli_build_result_map_init_; + + bool build_result:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_build_result_map::const_iterator i (_cli_build_result_map_.find (o)); + + if (i != _cli_build_result_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool build_result:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // build_log + // + + build_log:: + build_log () + { + } + + build_log:: + build_log (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + build_log:: + build_log (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + build_log:: + build_log (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_log:: + build_log (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_log:: + build_log (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para build_log:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + return p; + } + + struct _cli_build_log_desc_type: ::brep::cli::options + { + _cli_build_log_desc_type () + { + ::brep::params::build_log::fill (*this); + } + }; + + void build_log:: + fill (::brep::cli::options&) + { + } + + const ::brep::cli::options& build_log:: + description () + { + static _cli_build_log_desc_type _cli_build_log_desc_; + return _cli_build_log_desc_; + } + + typedef + std::map<std::string, void (*) (build_log&, ::brep::cli::scanner&)> + _cli_build_log_map; + + static _cli_build_log_map _cli_build_log_map_; + + struct _cli_build_log_map_init + { + _cli_build_log_map_init () + { + } + }; + + static _cli_build_log_map_init _cli_build_log_map_init_; + + bool build_log:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_build_log_map::const_iterator i (_cli_build_log_map_.find (o)); + + if (i != _cli_build_log_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool build_log:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // build_force + // + + build_force:: + build_force () + : package_ (), + package_specified_ (false), + version_ (), + version_specified_ (false), + target_ (), + target_specified_ (false), + target_config_ (), + target_config_specified_ (false), + package_config_ (), + package_config_specified_ (false), + toolchain_name_ (), + toolchain_name_specified_ (false), + toolchain_version_ (), + toolchain_version_specified_ (false), + reason_ (), + reason_specified_ (false) + { + } + + build_force:: + build_force (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : package_ (), + package_specified_ (false), + version_ (), + version_specified_ (false), + target_ (), + target_specified_ (false), + target_config_ (), + target_config_specified_ (false), + package_config_ (), + package_config_specified_ (false), + toolchain_name_ (), + toolchain_name_specified_ (false), + toolchain_version_ (), + toolchain_version_specified_ (false), + reason_ (), + reason_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + build_force:: + build_force (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : package_ (), + package_specified_ (false), + version_ (), + version_specified_ (false), + target_ (), + target_specified_ (false), + target_config_ (), + target_config_specified_ (false), + package_config_ (), + package_config_specified_ (false), + toolchain_name_ (), + toolchain_name_specified_ (false), + toolchain_version_ (), + toolchain_version_specified_ (false), + reason_ (), + reason_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + build_force:: + build_force (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : package_ (), + package_specified_ (false), + version_ (), + version_specified_ (false), + target_ (), + target_specified_ (false), + target_config_ (), + target_config_specified_ (false), + package_config_ (), + package_config_specified_ (false), + toolchain_name_ (), + toolchain_name_specified_ (false), + toolchain_version_ (), + toolchain_version_specified_ (false), + reason_ (), + reason_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_force:: + build_force (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : package_ (), + package_specified_ (false), + version_ (), + version_specified_ (false), + target_ (), + target_specified_ (false), + target_config_ (), + target_config_specified_ (false), + package_config_ (), + package_config_specified_ (false), + toolchain_name_ (), + toolchain_name_specified_ (false), + toolchain_version_ (), + toolchain_version_specified_ (false), + reason_ (), + reason_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_force:: + build_force (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : package_ (), + package_specified_ (false), + version_ (), + version_specified_ (false), + target_ (), + target_specified_ (false), + target_config_ (), + target_config_specified_ (false), + package_config_ (), + package_config_specified_ (false), + toolchain_name_ (), + toolchain_name_specified_ (false), + toolchain_version_ (), + toolchain_version_specified_ (false), + reason_ (), + reason_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para build_force:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "package|pn <arg>" << std::endl; + + os << "version|pv <arg>" << std::endl; + + os << "target|tg <arg>" << std::endl; + + os << "target_config|tc <arg>" << std::endl; + + os << "package_config|pc <arg>" << std::endl; + + os << "toolchain_name|tn <arg>" << std::endl; + + os << "toolchain_version|tv <arg>" << std::endl; + + os << "reason <arg>" << std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_build_force_desc_type: ::brep::cli::options + { + _cli_build_force_desc_type () + { + ::brep::params::build_force::fill (*this); + } + }; + + void build_force:: + fill (::brep::cli::options& os) + { + // package + // + { + ::brep::cli::option_names a; + a.push_back ("pn"); + std::string dv; + ::brep::cli::option o ("package", a, false, dv); + os.push_back (o); + } + + // version + // + { + ::brep::cli::option_names a; + a.push_back ("pv"); + std::string dv; + ::brep::cli::option o ("version", a, false, dv); + os.push_back (o); + } + + // target + // + { + ::brep::cli::option_names a; + a.push_back ("tg"); + std::string dv; + ::brep::cli::option o ("target", a, false, dv); + os.push_back (o); + } + + // target_config + // + { + ::brep::cli::option_names a; + a.push_back ("tc"); + std::string dv; + ::brep::cli::option o ("target_config", a, false, dv); + os.push_back (o); + } + + // package_config + // + { + ::brep::cli::option_names a; + a.push_back ("pc"); + std::string dv; + ::brep::cli::option o ("package_config", a, false, dv); + os.push_back (o); + } + + // toolchain_name + // + { + ::brep::cli::option_names a; + a.push_back ("tn"); + std::string dv; + ::brep::cli::option o ("toolchain_name", a, false, dv); + os.push_back (o); + } + + // toolchain_version + // + { + ::brep::cli::option_names a; + a.push_back ("tv"); + std::string dv; + ::brep::cli::option o ("toolchain_version", a, false, dv); + os.push_back (o); + } + + // reason + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("reason", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& build_force:: + description () + { + static _cli_build_force_desc_type _cli_build_force_desc_; + return _cli_build_force_desc_; + } + + typedef + std::map<std::string, void (*) (build_force&, ::brep::cli::scanner&)> + _cli_build_force_map; + + static _cli_build_force_map _cli_build_force_map_; + + struct _cli_build_force_map_init + { + _cli_build_force_map_init () + { + _cli_build_force_map_["package"] = + &::brep::cli::thunk< build_force, string, &build_force::package_, + &build_force::package_specified_ >; + _cli_build_force_map_["pn"] = + &::brep::cli::thunk< build_force, string, &build_force::package_, + &build_force::package_specified_ >; + _cli_build_force_map_["version"] = + &::brep::cli::thunk< build_force, string, &build_force::version_, + &build_force::version_specified_ >; + _cli_build_force_map_["pv"] = + &::brep::cli::thunk< build_force, string, &build_force::version_, + &build_force::version_specified_ >; + _cli_build_force_map_["target"] = + &::brep::cli::thunk< build_force, string, &build_force::target_, + &build_force::target_specified_ >; + _cli_build_force_map_["tg"] = + &::brep::cli::thunk< build_force, string, &build_force::target_, + &build_force::target_specified_ >; + _cli_build_force_map_["target_config"] = + &::brep::cli::thunk< build_force, string, &build_force::target_config_, + &build_force::target_config_specified_ >; + _cli_build_force_map_["tc"] = + &::brep::cli::thunk< build_force, string, &build_force::target_config_, + &build_force::target_config_specified_ >; + _cli_build_force_map_["package_config"] = + &::brep::cli::thunk< build_force, string, &build_force::package_config_, + &build_force::package_config_specified_ >; + _cli_build_force_map_["pc"] = + &::brep::cli::thunk< build_force, string, &build_force::package_config_, + &build_force::package_config_specified_ >; + _cli_build_force_map_["toolchain_name"] = + &::brep::cli::thunk< build_force, string, &build_force::toolchain_name_, + &build_force::toolchain_name_specified_ >; + _cli_build_force_map_["tn"] = + &::brep::cli::thunk< build_force, string, &build_force::toolchain_name_, + &build_force::toolchain_name_specified_ >; + _cli_build_force_map_["toolchain_version"] = + &::brep::cli::thunk< build_force, string, &build_force::toolchain_version_, + &build_force::toolchain_version_specified_ >; + _cli_build_force_map_["tv"] = + &::brep::cli::thunk< build_force, string, &build_force::toolchain_version_, + &build_force::toolchain_version_specified_ >; + _cli_build_force_map_["reason"] = + &::brep::cli::thunk< build_force, string, &build_force::reason_, + &build_force::reason_specified_ >; + } + }; + + static _cli_build_force_map_init _cli_build_force_map_init_; + + bool build_force:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_build_force_map::const_iterator i (_cli_build_force_map_.find (o)); + + if (i != _cli_build_force_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool build_force:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // builds + // + + builds:: + builds () + : page_ (), + page_specified_ (false), + name_ (), + name_specified_ (false), + version_ (), + version_specified_ (false), + toolchain_ ("*"), + toolchain_specified_ (false), + target_ (), + target_specified_ (false), + target_config_ (), + target_config_specified_ (false), + package_config_ (), + package_config_specified_ (false), + result_ ("*"), + result_specified_ (false) + { + } + + builds:: + builds (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : page_ (), + page_specified_ (false), + name_ (), + name_specified_ (false), + version_ (), + version_specified_ (false), + toolchain_ ("*"), + toolchain_specified_ (false), + target_ (), + target_specified_ (false), + target_config_ (), + target_config_specified_ (false), + package_config_ (), + package_config_specified_ (false), + result_ ("*"), + result_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + builds:: + builds (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : page_ (), + page_specified_ (false), + name_ (), + name_specified_ (false), + version_ (), + version_specified_ (false), + toolchain_ ("*"), + toolchain_specified_ (false), + target_ (), + target_specified_ (false), + target_config_ (), + target_config_specified_ (false), + package_config_ (), + package_config_specified_ (false), + result_ ("*"), + result_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + builds:: + builds (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : page_ (), + page_specified_ (false), + name_ (), + name_specified_ (false), + version_ (), + version_specified_ (false), + toolchain_ ("*"), + toolchain_specified_ (false), + target_ (), + target_specified_ (false), + target_config_ (), + target_config_specified_ (false), + package_config_ (), + package_config_specified_ (false), + result_ ("*"), + result_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + builds:: + builds (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : page_ (), + page_specified_ (false), + name_ (), + name_specified_ (false), + version_ (), + version_specified_ (false), + toolchain_ ("*"), + toolchain_specified_ (false), + target_ (), + target_specified_ (false), + target_config_ (), + target_config_specified_ (false), + package_config_ (), + package_config_specified_ (false), + result_ ("*"), + result_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + builds:: + builds (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : page_ (), + page_specified_ (false), + name_ (), + name_specified_ (false), + version_ (), + version_specified_ (false), + toolchain_ ("*"), + toolchain_specified_ (false), + target_ (), + target_specified_ (false), + target_config_ (), + target_config_specified_ (false), + package_config_ (), + package_config_specified_ (false), + result_ ("*"), + result_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para builds:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "page|p <arg>" << std::endl; + + os << "name|_ <arg>" << std::endl; + + os << "version|pv <arg>" << std::endl; + + os << "toolchain|th <arg>" << std::endl; + + os << "target|tg <arg>" << std::endl; + + os << "target_config|tc <arg>" << std::endl; + + os << "package_config|pc <arg>" << std::endl; + + os << "result|rs <arg>" << std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_builds_desc_type: ::brep::cli::options + { + _cli_builds_desc_type () + { + ::brep::params::builds::fill (*this); + } + }; + + void builds:: + fill (::brep::cli::options& os) + { + // page + // + { + ::brep::cli::option_names a; + a.push_back ("p"); + std::string dv; + ::brep::cli::option o ("page", a, false, dv); + os.push_back (o); + } + + // name + // + { + ::brep::cli::option_names a; + a.push_back ("_"); + std::string dv; + ::brep::cli::option o ("name", a, false, dv); + os.push_back (o); + } + + // version + // + { + ::brep::cli::option_names a; + a.push_back ("pv"); + std::string dv; + ::brep::cli::option o ("version", a, false, dv); + os.push_back (o); + } + + // toolchain + // + { + ::brep::cli::option_names a; + a.push_back ("th"); + std::string dv ("*"); + ::brep::cli::option o ("toolchain", a, false, dv); + os.push_back (o); + } + + // target + // + { + ::brep::cli::option_names a; + a.push_back ("tg"); + std::string dv; + ::brep::cli::option o ("target", a, false, dv); + os.push_back (o); + } + + // target_config + // + { + ::brep::cli::option_names a; + a.push_back ("tc"); + std::string dv; + ::brep::cli::option o ("target_config", a, false, dv); + os.push_back (o); + } + + // package_config + // + { + ::brep::cli::option_names a; + a.push_back ("pc"); + std::string dv; + ::brep::cli::option o ("package_config", a, false, dv); + os.push_back (o); + } + + // result + // + { + ::brep::cli::option_names a; + a.push_back ("rs"); + std::string dv ("*"); + ::brep::cli::option o ("result", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& builds:: + description () + { + static _cli_builds_desc_type _cli_builds_desc_; + return _cli_builds_desc_; + } + + typedef + std::map<std::string, void (*) (builds&, ::brep::cli::scanner&)> + _cli_builds_map; + + static _cli_builds_map _cli_builds_map_; + + struct _cli_builds_map_init + { + _cli_builds_map_init () + { + _cli_builds_map_["page"] = + &::brep::cli::thunk< builds, uint16_t, &builds::page_, + &builds::page_specified_ >; + _cli_builds_map_["p"] = + &::brep::cli::thunk< builds, uint16_t, &builds::page_, + &builds::page_specified_ >; + _cli_builds_map_["name"] = + &::brep::cli::thunk< builds, string, &builds::name_, + &builds::name_specified_ >; + _cli_builds_map_["_"] = + &::brep::cli::thunk< builds, string, &builds::name_, + &builds::name_specified_ >; + _cli_builds_map_["version"] = + &::brep::cli::thunk< builds, string, &builds::version_, + &builds::version_specified_ >; + _cli_builds_map_["pv"] = + &::brep::cli::thunk< builds, string, &builds::version_, + &builds::version_specified_ >; + _cli_builds_map_["toolchain"] = + &::brep::cli::thunk< builds, string, &builds::toolchain_, + &builds::toolchain_specified_ >; + _cli_builds_map_["th"] = + &::brep::cli::thunk< builds, string, &builds::toolchain_, + &builds::toolchain_specified_ >; + _cli_builds_map_["target"] = + &::brep::cli::thunk< builds, string, &builds::target_, + &builds::target_specified_ >; + _cli_builds_map_["tg"] = + &::brep::cli::thunk< builds, string, &builds::target_, + &builds::target_specified_ >; + _cli_builds_map_["target_config"] = + &::brep::cli::thunk< builds, string, &builds::target_config_, + &builds::target_config_specified_ >; + _cli_builds_map_["tc"] = + &::brep::cli::thunk< builds, string, &builds::target_config_, + &builds::target_config_specified_ >; + _cli_builds_map_["package_config"] = + &::brep::cli::thunk< builds, string, &builds::package_config_, + &builds::package_config_specified_ >; + _cli_builds_map_["pc"] = + &::brep::cli::thunk< builds, string, &builds::package_config_, + &builds::package_config_specified_ >; + _cli_builds_map_["result"] = + &::brep::cli::thunk< builds, string, &builds::result_, + &builds::result_specified_ >; + _cli_builds_map_["rs"] = + &::brep::cli::thunk< builds, string, &builds::result_, + &builds::result_specified_ >; + } + }; + + static _cli_builds_map_init _cli_builds_map_init_; + + bool builds:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_builds_map::const_iterator i (_cli_builds_map_.find (o)); + + if (i != _cli_builds_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool builds:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // build_configs + // + + build_configs:: + build_configs () + : class_name_ (), + class_name_specified_ (false), + page_ (), + page_specified_ (false) + { + } + + build_configs:: + build_configs (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : class_name_ (), + class_name_specified_ (false), + page_ (), + page_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + build_configs:: + build_configs (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : class_name_ (), + class_name_specified_ (false), + page_ (), + page_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + build_configs:: + build_configs (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : class_name_ (), + class_name_specified_ (false), + page_ (), + page_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_configs:: + build_configs (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : class_name_ (), + class_name_specified_ (false), + page_ (), + page_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_configs:: + build_configs (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : class_name_ (), + class_name_specified_ (false), + page_ (), + page_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para build_configs:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "class_name|_ <arg>" << std::endl; + + os << "page|p <arg>" << std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_build_configs_desc_type: ::brep::cli::options + { + _cli_build_configs_desc_type () + { + ::brep::params::build_configs::fill (*this); + } + }; + + void build_configs:: + fill (::brep::cli::options& os) + { + // class_name + // + { + ::brep::cli::option_names a; + a.push_back ("_"); + std::string dv; + ::brep::cli::option o ("class_name", a, false, dv); + os.push_back (o); + } + + // page + // + { + ::brep::cli::option_names a; + a.push_back ("p"); + std::string dv; + ::brep::cli::option o ("page", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& build_configs:: + description () + { + static _cli_build_configs_desc_type _cli_build_configs_desc_; + return _cli_build_configs_desc_; + } + + typedef + std::map<std::string, void (*) (build_configs&, ::brep::cli::scanner&)> + _cli_build_configs_map; + + static _cli_build_configs_map _cli_build_configs_map_; + + struct _cli_build_configs_map_init + { + _cli_build_configs_map_init () + { + _cli_build_configs_map_["class_name"] = + &::brep::cli::thunk< build_configs, string, &build_configs::class_name_, + &build_configs::class_name_specified_ >; + _cli_build_configs_map_["_"] = + &::brep::cli::thunk< build_configs, string, &build_configs::class_name_, + &build_configs::class_name_specified_ >; + _cli_build_configs_map_["page"] = + &::brep::cli::thunk< build_configs, uint16_t, &build_configs::page_, + &build_configs::page_specified_ >; + _cli_build_configs_map_["p"] = + &::brep::cli::thunk< build_configs, uint16_t, &build_configs::page_, + &build_configs::page_specified_ >; + } + }; + + static _cli_build_configs_map_init _cli_build_configs_map_init_; + + bool build_configs:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_build_configs_map::const_iterator i (_cli_build_configs_map_.find (o)); + + if (i != _cli_build_configs_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool build_configs:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // submit + // + + submit:: + submit () + : archive_ (), + archive_specified_ (false), + sha256sum_ (), + sha256sum_specified_ (false), + simulate_ (), + simulate_specified_ (false) + { + } + + submit:: + submit (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : archive_ (), + archive_specified_ (false), + sha256sum_ (), + sha256sum_specified_ (false), + simulate_ (), + simulate_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + submit:: + submit (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : archive_ (), + archive_specified_ (false), + sha256sum_ (), + sha256sum_specified_ (false), + simulate_ (), + simulate_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + submit:: + submit (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : archive_ (), + archive_specified_ (false), + sha256sum_ (), + sha256sum_specified_ (false), + simulate_ (), + simulate_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + submit:: + submit (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : archive_ (), + archive_specified_ (false), + sha256sum_ (), + sha256sum_specified_ (false), + simulate_ (), + simulate_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + submit:: + submit (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : archive_ (), + archive_specified_ (false), + sha256sum_ (), + sha256sum_specified_ (false), + simulate_ (), + simulate_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para submit:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "archive <arg>" << std::endl; + + os << "sha256sum <arg>" << std::endl; + + os << "simulate <arg>" << std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_submit_desc_type: ::brep::cli::options + { + _cli_submit_desc_type () + { + ::brep::params::submit::fill (*this); + } + }; + + void submit:: + fill (::brep::cli::options& os) + { + // archive + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("archive", a, false, dv); + os.push_back (o); + } + + // sha256sum + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("sha256sum", a, false, dv); + os.push_back (o); + } + + // simulate + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("simulate", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& submit:: + description () + { + static _cli_submit_desc_type _cli_submit_desc_; + return _cli_submit_desc_; + } + + typedef + std::map<std::string, void (*) (submit&, ::brep::cli::scanner&)> + _cli_submit_map; + + static _cli_submit_map _cli_submit_map_; + + struct _cli_submit_map_init + { + _cli_submit_map_init () + { + _cli_submit_map_["archive"] = + &::brep::cli::thunk< submit, string, &submit::archive_, + &submit::archive_specified_ >; + _cli_submit_map_["sha256sum"] = + &::brep::cli::thunk< submit, string, &submit::sha256sum_, + &submit::sha256sum_specified_ >; + _cli_submit_map_["simulate"] = + &::brep::cli::thunk< submit, string, &submit::simulate_, + &submit::simulate_specified_ >; + } + }; + + static _cli_submit_map_init _cli_submit_map_init_; + + bool submit:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_submit_map::const_iterator i (_cli_submit_map_.find (o)); + + if (i != _cli_submit_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool submit:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // ci + // + + ci:: + ci () + : repository_ (), + repository_specified_ (false), + package_ (), + package_specified_ (false), + overrides_ (), + overrides_specified_ (false), + interactive_ (), + interactive_specified_ (false), + simulate_ (), + simulate_specified_ (false) + { + } + + ci:: + ci (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : repository_ (), + repository_specified_ (false), + package_ (), + package_specified_ (false), + overrides_ (), + overrides_specified_ (false), + interactive_ (), + interactive_specified_ (false), + simulate_ (), + simulate_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + ci:: + ci (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : repository_ (), + repository_specified_ (false), + package_ (), + package_specified_ (false), + overrides_ (), + overrides_specified_ (false), + interactive_ (), + interactive_specified_ (false), + simulate_ (), + simulate_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + ci:: + ci (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : repository_ (), + repository_specified_ (false), + package_ (), + package_specified_ (false), + overrides_ (), + overrides_specified_ (false), + interactive_ (), + interactive_specified_ (false), + simulate_ (), + simulate_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + ci:: + ci (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : repository_ (), + repository_specified_ (false), + package_ (), + package_specified_ (false), + overrides_ (), + overrides_specified_ (false), + interactive_ (), + interactive_specified_ (false), + simulate_ (), + simulate_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + ci:: + ci (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : repository_ (), + repository_specified_ (false), + package_ (), + package_specified_ (false), + overrides_ (), + overrides_specified_ (false), + interactive_ (), + interactive_specified_ (false), + simulate_ (), + simulate_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para ci:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "repository|_ <arg>" << std::endl; + + os << "package <arg>" << std::endl; + + os << "overrides <arg>" << std::endl; + + os << "interactive <arg>" << std::endl; + + os << "simulate <arg>" << std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_ci_desc_type: ::brep::cli::options + { + _cli_ci_desc_type () + { + ::brep::params::ci::fill (*this); + } + }; + + void ci:: + fill (::brep::cli::options& os) + { + // repository + // + { + ::brep::cli::option_names a; + a.push_back ("_"); + std::string dv; + ::brep::cli::option o ("repository", a, false, dv); + os.push_back (o); + } + + // package + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("package", a, false, dv); + os.push_back (o); + } + + // overrides + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("overrides", a, false, dv); + os.push_back (o); + } + + // interactive + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("interactive", a, false, dv); + os.push_back (o); + } + + // simulate + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("simulate", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& ci:: + description () + { + static _cli_ci_desc_type _cli_ci_desc_; + return _cli_ci_desc_; + } + + typedef + std::map<std::string, void (*) (ci&, ::brep::cli::scanner&)> + _cli_ci_map; + + static _cli_ci_map _cli_ci_map_; + + struct _cli_ci_map_init + { + _cli_ci_map_init () + { + _cli_ci_map_["repository"] = + &::brep::cli::thunk< ci, bpkg::repository_location, &ci::repository_, + &ci::repository_specified_ >; + _cli_ci_map_["_"] = + &::brep::cli::thunk< ci, bpkg::repository_location, &ci::repository_, + &ci::repository_specified_ >; + _cli_ci_map_["package"] = + &::brep::cli::thunk< ci, strings, &ci::package_, + &ci::package_specified_ >; + _cli_ci_map_["overrides"] = + &::brep::cli::thunk< ci, string, &ci::overrides_, + &ci::overrides_specified_ >; + _cli_ci_map_["interactive"] = + &::brep::cli::thunk< ci, string, &ci::interactive_, + &ci::interactive_specified_ >; + _cli_ci_map_["simulate"] = + &::brep::cli::thunk< ci, string, &ci::simulate_, + &ci::simulate_specified_ >; + } + }; + + static _cli_ci_map_init _cli_ci_map_init_; + + bool ci:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_ci_map::const_iterator i (_cli_ci_map_.find (o)); + + if (i != _cli_ci_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool ci:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // upload + // + + upload:: + upload () + : type_ (), + type_specified_ (false), + session_ (), + session_specified_ (false), + challenge_ (), + challenge_specified_ (false), + instance_ (), + instance_specified_ (false), + archive_ (), + archive_specified_ (false), + sha256sum_ (), + sha256sum_specified_ (false) + { + } + + upload:: + upload (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : type_ (), + type_specified_ (false), + session_ (), + session_specified_ (false), + challenge_ (), + challenge_specified_ (false), + instance_ (), + instance_specified_ (false), + archive_ (), + archive_specified_ (false), + sha256sum_ (), + sha256sum_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + upload:: + upload (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : type_ (), + type_specified_ (false), + session_ (), + session_specified_ (false), + challenge_ (), + challenge_specified_ (false), + instance_ (), + instance_specified_ (false), + archive_ (), + archive_specified_ (false), + sha256sum_ (), + sha256sum_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + upload:: + upload (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : type_ (), + type_specified_ (false), + session_ (), + session_specified_ (false), + challenge_ (), + challenge_specified_ (false), + instance_ (), + instance_specified_ (false), + archive_ (), + archive_specified_ (false), + sha256sum_ (), + sha256sum_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + upload:: + upload (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : type_ (), + type_specified_ (false), + session_ (), + session_specified_ (false), + challenge_ (), + challenge_specified_ (false), + instance_ (), + instance_specified_ (false), + archive_ (), + archive_specified_ (false), + sha256sum_ (), + sha256sum_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + upload:: + upload (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : type_ (), + type_specified_ (false), + session_ (), + session_specified_ (false), + challenge_ (), + challenge_specified_ (false), + instance_ (), + instance_specified_ (false), + archive_ (), + archive_specified_ (false), + sha256sum_ (), + sha256sum_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para upload:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "type|_ <arg>" << std::endl; + + os << "session <arg>" << std::endl; + + os << "challenge <arg>" << std::endl; + + os << "instance <arg>" << std::endl; + + os << "archive <arg>" << std::endl; + + os << "sha256sum <arg>" << std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_upload_desc_type: ::brep::cli::options + { + _cli_upload_desc_type () + { + ::brep::params::upload::fill (*this); + } + }; + + void upload:: + fill (::brep::cli::options& os) + { + // type + // + { + ::brep::cli::option_names a; + a.push_back ("_"); + std::string dv; + ::brep::cli::option o ("type", a, false, dv); + os.push_back (o); + } + + // session + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("session", a, false, dv); + os.push_back (o); + } + + // challenge + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("challenge", a, false, dv); + os.push_back (o); + } + + // instance + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("instance", a, false, dv); + os.push_back (o); + } + + // archive + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("archive", a, false, dv); + os.push_back (o); + } + + // sha256sum + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("sha256sum", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& upload:: + description () + { + static _cli_upload_desc_type _cli_upload_desc_; + return _cli_upload_desc_; + } + + typedef + std::map<std::string, void (*) (upload&, ::brep::cli::scanner&)> + _cli_upload_map; + + static _cli_upload_map _cli_upload_map_; + + struct _cli_upload_map_init + { + _cli_upload_map_init () + { + _cli_upload_map_["type"] = + &::brep::cli::thunk< upload, string, &upload::type_, + &upload::type_specified_ >; + _cli_upload_map_["_"] = + &::brep::cli::thunk< upload, string, &upload::type_, + &upload::type_specified_ >; + _cli_upload_map_["session"] = + &::brep::cli::thunk< upload, string, &upload::session_, + &upload::session_specified_ >; + _cli_upload_map_["challenge"] = + &::brep::cli::thunk< upload, string, &upload::challenge_, + &upload::challenge_specified_ >; + _cli_upload_map_["instance"] = + &::brep::cli::thunk< upload, string, &upload::instance_, + &upload::instance_specified_ >; + _cli_upload_map_["archive"] = + &::brep::cli::thunk< upload, string, &upload::archive_, + &upload::archive_specified_ >; + _cli_upload_map_["sha256sum"] = + &::brep::cli::thunk< upload, string, &upload::sha256sum_, + &upload::sha256sum_specified_ >; + } + }; + + static _cli_upload_map_init _cli_upload_map_init_; + + bool upload:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_upload_map::const_iterator i (_cli_upload_map_.find (o)); + + if (i != _cli_upload_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool upload:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + 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; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + } +} + +// Begin epilogue. +// +// +// End epilogue. + diff --git a/mod/module-options.hxx b/mod/module-options.hxx new file mode 100644 index 0000000..f321bf3 --- /dev/null +++ b/mod/module-options.hxx @@ -0,0 +1,5543 @@ +// -*- C++ -*- +// +// This file was generated by CLI, a command line interface +// compiler for C++. +// + +#ifndef MOD_MODULE_OPTIONS_HXX +#define MOD_MODULE_OPTIONS_HXX + +// Begin prologue. +// +// +// End prologue. + +#include <list> +#include <deque> +#include <map> +#include <vector> +#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 brep +{ + 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 () noexcept; + + unknown_option (const std::string& option); + + const std::string& + option () const; + + virtual void + print (::std::ostream&) const; + + virtual const char* + what () const noexcept; + + private: + std::string option_; + }; + + class unknown_argument: public exception + { + public: + virtual + ~unknown_argument () noexcept; + + unknown_argument (const std::string& argument); + + const std::string& + argument () const; + + virtual void + print (::std::ostream&) const; + + virtual const char* + what () const noexcept; + + private: + std::string argument_; + }; + + class missing_value: public exception + { + public: + virtual + ~missing_value () noexcept; + + missing_value (const std::string& option); + + const std::string& + option () const; + + virtual void + print (::std::ostream&) const; + + virtual const char* + what () const noexcept; + + private: + std::string option_; + }; + + class invalid_value: public exception + { + public: + virtual + ~invalid_value () noexcept; + + 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 noexcept; + + 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 noexcept; + }; + + class file_io_failure: public exception + { + public: + virtual + ~file_io_failure () noexcept; + + file_io_failure (const std::string& file); + + const std::string& + file () const; + + virtual void + print (::std::ostream&) const; + + virtual const char* + what () const noexcept; + + private: + std::string file_; + }; + + class unmatched_quote: public exception + { + public: + virtual + ~unmatched_quote () noexcept; + + unmatched_quote (const std::string& argument); + + const std::string& + argument () const; + + virtual void + print (::std::ostream&) const; + + virtual const char* + what () const noexcept; + + private: + std::string argument_; + }; + + // 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(). + // + // The position() function returns a monotonically-increasing + // number which, if stored, can later be used to determine the + // relative position of the argument returned by the following + // call to next(). Note that if multiple scanners are used to + // extract arguments from multiple sources, then the end + // position of the previous scanner should be used as the + // start position of the next. + // + class scanner + { + public: + virtual + ~scanner (); + + virtual bool + more () = 0; + + virtual const char* + peek () = 0; + + virtual const char* + next () = 0; + + virtual void + skip () = 0; + + virtual std::size_t + position () = 0; + }; + + class argv_scanner: public scanner + { + public: + argv_scanner (int& argc, + char** argv, + bool erase = false, + std::size_t start_position = 0); + + argv_scanner (int start, + int& argc, + char** argv, + bool erase = false, + std::size_t start_position = 0); + + int + end () const; + + virtual bool + more (); + + virtual const char* + peek (); + + virtual const char* + next (); + + virtual void + skip (); + + virtual std::size_t + position (); + + protected: + std::size_t start_position_; + int i_; + int& argc_; + char** argv_; + bool erase_; + }; + + class argv_file_scanner: public argv_scanner + { + public: + argv_file_scanner (int& argc, + char** argv, + const std::string& option, + bool erase = false, + std::size_t start_position = 0); + + argv_file_scanner (int start, + int& argc, + char** argv, + const std::string& option, + bool erase = false, + std::size_t start_position = 0); + + argv_file_scanner (const std::string& file, + const std::string& option, + std::size_t start_position = 0); + + struct option_info + { + // If search_func is not NULL, it is called, with the arg + // value as the second argument, to locate the options file. + // If it returns an empty string, then the file is ignored. + // + const char* option; + std::string (*search_func) (const char*, void* arg); + void* arg; + }; + + argv_file_scanner (int& argc, + char** argv, + const option_info* options, + std::size_t options_count, + bool erase = false, + std::size_t start_position = 0); + + argv_file_scanner (int start, + int& argc, + char** argv, + const option_info* options, + std::size_t options_count, + bool erase = false, + std::size_t start_position = 0); + + argv_file_scanner (const std::string& file, + const option_info* options = 0, + std::size_t options_count = 0, + std::size_t start_position = 0); + + virtual bool + more (); + + virtual const char* + peek (); + + virtual const char* + next (); + + virtual void + skip (); + + virtual std::size_t + position (); + + // Return the file path if the peeked at argument came from a file and + // the empty string otherwise. The reference is guaranteed to be valid + // till the end of the scanner lifetime. + // + const std::string& + peek_file (); + + // Return the 1-based line number if the peeked at argument came from + // a file and zero otherwise. + // + std::size_t + peek_line (); + + private: + const option_info* + find (const char*) const; + + void + load (const std::string& file); + + typedef argv_scanner base; + + const std::string option_; + option_info option_info_; + const option_info* options_; + std::size_t options_count_; + + struct arg + { + std::string value; + const std::string* file; + std::size_t line; + }; + + std::deque<arg> args_; + std::list<std::string> files_; + + // Circular buffer of two arguments. + // + std::string hold_[2]; + std::size_t i_; + + bool skip_; + + static int zero_argc_; + static std::string empty_string_; + }; + + typedef std::vector<std::string> option_names; + + class option + { + public: + + const std::string& + name () const; + + const option_names& + aliases () const; + + bool + flag () const; + + const std::string& + default_value () const; + + public:option (); + option (const std::string& name, + const option_names& aliases, + bool flag, + const std::string& default_value); + + private: + std::string name_; + option_names aliases_; + bool flag_; + std::string default_value_; + }; + + class options: public std::vector<option> + { + public: + typedef std::vector<option> container_type; + + container_type::const_iterator + find (const std::string& name) const; + + void + push_back (const option&); + private: + typedef std::map<std::string, container_type::size_type> map_type; + map_type map_; + }; + + template <typename X> + struct parser; + } +} + +#include <map> + +#include <regex> + +#include <libbpkg/manifest.hxx> + +#include <libbbot/manifest.hxx> + +#include <web/xhtml/fragment.hxx> + +#include <libbrep/types.hxx> + +#include <mod/options-types.hxx> + +namespace brep +{ + namespace options + { + class repository_email + { + public: + repository_email (); + + repository_email (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + repository_email (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + repository_email (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + repository_email (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + repository_email (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + const string& + email () const; + + string& + email (); + + void + email (const string&); + + bool + email_specified () const; + + void + email_specified (bool); + + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_repository_email_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + string email_; + bool email_specified_; + }; + + class repository_url + { + public: + repository_url (); + + repository_url (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + repository_url (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + repository_url (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + repository_url (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + repository_url (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + const string& + host () const; + + string& + host (); + + void + host (const string&); + + bool + host_specified () const; + + void + host_specified (bool); + + const dir_path& + root () const; + + dir_path& + root (); + + void + root (const dir_path&); + + bool + root_specified () const; + + void + root_specified (bool); + + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_repository_url_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + string host_; + bool host_specified_; + dir_path root_; + bool root_specified_; + }; + + class build_email_notification: public ::brep::options::repository_email, + public ::brep::options::repository_url + { + public: + build_email_notification (); + + build_email_notification (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_email_notification (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_email_notification (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_email_notification (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_email_notification (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + const std::map<string, build_email>& + build_toolchain_email () const; + + std::map<string, build_email>& + build_toolchain_email (); + + void + build_toolchain_email (const std::map<string, build_email>&); + + bool + build_toolchain_email_specified () const; + + void + build_toolchain_email_specified (bool); + + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_build_email_notification_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + std::map<string, build_email> build_toolchain_email_; + bool build_toolchain_email_specified_; + }; + + class handler + { + public: + handler (); + + handler (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + handler (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + handler (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + handler (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + handler (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + const string& + tenant_name () const; + + string& + tenant_name (); + + void + tenant_name (const string&); + + bool + tenant_name_specified () const; + + void + tenant_name_specified (bool); + + const uint16_t& + verbosity () const; + + uint16_t& + verbosity (); + + void + verbosity (const uint16_t&); + + bool + verbosity_specified () const; + + void + verbosity_specified (bool); + + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_handler_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + string tenant_name_; + bool tenant_name_specified_; + uint16_t verbosity_; + bool verbosity_specified_; + }; + + class openssl_options + { + public: + openssl_options (); + + openssl_options (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + openssl_options (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + openssl_options (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + openssl_options (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + openssl_options (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + const path& + openssl () const; + + path& + openssl (); + + void + openssl (const path&); + + bool + openssl_specified () const; + + void + openssl_specified (bool); + + const strings& + openssl_option () const; + + strings& + openssl_option (); + + void + openssl_option (const strings&); + + bool + openssl_option_specified () const; + + void + openssl_option_specified (bool); + + const strings& + openssl_envvar () const; + + strings& + openssl_envvar (); + + void + openssl_envvar (const strings&); + + bool + openssl_envvar_specified () const; + + void + openssl_envvar_specified (bool); + + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_openssl_options_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + path openssl_; + bool openssl_specified_; + strings openssl_option_; + bool openssl_option_specified_; + strings openssl_envvar_; + bool openssl_envvar_specified_; + }; + + class package_db + { + public: + package_db (); + + package_db (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + package_db (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + package_db (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + package_db (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + package_db (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + const string& + package_db_user () const; + + string& + package_db_user (); + + void + package_db_user (const string&); + + bool + package_db_user_specified () const; + + void + package_db_user_specified (bool); + + const string& + package_db_role () const; + + string& + package_db_role (); + + void + package_db_role (const string&); + + bool + package_db_role_specified () const; + + void + package_db_role_specified (bool); + + const string& + package_db_password () const; + + string& + package_db_password (); + + void + package_db_password (const string&); + + bool + package_db_password_specified () const; + + void + package_db_password_specified (bool); + + const string& + package_db_name () const; + + string& + package_db_name (); + + void + package_db_name (const string&); + + bool + package_db_name_specified () const; + + void + package_db_name_specified (bool); + + const string& + package_db_host () const; + + string& + package_db_host (); + + void + package_db_host (const string&); + + bool + package_db_host_specified () const; + + void + package_db_host_specified (bool); + + const uint16_t& + package_db_port () const; + + uint16_t& + package_db_port (); + + void + package_db_port (const uint16_t&); + + bool + package_db_port_specified () const; + + void + package_db_port_specified (bool); + + const size_t& + package_db_max_connections () const; + + size_t& + package_db_max_connections (); + + void + package_db_max_connections (const size_t&); + + bool + package_db_max_connections_specified () const; + + void + package_db_max_connections_specified (bool); + + const size_t& + package_db_retry () const; + + size_t& + package_db_retry (); + + void + package_db_retry (const size_t&); + + bool + package_db_retry_specified () const; + + void + package_db_retry_specified (bool); + + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_package_db_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + string package_db_user_; + bool package_db_user_specified_; + string package_db_role_; + bool package_db_role_specified_; + string package_db_password_; + bool package_db_password_specified_; + string package_db_name_; + bool package_db_name_specified_; + string package_db_host_; + bool package_db_host_specified_; + uint16_t package_db_port_; + bool package_db_port_specified_; + size_t package_db_max_connections_; + bool package_db_max_connections_specified_; + size_t package_db_retry_; + bool package_db_retry_specified_; + }; + + class build: public ::brep::options::openssl_options + { + public: + build (); + + build (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + const path& + build_config () const; + + path& + build_config (); + + void + build_config (const path&); + + bool + build_config_specified () const; + + void + build_config_specified (bool); + + const dir_path& + build_bot_agent_keys () const; + + dir_path& + build_bot_agent_keys (); + + void + build_bot_agent_keys (const dir_path&); + + bool + build_bot_agent_keys_specified () const; + + void + build_bot_agent_keys_specified (bool); + + const size_t& + build_forced_rebuild_timeout () const; + + size_t& + build_forced_rebuild_timeout (); + + void + build_forced_rebuild_timeout (const size_t&); + + bool + build_forced_rebuild_timeout_specified () const; + + void + build_forced_rebuild_timeout_specified (bool); + + const size_t& + build_soft_rebuild_timeout () const; + + size_t& + build_soft_rebuild_timeout (); + + void + build_soft_rebuild_timeout (const size_t&); + + bool + build_soft_rebuild_timeout_specified () const; + + void + build_soft_rebuild_timeout_specified (bool); + + const size_t& + build_alt_soft_rebuild_timeout () const; + + size_t& + build_alt_soft_rebuild_timeout (); + + void + build_alt_soft_rebuild_timeout (const size_t&); + + bool + build_alt_soft_rebuild_timeout_specified () const; + + void + build_alt_soft_rebuild_timeout_specified (bool); + + const duration& + build_alt_soft_rebuild_start () const; + + duration& + build_alt_soft_rebuild_start (); + + void + build_alt_soft_rebuild_start (const duration&); + + bool + build_alt_soft_rebuild_start_specified () const; + + void + build_alt_soft_rebuild_start_specified (bool); + + const duration& + build_alt_soft_rebuild_stop () const; + + duration& + build_alt_soft_rebuild_stop (); + + void + build_alt_soft_rebuild_stop (const duration&); + + bool + build_alt_soft_rebuild_stop_specified () const; + + void + build_alt_soft_rebuild_stop_specified (bool); + + const size_t& + build_hard_rebuild_timeout () const; + + size_t& + build_hard_rebuild_timeout (); + + void + build_hard_rebuild_timeout (const size_t&); + + bool + build_hard_rebuild_timeout_specified () const; + + void + build_hard_rebuild_timeout_specified (bool); + + const size_t& + build_alt_hard_rebuild_timeout () const; + + size_t& + build_alt_hard_rebuild_timeout (); + + void + build_alt_hard_rebuild_timeout (const size_t&); + + bool + build_alt_hard_rebuild_timeout_specified () const; + + void + build_alt_hard_rebuild_timeout_specified (bool); + + const duration& + build_alt_hard_rebuild_start () const; + + duration& + build_alt_hard_rebuild_start (); + + void + build_alt_hard_rebuild_start (const duration&); + + bool + build_alt_hard_rebuild_start_specified () const; + + void + build_alt_hard_rebuild_start_specified (bool); + + const duration& + build_alt_hard_rebuild_stop () const; + + duration& + build_alt_hard_rebuild_stop (); + + void + build_alt_hard_rebuild_stop (const duration&); + + bool + build_alt_hard_rebuild_stop_specified () const; + + void + build_alt_hard_rebuild_stop_specified (bool); + + const size_t& + build_queued_timeout () const; + + size_t& + build_queued_timeout (); + + void + build_queued_timeout (const size_t&); + + bool + build_queued_timeout_specified () const; + + void + build_queued_timeout_specified (bool); + + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_build_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + path build_config_; + bool build_config_specified_; + dir_path build_bot_agent_keys_; + bool build_bot_agent_keys_specified_; + size_t build_forced_rebuild_timeout_; + bool build_forced_rebuild_timeout_specified_; + size_t build_soft_rebuild_timeout_; + bool build_soft_rebuild_timeout_specified_; + size_t build_alt_soft_rebuild_timeout_; + bool build_alt_soft_rebuild_timeout_specified_; + duration build_alt_soft_rebuild_start_; + bool build_alt_soft_rebuild_start_specified_; + duration build_alt_soft_rebuild_stop_; + bool build_alt_soft_rebuild_stop_specified_; + size_t build_hard_rebuild_timeout_; + bool build_hard_rebuild_timeout_specified_; + size_t build_alt_hard_rebuild_timeout_; + bool build_alt_hard_rebuild_timeout_specified_; + duration build_alt_hard_rebuild_start_; + bool build_alt_hard_rebuild_start_specified_; + duration build_alt_hard_rebuild_stop_; + bool build_alt_hard_rebuild_stop_specified_; + size_t build_queued_timeout_; + bool build_queued_timeout_specified_; + }; + + class build_db + { + public: + build_db (); + + build_db (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_db (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_db (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_db (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_db (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + const string& + build_db_user () const; + + string& + build_db_user (); + + void + build_db_user (const string&); + + bool + build_db_user_specified () const; + + void + build_db_user_specified (bool); + + const string& + build_db_role () const; + + string& + build_db_role (); + + void + build_db_role (const string&); + + bool + build_db_role_specified () const; + + void + build_db_role_specified (bool); + + const string& + build_db_password () const; + + string& + build_db_password (); + + void + build_db_password (const string&); + + bool + build_db_password_specified () const; + + void + build_db_password_specified (bool); + + const string& + build_db_name () const; + + string& + build_db_name (); + + void + build_db_name (const string&); + + bool + build_db_name_specified () const; + + void + build_db_name_specified (bool); + + const string& + build_db_host () const; + + string& + build_db_host (); + + void + build_db_host (const string&); + + bool + build_db_host_specified () const; + + void + build_db_host_specified (bool); + + const uint16_t& + build_db_port () const; + + uint16_t& + build_db_port (); + + void + build_db_port (const uint16_t&); + + bool + build_db_port_specified () const; + + void + build_db_port_specified (bool); + + const size_t& + build_db_max_connections () const; + + size_t& + build_db_max_connections (); + + void + build_db_max_connections (const size_t&); + + bool + build_db_max_connections_specified () const; + + void + build_db_max_connections_specified (bool); + + const size_t& + build_db_retry () const; + + size_t& + build_db_retry (); + + void + build_db_retry (const size_t&); + + bool + build_db_retry_specified () const; + + void + build_db_retry_specified (bool); + + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_build_db_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + string build_db_user_; + bool build_db_user_specified_; + string build_db_role_; + bool build_db_role_specified_; + string build_db_password_; + bool build_db_password_specified_; + string build_db_name_; + bool build_db_name_specified_; + string build_db_host_; + bool build_db_host_specified_; + uint16_t build_db_port_; + bool build_db_port_specified_; + size_t build_db_max_connections_; + bool build_db_max_connections_specified_; + size_t build_db_retry_; + bool build_db_retry_specified_; + }; + + class build_upload + { + public: + build_upload (); + + build_upload (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_upload (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_upload (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_upload (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_upload (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + const std::map<string, dir_path>& + upload_data () const; + + std::map<string, dir_path>& + upload_data (); + + void + upload_data (const std::map<string, dir_path>&); + + bool + upload_data_specified () const; + + void + upload_data_specified (bool); + + const std::map<string, size_t>& + upload_max_size () const; + + std::map<string, size_t>& + upload_max_size (); + + void + upload_max_size (const std::map<string, size_t>&); + + bool + upload_max_size_specified () const; + + void + upload_max_size_specified (bool); + + const std::map<string, string>& + upload_email () const; + + std::map<string, string>& + upload_email (); + + void + upload_email (const std::map<string, string>&); + + bool + upload_email_specified () const; + + void + upload_email_specified (bool); + + const std::map<string, path>& + upload_handler () const; + + std::map<string, path>& + upload_handler (); + + void + upload_handler (const std::map<string, path>&); + + bool + upload_handler_specified () const; + + void + upload_handler_specified (bool); + + const std::multimap<string, string>& + upload_handler_argument () const; + + std::multimap<string, string>& + upload_handler_argument (); + + void + upload_handler_argument (const std::multimap<string, string>&); + + bool + upload_handler_argument_specified () const; + + void + upload_handler_argument_specified (bool); + + const std::map<string, size_t>& + upload_handler_timeout () const; + + std::map<string, size_t>& + upload_handler_timeout (); + + void + upload_handler_timeout (const std::map<string, size_t>&); + + bool + upload_handler_timeout_specified () const; + + void + upload_handler_timeout_specified (bool); + + const std::multimap<string, string>& + upload_toolchain_exclude () const; + + std::multimap<string, string>& + upload_toolchain_exclude (); + + void + upload_toolchain_exclude (const std::multimap<string, string>&); + + bool + upload_toolchain_exclude_specified () const; + + void + upload_toolchain_exclude_specified (bool); + + const std::multimap<string, string>& + upload_repository_exclude () const; + + std::multimap<string, string>& + upload_repository_exclude (); + + void + upload_repository_exclude (const std::multimap<string, string>&); + + bool + upload_repository_exclude_specified () const; + + void + upload_repository_exclude_specified (bool); + + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_build_upload_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + std::map<string, dir_path> upload_data_; + bool upload_data_specified_; + std::map<string, size_t> upload_max_size_; + bool upload_max_size_specified_; + std::map<string, string> upload_email_; + bool upload_email_specified_; + std::map<string, path> upload_handler_; + bool upload_handler_specified_; + std::multimap<string, string> upload_handler_argument_; + bool upload_handler_argument_specified_; + std::map<string, size_t> upload_handler_timeout_; + bool upload_handler_timeout_specified_; + std::multimap<string, string> upload_toolchain_exclude_; + bool upload_toolchain_exclude_specified_; + std::multimap<string, string> upload_repository_exclude_; + bool upload_repository_exclude_specified_; + }; + + class page + { + public: + page (); + + page (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + page (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + page (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + page (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + page (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + const web::xhtml::fragment& + logo () const; + + web::xhtml::fragment& + logo (); + + void + logo (const web::xhtml::fragment&); + + bool + logo_specified () const; + + void + logo_specified (bool); + + const vector<page_menu>& + menu () const; + + vector<page_menu>& + menu (); + + void + menu (const vector<page_menu>&); + + bool + menu_specified () const; + + void + menu_specified (bool); + + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_page_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + web::xhtml::fragment logo_; + bool logo_specified_; + vector<page_menu> menu_; + bool menu_specified_; + }; + + class search + { + public: + search (); + + search (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + search (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + search (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + search (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + search (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + const uint16_t& + search_page_entries () const; + + uint16_t& + search_page_entries (); + + void + search_page_entries (const uint16_t&); + + bool + search_page_entries_specified () const; + + void + search_page_entries_specified (bool); + + const uint16_t& + search_pages () const; + + uint16_t& + search_pages (); + + void + search_pages (const uint16_t&); + + bool + search_pages_specified () const; + + void + search_pages_specified (bool); + + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_search_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + uint16_t search_page_entries_; + bool search_page_entries_specified_; + uint16_t search_pages_; + bool search_pages_specified_; + }; + + class package + { + public: + package (); + + package (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + package (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + package (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + package (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + package (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + const uint16_t& + package_description () const; + + uint16_t& + package_description (); + + void + package_description (const uint16_t&); + + bool + package_description_specified () const; + + void + package_description_specified (bool); + + const uint16_t& + package_changes () const; + + uint16_t& + package_changes (); + + void + package_changes (const uint16_t&); + + bool + package_changes_specified () const; + + void + package_changes_specified (bool); + + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_package_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + uint16_t package_description_; + bool package_description_specified_; + uint16_t package_changes_; + bool package_changes_specified_; + }; + + class packages: public ::brep::options::search, + public ::brep::options::package_db, + public ::brep::options::page, + public ::brep::options::repository_url, + public ::brep::options::handler + { + public: + packages (); + + packages (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + packages (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + packages (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + packages (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + packages (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + const string& + search_title () const; + + string& + search_title (); + + void + search_title (const string&); + + bool + search_title_specified () const; + + void + search_title_specified (bool); + + const web::xhtml::fragment& + search_description () const; + + web::xhtml::fragment& + search_description (); + + void + search_description (const web::xhtml::fragment&); + + bool + search_description_specified () const; + + void + search_description_specified (bool); + + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_packages_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + string search_title_; + bool search_title_specified_; + web::xhtml::fragment search_description_; + bool search_description_specified_; + }; + + class package_details: public ::brep::options::package, + public ::brep::options::package_db, + public ::brep::options::search, + public ::brep::options::page, + public ::brep::options::repository_url, + public ::brep::options::handler + { + public: + package_details (); + + package_details (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + package_details (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + package_details (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + package_details (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + package_details (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_package_details_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + }; + + class package_version_details: public ::brep::options::package, + public ::brep::options::package_db, + public ::brep::options::build, + public ::brep::options::build_db, + public ::brep::options::page, + public ::brep::options::repository_url, + public ::brep::options::handler + { + public: + package_version_details (); + + package_version_details (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + package_version_details (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + package_version_details (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + package_version_details (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + package_version_details (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + const dir_path& + bindist_root () const; + + dir_path& + bindist_root (); + + void + bindist_root (const dir_path&); + + bool + bindist_root_specified () const; + + void + bindist_root_specified (bool); + + const string& + bindist_url () const; + + string& + bindist_url (); + + void + bindist_url (const string&); + + bool + bindist_url_specified () const; + + void + bindist_url_specified (bool); + + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_package_version_details_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + dir_path bindist_root_; + bool bindist_root_specified_; + string bindist_url_; + bool bindist_url_specified_; + }; + + class repository_details: public ::brep::options::package_db, + public ::brep::options::page, + public ::brep::options::repository_url, + public ::brep::options::handler + { + public: + repository_details (); + + repository_details (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + repository_details (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + repository_details (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + repository_details (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + repository_details (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_repository_details_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + }; + + class build_task: public ::brep::options::build, + public ::brep::options::build_db, + public ::brep::options::build_upload, + public ::brep::options::build_email_notification, + public ::brep::options::handler + { + public: + build_task (); + + build_task (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_task (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_task (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_task (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_task (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + const size_t& + build_task_request_max_size () const; + + size_t& + build_task_request_max_size (); + + void + build_task_request_max_size (const size_t&); + + bool + build_task_request_max_size_specified () const; + + void + build_task_request_max_size_specified (bool); + + const size_t& + build_result_timeout () const; + + size_t& + build_result_timeout (); + + void + build_result_timeout (const size_t&); + + bool + build_result_timeout_specified () const; + + void + build_result_timeout_specified (bool); + + const vector<pair<std::regex, string>>& + build_interactive_login () const; + + vector<pair<std::regex, string>>& + build_interactive_login (); + + void + build_interactive_login (const vector<pair<std::regex, string>>&); + + bool + build_interactive_login_specified () const; + + void + build_interactive_login_specified (bool); + + const build_order& + build_package_order () const; + + build_order& + build_package_order (); + + void + build_package_order (const build_order&); + + bool + build_package_order_specified () const; + + void + build_package_order_specified (bool); + + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_build_task_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + size_t build_task_request_max_size_; + bool build_task_request_max_size_specified_; + size_t build_result_timeout_; + bool build_result_timeout_specified_; + vector<pair<std::regex, string>> build_interactive_login_; + bool build_interactive_login_specified_; + build_order build_package_order_; + bool build_package_order_specified_; + }; + + class build_result: public ::brep::options::build, + public ::brep::options::build_db, + public ::brep::options::build_email_notification, + public ::brep::options::handler + { + public: + build_result (); + + build_result (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_result (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_result (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_result (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_result (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + const size_t& + build_result_request_max_size () const; + + size_t& + build_result_request_max_size (); + + void + build_result_request_max_size (const size_t&); + + bool + build_result_request_max_size_specified () const; + + void + build_result_request_max_size_specified (bool); + + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_build_result_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + size_t build_result_request_max_size_; + bool build_result_request_max_size_specified_; + }; + + class build_log: public ::brep::options::build, + public ::brep::options::build_db, + public ::brep::options::repository_url, + public ::brep::options::handler + { + public: + build_log (); + + build_log (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_log (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_log (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_log (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_log (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_build_log_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + }; + + class build_force: public ::brep::options::build, + public ::brep::options::build_db, + public ::brep::options::handler + { + public: + build_force (); + + build_force (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_force (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_force (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_force (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_force (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_build_force_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + }; + + class builds: public ::brep::options::build, + public ::brep::options::build_db, + public ::brep::options::page, + public ::brep::options::repository_url, + public ::brep::options::handler + { + public: + builds (); + + builds (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + builds (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + builds (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + builds (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + builds (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + const uint16_t& + build_page_entries () const; + + uint16_t& + build_page_entries (); + + void + build_page_entries (const uint16_t&); + + bool + build_page_entries_specified () const; + + void + build_page_entries_specified (bool); + + const uint16_t& + build_pages () const; + + uint16_t& + build_pages (); + + void + build_pages (const uint16_t&); + + bool + build_pages_specified () const; + + void + build_pages_specified (bool); + + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_builds_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + uint16_t build_page_entries_; + bool build_page_entries_specified_; + uint16_t build_pages_; + bool build_pages_specified_; + }; + + class build_configs: public ::brep::options::build, + public ::brep::options::page, + public ::brep::options::repository_url, + public ::brep::options::handler + { + public: + build_configs (); + + build_configs (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_configs (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_configs (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_configs (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_configs (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + const uint16_t& + build_config_page_entries () const; + + uint16_t& + build_config_page_entries (); + + void + build_config_page_entries (const uint16_t&); + + bool + build_config_page_entries_specified () const; + + void + build_config_page_entries_specified (bool); + + const uint16_t& + build_config_pages () const; + + uint16_t& + build_config_pages (); + + void + build_config_pages (const uint16_t&); + + bool + build_config_pages_specified () const; + + void + build_config_pages_specified (bool); + + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_build_configs_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + uint16_t build_config_page_entries_; + bool build_config_page_entries_specified_; + uint16_t build_config_pages_; + bool build_config_pages_specified_; + }; + + class submit: public ::brep::options::page, + public ::brep::options::repository_email, + public ::brep::options::repository_url, + public ::brep::options::handler + { + public: + submit (); + + submit (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + submit (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + submit (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + submit (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + submit (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + const dir_path& + submit_data () const; + + dir_path& + submit_data (); + + void + submit_data (const dir_path&); + + bool + submit_data_specified () const; + + void + submit_data_specified (bool); + + const dir_path& + submit_temp () const; + + dir_path& + submit_temp (); + + void + submit_temp (const dir_path&); + + bool + submit_temp_specified () const; + + void + submit_temp_specified (bool); + + const size_t& + submit_max_size () const; + + size_t& + submit_max_size (); + + void + submit_max_size (const size_t&); + + bool + submit_max_size_specified () const; + + void + submit_max_size_specified (bool); + + const path& + submit_form () const; + + path& + submit_form (); + + void + submit_form (const path&); + + bool + submit_form_specified () const; + + void + submit_form_specified (bool); + + const string& + submit_email () const; + + string& + submit_email (); + + void + submit_email (const string&); + + bool + submit_email_specified () const; + + void + submit_email_specified (bool); + + const path& + submit_handler () const; + + path& + submit_handler (); + + void + submit_handler (const path&); + + bool + submit_handler_specified () const; + + void + submit_handler_specified (bool); + + const strings& + submit_handler_argument () const; + + strings& + submit_handler_argument (); + + void + submit_handler_argument (const strings&); + + bool + submit_handler_argument_specified () const; + + void + submit_handler_argument_specified (bool); + + const size_t& + submit_handler_timeout () const; + + size_t& + submit_handler_timeout (); + + void + submit_handler_timeout (const size_t&); + + bool + submit_handler_timeout_specified () const; + + void + submit_handler_timeout_specified (bool); + + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_submit_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + dir_path submit_data_; + bool submit_data_specified_; + dir_path submit_temp_; + bool submit_temp_specified_; + size_t submit_max_size_; + bool submit_max_size_specified_; + path submit_form_; + bool submit_form_specified_; + string submit_email_; + bool submit_email_specified_; + path submit_handler_; + bool submit_handler_specified_; + strings submit_handler_argument_; + bool submit_handler_argument_specified_; + size_t submit_handler_timeout_; + bool submit_handler_timeout_specified_; + }; + + class ci_start: public ::brep::options::repository_email + { + public: + ci_start (); + + ci_start (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + ci_start (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + ci_start (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + ci_start (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + ci_start (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + const dir_path& + ci_data () const; + + dir_path& + ci_data (); + + void + ci_data (const dir_path&); + + bool + ci_data_specified () const; + + void + ci_data_specified (bool); + + const string& + ci_email () const; + + string& + ci_email (); + + void + ci_email (const string&); + + bool + ci_email_specified () const; + + void + ci_email_specified (bool); + + const path& + ci_handler () const; + + path& + ci_handler (); + + void + ci_handler (const path&); + + bool + ci_handler_specified () const; + + void + ci_handler_specified (bool); + + const strings& + ci_handler_argument () const; + + strings& + ci_handler_argument (); + + void + ci_handler_argument (const strings&); + + bool + ci_handler_argument_specified () const; + + void + ci_handler_argument_specified (bool); + + const size_t& + ci_handler_timeout () const; + + size_t& + ci_handler_timeout (); + + void + ci_handler_timeout (const size_t&); + + bool + ci_handler_timeout_specified () const; + + void + ci_handler_timeout_specified (bool); + + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_ci_start_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + dir_path ci_data_; + bool ci_data_specified_; + string ci_email_; + bool ci_email_specified_; + path ci_handler_; + bool ci_handler_specified_; + strings ci_handler_argument_; + bool ci_handler_argument_specified_; + size_t ci_handler_timeout_; + bool ci_handler_timeout_specified_; + }; + + class ci_cancel + { + public: + ci_cancel (); + + ci_cancel (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + ci_cancel (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + ci_cancel (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + ci_cancel (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + ci_cancel (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_ci_cancel_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + }; + + class ci: public ::brep::options::ci_start, + public ::brep::options::build, + public ::brep::options::build_db, + public ::brep::options::page, + public ::brep::options::repository_url, + public ::brep::options::handler + { + public: + ci (); + + ci (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + ci (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + ci (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + ci (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + ci (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + const path& + ci_form () const; + + path& + ci_form (); + + void + ci_form (const path&); + + bool + ci_form_specified () const; + + void + ci_form_specified (bool); + + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_ci_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + path ci_form_; + bool ci_form_specified_; + }; + + class ci_github: public ::brep::options::ci_start, + public ::brep::options::ci_cancel, + public ::brep::options::build, + public ::brep::options::build_db, + public ::brep::options::handler + { + public: + ci_github (); + + ci_github (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + ci_github (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + ci_github (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + ci_github (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + ci_github (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_ci_github_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + }; + + class upload: public ::brep::options::build, + public ::brep::options::build_db, + public ::brep::options::build_upload, + public ::brep::options::repository_email, + public ::brep::options::handler + { + public: + upload (); + + upload (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + upload (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + upload (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + upload (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + upload (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_upload_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + }; + + class repository_root: public ::brep::options::repository_url, + public ::brep::options::handler + { + public: + repository_root (); + + repository_root (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + repository_root (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + repository_root (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + repository_root (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + repository_root (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + const string& + root_global_view () const; + + string& + root_global_view (); + + void + root_global_view (const string&); + + bool + root_global_view_specified () const; + + void + root_global_view_specified (bool); + + const string& + root_tenant_view () const; + + string& + root_tenant_view (); + + void + root_tenant_view (const string&); + + bool + root_tenant_view_specified () const; + + void + root_tenant_view_specified (bool); + + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_repository_root_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + string root_global_view_; + bool root_global_view_specified_; + string root_tenant_view_; + bool root_tenant_view_specified_; + }; + } + + namespace params + { + class packages + { + public: + packages (); + + packages (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + packages (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + packages (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + packages (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + packages (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + const uint16_t& + page () const; + + uint16_t& + page (); + + void + page (const uint16_t&); + + bool + page_specified () const; + + void + page_specified (bool); + + const string& + q () const; + + string& + q (); + + void + q (const string&); + + bool + q_specified () const; + + void + q_specified (bool); + + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_packages_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + uint16_t page_; + bool page_specified_; + string q_; + bool q_specified_; + }; + + class package_details + { + public: + package_details (); + + package_details (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + package_details (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + package_details (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + package_details (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + package_details (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + const uint16_t& + page () const; + + uint16_t& + page (); + + void + page (const uint16_t&); + + bool + page_specified () const; + + void + page_specified (bool); + + const string& + query () const; + + string& + query (); + + void + query (const string&); + + bool + query_specified () const; + + void + query_specified (bool); + + const page_form& + form () const; + + page_form& + form (); + + void + form (const page_form&); + + bool + form_specified () const; + + void + form_specified (bool); + + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_package_details_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + uint16_t page_; + bool page_specified_; + string query_; + bool query_specified_; + page_form form_; + bool form_specified_; + }; + + class package_version_details + { + public: + package_version_details (); + + package_version_details (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + package_version_details (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + package_version_details (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + package_version_details (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + package_version_details (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + const page_form& + form () const; + + page_form& + form (); + + void + form (const page_form&); + + bool + form_specified () const; + + void + form_specified (bool); + + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_package_version_details_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + page_form form_; + bool form_specified_; + }; + + class repository_details + { + public: + repository_details (); + + repository_details (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + repository_details (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + repository_details (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + repository_details (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + repository_details (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_repository_details_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + }; + + class build_task + { + public: + build_task (); + + build_task (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_task (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_task (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_task (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_task (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + const vector<string>& + repository () const; + + vector<string>& + repository (); + + void + repository (const vector<string>&); + + bool + repository_specified () const; + + void + repository_specified (bool); + + const bbot::interactive_mode& + interactive () const; + + bbot::interactive_mode& + interactive (); + + void + interactive (const bbot::interactive_mode&); + + bool + interactive_specified () const; + + void + interactive_specified (bool); + + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_build_task_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + vector<string> repository_; + bool repository_specified_; + bbot::interactive_mode interactive_; + bool interactive_specified_; + }; + + class build_result + { + public: + build_result (); + + build_result (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_result (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_result (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_result (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_result (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_build_result_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + }; + + class build_log + { + public: + build_log (); + + build_log (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_log (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_log (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_log (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_log (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_build_log_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + }; + + class build_force + { + public: + build_force (); + + build_force (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_force (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_force (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_force (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_force (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + const string& + package () const; + + string& + package (); + + void + package (const string&); + + bool + package_specified () const; + + void + package_specified (bool); + + const string& + version () const; + + string& + version (); + + void + version (const string&); + + bool + version_specified () const; + + void + version_specified (bool); + + const string& + target () const; + + string& + target (); + + void + target (const string&); + + bool + target_specified () const; + + void + target_specified (bool); + + const string& + target_config () const; + + string& + target_config (); + + void + target_config (const string&); + + bool + target_config_specified () const; + + void + target_config_specified (bool); + + const string& + package_config () const; + + string& + package_config (); + + void + package_config (const string&); + + bool + package_config_specified () const; + + void + package_config_specified (bool); + + const string& + toolchain_name () const; + + string& + toolchain_name (); + + void + toolchain_name (const string&); + + bool + toolchain_name_specified () const; + + void + toolchain_name_specified (bool); + + const string& + toolchain_version () const; + + string& + toolchain_version (); + + void + toolchain_version (const string&); + + bool + toolchain_version_specified () const; + + void + toolchain_version_specified (bool); + + const string& + reason () const; + + string& + reason (); + + void + reason (const string&); + + bool + reason_specified () const; + + void + reason_specified (bool); + + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_build_force_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + string package_; + bool package_specified_; + string version_; + bool version_specified_; + string target_; + bool target_specified_; + string target_config_; + bool target_config_specified_; + string package_config_; + bool package_config_specified_; + string toolchain_name_; + bool toolchain_name_specified_; + string toolchain_version_; + bool toolchain_version_specified_; + string reason_; + bool reason_specified_; + }; + + class builds + { + public: + builds (); + + builds (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + builds (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + builds (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + builds (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + builds (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + const uint16_t& + page () const; + + uint16_t& + page (); + + void + page (const uint16_t&); + + bool + page_specified () const; + + void + page_specified (bool); + + const string& + name () const; + + string& + name (); + + void + name (const string&); + + bool + name_specified () const; + + void + name_specified (bool); + + const string& + version () const; + + string& + version (); + + void + version (const string&); + + bool + version_specified () const; + + void + version_specified (bool); + + const string& + toolchain () const; + + string& + toolchain (); + + void + toolchain (const string&); + + bool + toolchain_specified () const; + + void + toolchain_specified (bool); + + const string& + target () const; + + string& + target (); + + void + target (const string&); + + bool + target_specified () const; + + void + target_specified (bool); + + const string& + target_config () const; + + string& + target_config (); + + void + target_config (const string&); + + bool + target_config_specified () const; + + void + target_config_specified (bool); + + const string& + package_config () const; + + string& + package_config (); + + void + package_config (const string&); + + bool + package_config_specified () const; + + void + package_config_specified (bool); + + const string& + result () const; + + string& + result (); + + void + result (const string&); + + bool + result_specified () const; + + void + result_specified (bool); + + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_builds_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + uint16_t page_; + bool page_specified_; + string name_; + bool name_specified_; + string version_; + bool version_specified_; + string toolchain_; + bool toolchain_specified_; + string target_; + bool target_specified_; + string target_config_; + bool target_config_specified_; + string package_config_; + bool package_config_specified_; + string result_; + bool result_specified_; + }; + + class build_configs + { + public: + build_configs (); + + build_configs (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_configs (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_configs (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_configs (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + build_configs (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + const string& + class_name () const; + + string& + class_name (); + + void + class_name (const string&); + + bool + class_name_specified () const; + + void + class_name_specified (bool); + + const uint16_t& + page () const; + + uint16_t& + page (); + + void + page (const uint16_t&); + + bool + page_specified () const; + + void + page_specified (bool); + + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_build_configs_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + string class_name_; + bool class_name_specified_; + uint16_t page_; + bool page_specified_; + }; + + class submit + { + public: + submit (); + + submit (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + submit (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + submit (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + submit (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + submit (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + const string& + archive () const; + + string& + archive (); + + void + archive (const string&); + + bool + archive_specified () const; + + void + archive_specified (bool); + + const string& + sha256sum () const; + + string& + sha256sum (); + + void + sha256sum (const string&); + + bool + sha256sum_specified () const; + + void + sha256sum_specified (bool); + + const string& + simulate () const; + + string& + simulate (); + + void + simulate (const string&); + + bool + simulate_specified () const; + + void + simulate_specified (bool); + + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_submit_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + string archive_; + bool archive_specified_; + string sha256sum_; + bool sha256sum_specified_; + string simulate_; + bool simulate_specified_; + }; + + class ci + { + public: + ci (); + + ci (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + ci (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + ci (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + ci (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + ci (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + const bpkg::repository_location& + repository () const; + + bpkg::repository_location& + repository (); + + void + repository (const bpkg::repository_location&); + + bool + repository_specified () const; + + void + repository_specified (bool); + + const strings& + package () const; + + strings& + package (); + + void + package (const strings&); + + bool + package_specified () const; + + void + package_specified (bool); + + const string& + overrides () const; + + string& + overrides (); + + void + overrides (const string&); + + bool + overrides_specified () const; + + void + overrides_specified (bool); + + const string& + interactive () const; + + string& + interactive (); + + void + interactive (const string&); + + bool + interactive_specified () const; + + void + interactive_specified (bool); + + const string& + simulate () const; + + string& + simulate (); + + void + simulate (const string&); + + bool + simulate_specified () const; + + void + simulate_specified (bool); + + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_ci_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + bpkg::repository_location repository_; + bool repository_specified_; + strings package_; + bool package_specified_; + string overrides_; + bool overrides_specified_; + string interactive_; + bool interactive_specified_; + string simulate_; + bool simulate_specified_; + }; + + class upload + { + public: + upload (); + + upload (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + upload (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + upload (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + upload (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + upload (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors and modifiers. + // + const string& + type () const; + + string& + type (); + + void + type (const string&); + + bool + type_specified () const; + + void + type_specified (bool); + + const string& + session () const; + + string& + session (); + + void + session (const string&); + + bool + session_specified () const; + + void + session_specified (bool); + + const string& + challenge () const; + + string& + challenge (); + + void + challenge (const string&); + + bool + challenge_specified () const; + + void + challenge_specified (bool); + + const string& + instance () const; + + string& + instance (); + + void + instance (const string&); + + bool + instance_specified () const; + + void + instance_specified (bool); + + const string& + archive () const; + + string& + archive (); + + void + archive (const string&); + + bool + archive_specified () const; + + void + archive_specified (bool); + + const string& + sha256sum () const; + + string& + sha256sum (); + + void + sha256sum (const string&); + + bool + sha256sum_specified () const; + + void + sha256sum_specified (bool); + + // Print usage information. + // + static ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Option description. + // + static const ::brep::cli::options& + description (); + + // Implementation details. + // + protected: + friend struct _cli_upload_desc_type; + + static void + fill (::brep::cli::options&); + + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + string type_; + bool type_specified_; + string session_; + bool session_specified_; + string challenge_; + bool challenge_specified_; + string instance_; + bool instance_specified_; + string archive_; + bool archive_specified_; + string sha256sum_; + bool sha256sum_specified_; + }; + } +} + +#include <mod/module-options.ixx> + +// Begin epilogue. +// +// +// End epilogue. + +#endif // MOD_MODULE_OPTIONS_HXX diff --git a/mod/module-options.ixx b/mod/module-options.ixx new file mode 100644 index 0000000..c5eb20c --- /dev/null +++ b/mod/module-options.ixx @@ -0,0 +1,4062 @@ +// -*- C++ -*- +// +// This file was generated by CLI, a command line interface +// compiler for C++. +// + +// Begin prologue. +// +// +// End prologue. + +#include <cassert> + +namespace brep +{ + 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_; + } + + // file_io_failure + // + inline file_io_failure:: + file_io_failure (const std::string& file) + : file_ (file) + { + } + + inline const std::string& file_io_failure:: + file () const + { + return file_; + } + + // unmatched_quote + // + inline unmatched_quote:: + unmatched_quote (const std::string& argument) + : argument_ (argument) + { + } + + inline const std::string& unmatched_quote:: + argument () const + { + return argument_; + } + + // argv_scanner + // + inline argv_scanner:: + argv_scanner (int& argc, + char** argv, + bool erase, + std::size_t sp) + : start_position_ (sp + 1), + i_ (1), + argc_ (argc), + argv_ (argv), + erase_ (erase) + { + } + + inline argv_scanner:: + argv_scanner (int start, + int& argc, + char** argv, + bool erase, + std::size_t sp) + : start_position_ (sp + static_cast<std::size_t> (start)), + i_ (start), + argc_ (argc), + argv_ (argv), + erase_ (erase) + { + } + + inline int argv_scanner:: + end () const + { + return i_; + } + + // argv_file_scanner + // + inline argv_file_scanner:: + argv_file_scanner (int& argc, + char** argv, + const std::string& option, + bool erase, + std::size_t sp) + : argv_scanner (argc, argv, erase, sp), + option_ (option), + options_ (&option_info_), + options_count_ (1), + i_ (1), + skip_ (false) + { + option_info_.option = option_.c_str (); + option_info_.search_func = 0; + } + + inline argv_file_scanner:: + argv_file_scanner (int start, + int& argc, + char** argv, + const std::string& option, + bool erase, + std::size_t sp) + : argv_scanner (start, argc, argv, erase, sp), + option_ (option), + options_ (&option_info_), + options_count_ (1), + i_ (1), + skip_ (false) + { + option_info_.option = option_.c_str (); + option_info_.search_func = 0; + } + + inline argv_file_scanner:: + argv_file_scanner (const std::string& file, + const std::string& option, + std::size_t sp) + : argv_scanner (0, zero_argc_, 0, sp), + option_ (option), + options_ (&option_info_), + options_count_ (1), + i_ (1), + skip_ (false) + { + option_info_.option = option_.c_str (); + option_info_.search_func = 0; + + load (file); + } + + inline argv_file_scanner:: + argv_file_scanner (int& argc, + char** argv, + const option_info* options, + std::size_t options_count, + bool erase, + std::size_t sp) + : argv_scanner (argc, argv, erase, sp), + options_ (options), + options_count_ (options_count), + i_ (1), + skip_ (false) + { + } + + inline argv_file_scanner:: + argv_file_scanner (int start, + int& argc, + char** argv, + const option_info* options, + std::size_t options_count, + bool erase, + std::size_t sp) + : argv_scanner (start, argc, argv, erase, sp), + options_ (options), + options_count_ (options_count), + i_ (1), + skip_ (false) + { + } + + inline argv_file_scanner:: + argv_file_scanner (const std::string& file, + const option_info* options, + std::size_t options_count, + std::size_t sp) + : argv_scanner (0, zero_argc_, 0, sp), + options_ (options), + options_count_ (options_count), + i_ (1), + skip_ (false) + { + load (file); + } + + inline const std::string& option:: + name () const + { + return name_; + } + + inline const option_names& option:: + aliases () const + { + return aliases_; + } + + inline bool option:: + flag () const + { + return flag_; + } + + inline const std::string& option:: + default_value () const + { + return default_value_; + } + + inline option:: + option () + { + } + + inline option:: + option (const std::string& n, + const option_names& a, + bool f, + const std::string& dv) + : name_ (n), aliases_ (a), flag_ (f), default_value_ (dv) + { + } + + inline options::container_type::const_iterator options:: + find (const std::string& name) const + { + map_type::const_iterator i (map_.find (name)); + return i != map_.end () ? begin () + i->second : end (); + } + } +} + +namespace brep +{ + namespace options + { + // repository_email + // + + inline const string& repository_email:: + email () const + { + return this->email_; + } + + inline string& repository_email:: + email () + { + return this->email_; + } + + inline void repository_email:: + email (const string& x) + { + this->email_ = x; + } + + inline bool repository_email:: + email_specified () const + { + return this->email_specified_; + } + + inline void repository_email:: + email_specified (bool x) + { + this->email_specified_ = x; + } + + // repository_url + // + + inline const string& repository_url:: + host () const + { + return this->host_; + } + + inline string& repository_url:: + host () + { + return this->host_; + } + + inline void repository_url:: + host (const string& x) + { + this->host_ = x; + } + + inline bool repository_url:: + host_specified () const + { + return this->host_specified_; + } + + inline void repository_url:: + host_specified (bool x) + { + this->host_specified_ = x; + } + + inline const dir_path& repository_url:: + root () const + { + return this->root_; + } + + inline dir_path& repository_url:: + root () + { + return this->root_; + } + + inline void repository_url:: + root (const dir_path& x) + { + this->root_ = x; + } + + inline bool repository_url:: + root_specified () const + { + return this->root_specified_; + } + + inline void repository_url:: + root_specified (bool x) + { + this->root_specified_ = x; + } + + // build_email_notification + // + + inline const std::map<string, build_email>& build_email_notification:: + build_toolchain_email () const + { + return this->build_toolchain_email_; + } + + inline std::map<string, build_email>& build_email_notification:: + build_toolchain_email () + { + return this->build_toolchain_email_; + } + + inline void build_email_notification:: + build_toolchain_email (const std::map<string, build_email>& x) + { + this->build_toolchain_email_ = x; + } + + inline bool build_email_notification:: + build_toolchain_email_specified () const + { + return this->build_toolchain_email_specified_; + } + + inline void build_email_notification:: + build_toolchain_email_specified (bool x) + { + this->build_toolchain_email_specified_ = x; + } + + // handler + // + + inline const string& handler:: + tenant_name () const + { + return this->tenant_name_; + } + + inline string& handler:: + tenant_name () + { + return this->tenant_name_; + } + + inline void handler:: + tenant_name (const string& x) + { + this->tenant_name_ = x; + } + + inline bool handler:: + tenant_name_specified () const + { + return this->tenant_name_specified_; + } + + inline void handler:: + tenant_name_specified (bool x) + { + this->tenant_name_specified_ = x; + } + + inline const uint16_t& handler:: + verbosity () const + { + return this->verbosity_; + } + + inline uint16_t& handler:: + verbosity () + { + return this->verbosity_; + } + + inline void handler:: + verbosity (const uint16_t& x) + { + this->verbosity_ = x; + } + + inline bool handler:: + verbosity_specified () const + { + return this->verbosity_specified_; + } + + inline void handler:: + verbosity_specified (bool x) + { + this->verbosity_specified_ = x; + } + + // openssl_options + // + + inline const path& openssl_options:: + openssl () const + { + return this->openssl_; + } + + inline path& openssl_options:: + openssl () + { + return this->openssl_; + } + + inline void openssl_options:: + openssl (const path& x) + { + this->openssl_ = x; + } + + inline bool openssl_options:: + openssl_specified () const + { + return this->openssl_specified_; + } + + inline void openssl_options:: + openssl_specified (bool x) + { + this->openssl_specified_ = x; + } + + inline const strings& openssl_options:: + openssl_option () const + { + return this->openssl_option_; + } + + inline strings& openssl_options:: + openssl_option () + { + return this->openssl_option_; + } + + inline void openssl_options:: + openssl_option (const strings& x) + { + this->openssl_option_ = x; + } + + inline bool openssl_options:: + openssl_option_specified () const + { + return this->openssl_option_specified_; + } + + inline void openssl_options:: + openssl_option_specified (bool x) + { + this->openssl_option_specified_ = x; + } + + inline const strings& openssl_options:: + openssl_envvar () const + { + return this->openssl_envvar_; + } + + inline strings& openssl_options:: + openssl_envvar () + { + return this->openssl_envvar_; + } + + inline void openssl_options:: + openssl_envvar (const strings& x) + { + this->openssl_envvar_ = x; + } + + inline bool openssl_options:: + openssl_envvar_specified () const + { + return this->openssl_envvar_specified_; + } + + inline void openssl_options:: + openssl_envvar_specified (bool x) + { + this->openssl_envvar_specified_ = x; + } + + // package_db + // + + inline const string& package_db:: + package_db_user () const + { + return this->package_db_user_; + } + + inline string& package_db:: + package_db_user () + { + return this->package_db_user_; + } + + inline void package_db:: + package_db_user (const string& x) + { + this->package_db_user_ = x; + } + + inline bool package_db:: + package_db_user_specified () const + { + return this->package_db_user_specified_; + } + + inline void package_db:: + package_db_user_specified (bool x) + { + this->package_db_user_specified_ = x; + } + + inline const string& package_db:: + package_db_role () const + { + return this->package_db_role_; + } + + inline string& package_db:: + package_db_role () + { + return this->package_db_role_; + } + + inline void package_db:: + package_db_role (const string& x) + { + this->package_db_role_ = x; + } + + inline bool package_db:: + package_db_role_specified () const + { + return this->package_db_role_specified_; + } + + inline void package_db:: + package_db_role_specified (bool x) + { + this->package_db_role_specified_ = x; + } + + inline const string& package_db:: + package_db_password () const + { + return this->package_db_password_; + } + + inline string& package_db:: + package_db_password () + { + return this->package_db_password_; + } + + inline void package_db:: + package_db_password (const string& x) + { + this->package_db_password_ = x; + } + + inline bool package_db:: + package_db_password_specified () const + { + return this->package_db_password_specified_; + } + + inline void package_db:: + package_db_password_specified (bool x) + { + this->package_db_password_specified_ = x; + } + + inline const string& package_db:: + package_db_name () const + { + return this->package_db_name_; + } + + inline string& package_db:: + package_db_name () + { + return this->package_db_name_; + } + + inline void package_db:: + package_db_name (const string& x) + { + this->package_db_name_ = x; + } + + inline bool package_db:: + package_db_name_specified () const + { + return this->package_db_name_specified_; + } + + inline void package_db:: + package_db_name_specified (bool x) + { + this->package_db_name_specified_ = x; + } + + inline const string& package_db:: + package_db_host () const + { + return this->package_db_host_; + } + + inline string& package_db:: + package_db_host () + { + return this->package_db_host_; + } + + inline void package_db:: + package_db_host (const string& x) + { + this->package_db_host_ = x; + } + + inline bool package_db:: + package_db_host_specified () const + { + return this->package_db_host_specified_; + } + + inline void package_db:: + package_db_host_specified (bool x) + { + this->package_db_host_specified_ = x; + } + + inline const uint16_t& package_db:: + package_db_port () const + { + return this->package_db_port_; + } + + inline uint16_t& package_db:: + package_db_port () + { + return this->package_db_port_; + } + + inline void package_db:: + package_db_port (const uint16_t& x) + { + this->package_db_port_ = x; + } + + inline bool package_db:: + package_db_port_specified () const + { + return this->package_db_port_specified_; + } + + inline void package_db:: + package_db_port_specified (bool x) + { + this->package_db_port_specified_ = x; + } + + inline const size_t& package_db:: + package_db_max_connections () const + { + return this->package_db_max_connections_; + } + + inline size_t& package_db:: + package_db_max_connections () + { + return this->package_db_max_connections_; + } + + inline void package_db:: + package_db_max_connections (const size_t& x) + { + this->package_db_max_connections_ = x; + } + + inline bool package_db:: + package_db_max_connections_specified () const + { + return this->package_db_max_connections_specified_; + } + + inline void package_db:: + package_db_max_connections_specified (bool x) + { + this->package_db_max_connections_specified_ = x; + } + + inline const size_t& package_db:: + package_db_retry () const + { + return this->package_db_retry_; + } + + inline size_t& package_db:: + package_db_retry () + { + return this->package_db_retry_; + } + + inline void package_db:: + package_db_retry (const size_t& x) + { + this->package_db_retry_ = x; + } + + inline bool package_db:: + package_db_retry_specified () const + { + return this->package_db_retry_specified_; + } + + inline void package_db:: + package_db_retry_specified (bool x) + { + this->package_db_retry_specified_ = x; + } + + // build + // + + inline const path& build:: + build_config () const + { + return this->build_config_; + } + + inline path& build:: + build_config () + { + return this->build_config_; + } + + inline void build:: + build_config (const path& x) + { + this->build_config_ = x; + } + + inline bool build:: + build_config_specified () const + { + return this->build_config_specified_; + } + + inline void build:: + build_config_specified (bool x) + { + this->build_config_specified_ = x; + } + + inline const dir_path& build:: + build_bot_agent_keys () const + { + return this->build_bot_agent_keys_; + } + + inline dir_path& build:: + build_bot_agent_keys () + { + return this->build_bot_agent_keys_; + } + + inline void build:: + build_bot_agent_keys (const dir_path& x) + { + this->build_bot_agent_keys_ = x; + } + + inline bool build:: + build_bot_agent_keys_specified () const + { + return this->build_bot_agent_keys_specified_; + } + + inline void build:: + build_bot_agent_keys_specified (bool x) + { + this->build_bot_agent_keys_specified_ = x; + } + + inline const size_t& build:: + build_forced_rebuild_timeout () const + { + return this->build_forced_rebuild_timeout_; + } + + inline size_t& build:: + build_forced_rebuild_timeout () + { + return this->build_forced_rebuild_timeout_; + } + + inline void build:: + build_forced_rebuild_timeout (const size_t& x) + { + this->build_forced_rebuild_timeout_ = x; + } + + inline bool build:: + build_forced_rebuild_timeout_specified () const + { + return this->build_forced_rebuild_timeout_specified_; + } + + inline void build:: + build_forced_rebuild_timeout_specified (bool x) + { + this->build_forced_rebuild_timeout_specified_ = x; + } + + inline const size_t& build:: + build_soft_rebuild_timeout () const + { + return this->build_soft_rebuild_timeout_; + } + + inline size_t& build:: + build_soft_rebuild_timeout () + { + return this->build_soft_rebuild_timeout_; + } + + inline void build:: + build_soft_rebuild_timeout (const size_t& x) + { + this->build_soft_rebuild_timeout_ = x; + } + + inline bool build:: + build_soft_rebuild_timeout_specified () const + { + return this->build_soft_rebuild_timeout_specified_; + } + + inline void build:: + build_soft_rebuild_timeout_specified (bool x) + { + this->build_soft_rebuild_timeout_specified_ = x; + } + + inline const size_t& build:: + build_alt_soft_rebuild_timeout () const + { + return this->build_alt_soft_rebuild_timeout_; + } + + inline size_t& build:: + build_alt_soft_rebuild_timeout () + { + return this->build_alt_soft_rebuild_timeout_; + } + + inline void build:: + build_alt_soft_rebuild_timeout (const size_t& x) + { + this->build_alt_soft_rebuild_timeout_ = x; + } + + inline bool build:: + build_alt_soft_rebuild_timeout_specified () const + { + return this->build_alt_soft_rebuild_timeout_specified_; + } + + inline void build:: + build_alt_soft_rebuild_timeout_specified (bool x) + { + this->build_alt_soft_rebuild_timeout_specified_ = x; + } + + inline const duration& build:: + build_alt_soft_rebuild_start () const + { + return this->build_alt_soft_rebuild_start_; + } + + inline duration& build:: + build_alt_soft_rebuild_start () + { + return this->build_alt_soft_rebuild_start_; + } + + inline void build:: + build_alt_soft_rebuild_start (const duration& x) + { + this->build_alt_soft_rebuild_start_ = x; + } + + inline bool build:: + build_alt_soft_rebuild_start_specified () const + { + return this->build_alt_soft_rebuild_start_specified_; + } + + inline void build:: + build_alt_soft_rebuild_start_specified (bool x) + { + this->build_alt_soft_rebuild_start_specified_ = x; + } + + inline const duration& build:: + build_alt_soft_rebuild_stop () const + { + return this->build_alt_soft_rebuild_stop_; + } + + inline duration& build:: + build_alt_soft_rebuild_stop () + { + return this->build_alt_soft_rebuild_stop_; + } + + inline void build:: + build_alt_soft_rebuild_stop (const duration& x) + { + this->build_alt_soft_rebuild_stop_ = x; + } + + inline bool build:: + build_alt_soft_rebuild_stop_specified () const + { + return this->build_alt_soft_rebuild_stop_specified_; + } + + inline void build:: + build_alt_soft_rebuild_stop_specified (bool x) + { + this->build_alt_soft_rebuild_stop_specified_ = x; + } + + inline const size_t& build:: + build_hard_rebuild_timeout () const + { + return this->build_hard_rebuild_timeout_; + } + + inline size_t& build:: + build_hard_rebuild_timeout () + { + return this->build_hard_rebuild_timeout_; + } + + inline void build:: + build_hard_rebuild_timeout (const size_t& x) + { + this->build_hard_rebuild_timeout_ = x; + } + + inline bool build:: + build_hard_rebuild_timeout_specified () const + { + return this->build_hard_rebuild_timeout_specified_; + } + + inline void build:: + build_hard_rebuild_timeout_specified (bool x) + { + this->build_hard_rebuild_timeout_specified_ = x; + } + + inline const size_t& build:: + build_alt_hard_rebuild_timeout () const + { + return this->build_alt_hard_rebuild_timeout_; + } + + inline size_t& build:: + build_alt_hard_rebuild_timeout () + { + return this->build_alt_hard_rebuild_timeout_; + } + + inline void build:: + build_alt_hard_rebuild_timeout (const size_t& x) + { + this->build_alt_hard_rebuild_timeout_ = x; + } + + inline bool build:: + build_alt_hard_rebuild_timeout_specified () const + { + return this->build_alt_hard_rebuild_timeout_specified_; + } + + inline void build:: + build_alt_hard_rebuild_timeout_specified (bool x) + { + this->build_alt_hard_rebuild_timeout_specified_ = x; + } + + inline const duration& build:: + build_alt_hard_rebuild_start () const + { + return this->build_alt_hard_rebuild_start_; + } + + inline duration& build:: + build_alt_hard_rebuild_start () + { + return this->build_alt_hard_rebuild_start_; + } + + inline void build:: + build_alt_hard_rebuild_start (const duration& x) + { + this->build_alt_hard_rebuild_start_ = x; + } + + inline bool build:: + build_alt_hard_rebuild_start_specified () const + { + return this->build_alt_hard_rebuild_start_specified_; + } + + inline void build:: + build_alt_hard_rebuild_start_specified (bool x) + { + this->build_alt_hard_rebuild_start_specified_ = x; + } + + inline const duration& build:: + build_alt_hard_rebuild_stop () const + { + return this->build_alt_hard_rebuild_stop_; + } + + inline duration& build:: + build_alt_hard_rebuild_stop () + { + return this->build_alt_hard_rebuild_stop_; + } + + inline void build:: + build_alt_hard_rebuild_stop (const duration& x) + { + this->build_alt_hard_rebuild_stop_ = x; + } + + inline bool build:: + build_alt_hard_rebuild_stop_specified () const + { + return this->build_alt_hard_rebuild_stop_specified_; + } + + inline void build:: + build_alt_hard_rebuild_stop_specified (bool x) + { + this->build_alt_hard_rebuild_stop_specified_ = x; + } + + inline const size_t& build:: + build_queued_timeout () const + { + return this->build_queued_timeout_; + } + + inline size_t& build:: + build_queued_timeout () + { + return this->build_queued_timeout_; + } + + inline void build:: + build_queued_timeout (const size_t& x) + { + this->build_queued_timeout_ = x; + } + + inline bool build:: + build_queued_timeout_specified () const + { + return this->build_queued_timeout_specified_; + } + + inline void build:: + build_queued_timeout_specified (bool x) + { + this->build_queued_timeout_specified_ = x; + } + + // build_db + // + + inline const string& build_db:: + build_db_user () const + { + return this->build_db_user_; + } + + inline string& build_db:: + build_db_user () + { + return this->build_db_user_; + } + + inline void build_db:: + build_db_user (const string& x) + { + this->build_db_user_ = x; + } + + inline bool build_db:: + build_db_user_specified () const + { + return this->build_db_user_specified_; + } + + inline void build_db:: + build_db_user_specified (bool x) + { + this->build_db_user_specified_ = x; + } + + inline const string& build_db:: + build_db_role () const + { + return this->build_db_role_; + } + + inline string& build_db:: + build_db_role () + { + return this->build_db_role_; + } + + inline void build_db:: + build_db_role (const string& x) + { + this->build_db_role_ = x; + } + + inline bool build_db:: + build_db_role_specified () const + { + return this->build_db_role_specified_; + } + + inline void build_db:: + build_db_role_specified (bool x) + { + this->build_db_role_specified_ = x; + } + + inline const string& build_db:: + build_db_password () const + { + return this->build_db_password_; + } + + inline string& build_db:: + build_db_password () + { + return this->build_db_password_; + } + + inline void build_db:: + build_db_password (const string& x) + { + this->build_db_password_ = x; + } + + inline bool build_db:: + build_db_password_specified () const + { + return this->build_db_password_specified_; + } + + inline void build_db:: + build_db_password_specified (bool x) + { + this->build_db_password_specified_ = x; + } + + inline const string& build_db:: + build_db_name () const + { + return this->build_db_name_; + } + + inline string& build_db:: + build_db_name () + { + return this->build_db_name_; + } + + inline void build_db:: + build_db_name (const string& x) + { + this->build_db_name_ = x; + } + + inline bool build_db:: + build_db_name_specified () const + { + return this->build_db_name_specified_; + } + + inline void build_db:: + build_db_name_specified (bool x) + { + this->build_db_name_specified_ = x; + } + + inline const string& build_db:: + build_db_host () const + { + return this->build_db_host_; + } + + inline string& build_db:: + build_db_host () + { + return this->build_db_host_; + } + + inline void build_db:: + build_db_host (const string& x) + { + this->build_db_host_ = x; + } + + inline bool build_db:: + build_db_host_specified () const + { + return this->build_db_host_specified_; + } + + inline void build_db:: + build_db_host_specified (bool x) + { + this->build_db_host_specified_ = x; + } + + inline const uint16_t& build_db:: + build_db_port () const + { + return this->build_db_port_; + } + + inline uint16_t& build_db:: + build_db_port () + { + return this->build_db_port_; + } + + inline void build_db:: + build_db_port (const uint16_t& x) + { + this->build_db_port_ = x; + } + + inline bool build_db:: + build_db_port_specified () const + { + return this->build_db_port_specified_; + } + + inline void build_db:: + build_db_port_specified (bool x) + { + this->build_db_port_specified_ = x; + } + + inline const size_t& build_db:: + build_db_max_connections () const + { + return this->build_db_max_connections_; + } + + inline size_t& build_db:: + build_db_max_connections () + { + return this->build_db_max_connections_; + } + + inline void build_db:: + build_db_max_connections (const size_t& x) + { + this->build_db_max_connections_ = x; + } + + inline bool build_db:: + build_db_max_connections_specified () const + { + return this->build_db_max_connections_specified_; + } + + inline void build_db:: + build_db_max_connections_specified (bool x) + { + this->build_db_max_connections_specified_ = x; + } + + inline const size_t& build_db:: + build_db_retry () const + { + return this->build_db_retry_; + } + + inline size_t& build_db:: + build_db_retry () + { + return this->build_db_retry_; + } + + inline void build_db:: + build_db_retry (const size_t& x) + { + this->build_db_retry_ = x; + } + + inline bool build_db:: + build_db_retry_specified () const + { + return this->build_db_retry_specified_; + } + + inline void build_db:: + build_db_retry_specified (bool x) + { + this->build_db_retry_specified_ = x; + } + + // build_upload + // + + inline const std::map<string, dir_path>& build_upload:: + upload_data () const + { + return this->upload_data_; + } + + inline std::map<string, dir_path>& build_upload:: + upload_data () + { + return this->upload_data_; + } + + inline void build_upload:: + upload_data (const std::map<string, dir_path>& x) + { + this->upload_data_ = x; + } + + inline bool build_upload:: + upload_data_specified () const + { + return this->upload_data_specified_; + } + + inline void build_upload:: + upload_data_specified (bool x) + { + this->upload_data_specified_ = x; + } + + inline const std::map<string, size_t>& build_upload:: + upload_max_size () const + { + return this->upload_max_size_; + } + + inline std::map<string, size_t>& build_upload:: + upload_max_size () + { + return this->upload_max_size_; + } + + inline void build_upload:: + upload_max_size (const std::map<string, size_t>& x) + { + this->upload_max_size_ = x; + } + + inline bool build_upload:: + upload_max_size_specified () const + { + return this->upload_max_size_specified_; + } + + inline void build_upload:: + upload_max_size_specified (bool x) + { + this->upload_max_size_specified_ = x; + } + + inline const std::map<string, string>& build_upload:: + upload_email () const + { + return this->upload_email_; + } + + inline std::map<string, string>& build_upload:: + upload_email () + { + return this->upload_email_; + } + + inline void build_upload:: + upload_email (const std::map<string, string>& x) + { + this->upload_email_ = x; + } + + inline bool build_upload:: + upload_email_specified () const + { + return this->upload_email_specified_; + } + + inline void build_upload:: + upload_email_specified (bool x) + { + this->upload_email_specified_ = x; + } + + inline const std::map<string, path>& build_upload:: + upload_handler () const + { + return this->upload_handler_; + } + + inline std::map<string, path>& build_upload:: + upload_handler () + { + return this->upload_handler_; + } + + inline void build_upload:: + upload_handler (const std::map<string, path>& x) + { + this->upload_handler_ = x; + } + + inline bool build_upload:: + upload_handler_specified () const + { + return this->upload_handler_specified_; + } + + inline void build_upload:: + upload_handler_specified (bool x) + { + this->upload_handler_specified_ = x; + } + + inline const std::multimap<string, string>& build_upload:: + upload_handler_argument () const + { + return this->upload_handler_argument_; + } + + inline std::multimap<string, string>& build_upload:: + upload_handler_argument () + { + return this->upload_handler_argument_; + } + + inline void build_upload:: + upload_handler_argument (const std::multimap<string, string>& x) + { + this->upload_handler_argument_ = x; + } + + inline bool build_upload:: + upload_handler_argument_specified () const + { + return this->upload_handler_argument_specified_; + } + + inline void build_upload:: + upload_handler_argument_specified (bool x) + { + this->upload_handler_argument_specified_ = x; + } + + inline const std::map<string, size_t>& build_upload:: + upload_handler_timeout () const + { + return this->upload_handler_timeout_; + } + + inline std::map<string, size_t>& build_upload:: + upload_handler_timeout () + { + return this->upload_handler_timeout_; + } + + inline void build_upload:: + upload_handler_timeout (const std::map<string, size_t>& x) + { + this->upload_handler_timeout_ = x; + } + + inline bool build_upload:: + upload_handler_timeout_specified () const + { + return this->upload_handler_timeout_specified_; + } + + inline void build_upload:: + upload_handler_timeout_specified (bool x) + { + this->upload_handler_timeout_specified_ = x; + } + + inline const std::multimap<string, string>& build_upload:: + upload_toolchain_exclude () const + { + return this->upload_toolchain_exclude_; + } + + inline std::multimap<string, string>& build_upload:: + upload_toolchain_exclude () + { + return this->upload_toolchain_exclude_; + } + + inline void build_upload:: + upload_toolchain_exclude (const std::multimap<string, string>& x) + { + this->upload_toolchain_exclude_ = x; + } + + inline bool build_upload:: + upload_toolchain_exclude_specified () const + { + return this->upload_toolchain_exclude_specified_; + } + + inline void build_upload:: + upload_toolchain_exclude_specified (bool x) + { + this->upload_toolchain_exclude_specified_ = x; + } + + inline const std::multimap<string, string>& build_upload:: + upload_repository_exclude () const + { + return this->upload_repository_exclude_; + } + + inline std::multimap<string, string>& build_upload:: + upload_repository_exclude () + { + return this->upload_repository_exclude_; + } + + inline void build_upload:: + upload_repository_exclude (const std::multimap<string, string>& x) + { + this->upload_repository_exclude_ = x; + } + + inline bool build_upload:: + upload_repository_exclude_specified () const + { + return this->upload_repository_exclude_specified_; + } + + inline void build_upload:: + upload_repository_exclude_specified (bool x) + { + this->upload_repository_exclude_specified_ = x; + } + + // page + // + + inline const web::xhtml::fragment& page:: + logo () const + { + return this->logo_; + } + + inline web::xhtml::fragment& page:: + logo () + { + return this->logo_; + } + + inline void page:: + logo (const web::xhtml::fragment& x) + { + this->logo_ = x; + } + + inline bool page:: + logo_specified () const + { + return this->logo_specified_; + } + + inline void page:: + logo_specified (bool x) + { + this->logo_specified_ = x; + } + + inline const vector<page_menu>& page:: + menu () const + { + return this->menu_; + } + + inline vector<page_menu>& page:: + menu () + { + return this->menu_; + } + + inline void page:: + menu (const vector<page_menu>& x) + { + this->menu_ = x; + } + + inline bool page:: + menu_specified () const + { + return this->menu_specified_; + } + + inline void page:: + menu_specified (bool x) + { + this->menu_specified_ = x; + } + + // search + // + + inline const uint16_t& search:: + search_page_entries () const + { + return this->search_page_entries_; + } + + inline uint16_t& search:: + search_page_entries () + { + return this->search_page_entries_; + } + + inline void search:: + search_page_entries (const uint16_t& x) + { + this->search_page_entries_ = x; + } + + inline bool search:: + search_page_entries_specified () const + { + return this->search_page_entries_specified_; + } + + inline void search:: + search_page_entries_specified (bool x) + { + this->search_page_entries_specified_ = x; + } + + inline const uint16_t& search:: + search_pages () const + { + return this->search_pages_; + } + + inline uint16_t& search:: + search_pages () + { + return this->search_pages_; + } + + inline void search:: + search_pages (const uint16_t& x) + { + this->search_pages_ = x; + } + + inline bool search:: + search_pages_specified () const + { + return this->search_pages_specified_; + } + + inline void search:: + search_pages_specified (bool x) + { + this->search_pages_specified_ = x; + } + + // package + // + + inline const uint16_t& package:: + package_description () const + { + return this->package_description_; + } + + inline uint16_t& package:: + package_description () + { + return this->package_description_; + } + + inline void package:: + package_description (const uint16_t& x) + { + this->package_description_ = x; + } + + inline bool package:: + package_description_specified () const + { + return this->package_description_specified_; + } + + inline void package:: + package_description_specified (bool x) + { + this->package_description_specified_ = x; + } + + inline const uint16_t& package:: + package_changes () const + { + return this->package_changes_; + } + + inline uint16_t& package:: + package_changes () + { + return this->package_changes_; + } + + inline void package:: + package_changes (const uint16_t& x) + { + this->package_changes_ = x; + } + + inline bool package:: + package_changes_specified () const + { + return this->package_changes_specified_; + } + + inline void package:: + package_changes_specified (bool x) + { + this->package_changes_specified_ = x; + } + + // packages + // + + inline const string& packages:: + search_title () const + { + return this->search_title_; + } + + inline string& packages:: + search_title () + { + return this->search_title_; + } + + inline void packages:: + search_title (const string& x) + { + this->search_title_ = x; + } + + inline bool packages:: + search_title_specified () const + { + return this->search_title_specified_; + } + + inline void packages:: + search_title_specified (bool x) + { + this->search_title_specified_ = x; + } + + inline const web::xhtml::fragment& packages:: + search_description () const + { + return this->search_description_; + } + + inline web::xhtml::fragment& packages:: + search_description () + { + return this->search_description_; + } + + inline void packages:: + search_description (const web::xhtml::fragment& x) + { + this->search_description_ = x; + } + + inline bool packages:: + search_description_specified () const + { + return this->search_description_specified_; + } + + inline void packages:: + search_description_specified (bool x) + { + this->search_description_specified_ = x; + } + + // package_details + // + + // package_version_details + // + + inline const dir_path& package_version_details:: + bindist_root () const + { + return this->bindist_root_; + } + + inline dir_path& package_version_details:: + bindist_root () + { + return this->bindist_root_; + } + + inline void package_version_details:: + bindist_root (const dir_path& x) + { + this->bindist_root_ = x; + } + + inline bool package_version_details:: + bindist_root_specified () const + { + return this->bindist_root_specified_; + } + + inline void package_version_details:: + bindist_root_specified (bool x) + { + this->bindist_root_specified_ = x; + } + + inline const string& package_version_details:: + bindist_url () const + { + return this->bindist_url_; + } + + inline string& package_version_details:: + bindist_url () + { + return this->bindist_url_; + } + + inline void package_version_details:: + bindist_url (const string& x) + { + this->bindist_url_ = x; + } + + inline bool package_version_details:: + bindist_url_specified () const + { + return this->bindist_url_specified_; + } + + inline void package_version_details:: + bindist_url_specified (bool x) + { + this->bindist_url_specified_ = x; + } + + // repository_details + // + + // build_task + // + + inline const size_t& build_task:: + build_task_request_max_size () const + { + return this->build_task_request_max_size_; + } + + inline size_t& build_task:: + build_task_request_max_size () + { + return this->build_task_request_max_size_; + } + + inline void build_task:: + build_task_request_max_size (const size_t& x) + { + this->build_task_request_max_size_ = x; + } + + inline bool build_task:: + build_task_request_max_size_specified () const + { + return this->build_task_request_max_size_specified_; + } + + inline void build_task:: + build_task_request_max_size_specified (bool x) + { + this->build_task_request_max_size_specified_ = x; + } + + inline const size_t& build_task:: + build_result_timeout () const + { + return this->build_result_timeout_; + } + + inline size_t& build_task:: + build_result_timeout () + { + return this->build_result_timeout_; + } + + inline void build_task:: + build_result_timeout (const size_t& x) + { + this->build_result_timeout_ = x; + } + + inline bool build_task:: + build_result_timeout_specified () const + { + return this->build_result_timeout_specified_; + } + + inline void build_task:: + build_result_timeout_specified (bool x) + { + this->build_result_timeout_specified_ = x; + } + + inline const vector<pair<std::regex, string>>& build_task:: + build_interactive_login () const + { + return this->build_interactive_login_; + } + + inline vector<pair<std::regex, string>>& build_task:: + build_interactive_login () + { + return this->build_interactive_login_; + } + + inline void build_task:: + build_interactive_login (const vector<pair<std::regex, string>>& x) + { + this->build_interactive_login_ = x; + } + + inline bool build_task:: + build_interactive_login_specified () const + { + return this->build_interactive_login_specified_; + } + + inline void build_task:: + build_interactive_login_specified (bool x) + { + this->build_interactive_login_specified_ = x; + } + + inline const build_order& build_task:: + build_package_order () const + { + return this->build_package_order_; + } + + inline build_order& build_task:: + build_package_order () + { + return this->build_package_order_; + } + + inline void build_task:: + build_package_order (const build_order& x) + { + this->build_package_order_ = x; + } + + inline bool build_task:: + build_package_order_specified () const + { + return this->build_package_order_specified_; + } + + inline void build_task:: + build_package_order_specified (bool x) + { + this->build_package_order_specified_ = x; + } + + // build_result + // + + inline const size_t& build_result:: + build_result_request_max_size () const + { + return this->build_result_request_max_size_; + } + + inline size_t& build_result:: + build_result_request_max_size () + { + return this->build_result_request_max_size_; + } + + inline void build_result:: + build_result_request_max_size (const size_t& x) + { + this->build_result_request_max_size_ = x; + } + + inline bool build_result:: + build_result_request_max_size_specified () const + { + return this->build_result_request_max_size_specified_; + } + + inline void build_result:: + build_result_request_max_size_specified (bool x) + { + this->build_result_request_max_size_specified_ = x; + } + + // build_log + // + + // build_force + // + + // builds + // + + inline const uint16_t& builds:: + build_page_entries () const + { + return this->build_page_entries_; + } + + inline uint16_t& builds:: + build_page_entries () + { + return this->build_page_entries_; + } + + inline void builds:: + build_page_entries (const uint16_t& x) + { + this->build_page_entries_ = x; + } + + inline bool builds:: + build_page_entries_specified () const + { + return this->build_page_entries_specified_; + } + + inline void builds:: + build_page_entries_specified (bool x) + { + this->build_page_entries_specified_ = x; + } + + inline const uint16_t& builds:: + build_pages () const + { + return this->build_pages_; + } + + inline uint16_t& builds:: + build_pages () + { + return this->build_pages_; + } + + inline void builds:: + build_pages (const uint16_t& x) + { + this->build_pages_ = x; + } + + inline bool builds:: + build_pages_specified () const + { + return this->build_pages_specified_; + } + + inline void builds:: + build_pages_specified (bool x) + { + this->build_pages_specified_ = x; + } + + // build_configs + // + + inline const uint16_t& build_configs:: + build_config_page_entries () const + { + return this->build_config_page_entries_; + } + + inline uint16_t& build_configs:: + build_config_page_entries () + { + return this->build_config_page_entries_; + } + + inline void build_configs:: + build_config_page_entries (const uint16_t& x) + { + this->build_config_page_entries_ = x; + } + + inline bool build_configs:: + build_config_page_entries_specified () const + { + return this->build_config_page_entries_specified_; + } + + inline void build_configs:: + build_config_page_entries_specified (bool x) + { + this->build_config_page_entries_specified_ = x; + } + + inline const uint16_t& build_configs:: + build_config_pages () const + { + return this->build_config_pages_; + } + + inline uint16_t& build_configs:: + build_config_pages () + { + return this->build_config_pages_; + } + + inline void build_configs:: + build_config_pages (const uint16_t& x) + { + this->build_config_pages_ = x; + } + + inline bool build_configs:: + build_config_pages_specified () const + { + return this->build_config_pages_specified_; + } + + inline void build_configs:: + build_config_pages_specified (bool x) + { + this->build_config_pages_specified_ = x; + } + + // submit + // + + inline const dir_path& submit:: + submit_data () const + { + return this->submit_data_; + } + + inline dir_path& submit:: + submit_data () + { + return this->submit_data_; + } + + inline void submit:: + submit_data (const dir_path& x) + { + this->submit_data_ = x; + } + + inline bool submit:: + submit_data_specified () const + { + return this->submit_data_specified_; + } + + inline void submit:: + submit_data_specified (bool x) + { + this->submit_data_specified_ = x; + } + + inline const dir_path& submit:: + submit_temp () const + { + return this->submit_temp_; + } + + inline dir_path& submit:: + submit_temp () + { + return this->submit_temp_; + } + + inline void submit:: + submit_temp (const dir_path& x) + { + this->submit_temp_ = x; + } + + inline bool submit:: + submit_temp_specified () const + { + return this->submit_temp_specified_; + } + + inline void submit:: + submit_temp_specified (bool x) + { + this->submit_temp_specified_ = x; + } + + inline const size_t& submit:: + submit_max_size () const + { + return this->submit_max_size_; + } + + inline size_t& submit:: + submit_max_size () + { + return this->submit_max_size_; + } + + inline void submit:: + submit_max_size (const size_t& x) + { + this->submit_max_size_ = x; + } + + inline bool submit:: + submit_max_size_specified () const + { + return this->submit_max_size_specified_; + } + + inline void submit:: + submit_max_size_specified (bool x) + { + this->submit_max_size_specified_ = x; + } + + inline const path& submit:: + submit_form () const + { + return this->submit_form_; + } + + inline path& submit:: + submit_form () + { + return this->submit_form_; + } + + inline void submit:: + submit_form (const path& x) + { + this->submit_form_ = x; + } + + inline bool submit:: + submit_form_specified () const + { + return this->submit_form_specified_; + } + + inline void submit:: + submit_form_specified (bool x) + { + this->submit_form_specified_ = x; + } + + inline const string& submit:: + submit_email () const + { + return this->submit_email_; + } + + inline string& submit:: + submit_email () + { + return this->submit_email_; + } + + inline void submit:: + submit_email (const string& x) + { + this->submit_email_ = x; + } + + inline bool submit:: + submit_email_specified () const + { + return this->submit_email_specified_; + } + + inline void submit:: + submit_email_specified (bool x) + { + this->submit_email_specified_ = x; + } + + inline const path& submit:: + submit_handler () const + { + return this->submit_handler_; + } + + inline path& submit:: + submit_handler () + { + return this->submit_handler_; + } + + inline void submit:: + submit_handler (const path& x) + { + this->submit_handler_ = x; + } + + inline bool submit:: + submit_handler_specified () const + { + return this->submit_handler_specified_; + } + + inline void submit:: + submit_handler_specified (bool x) + { + this->submit_handler_specified_ = x; + } + + inline const strings& submit:: + submit_handler_argument () const + { + return this->submit_handler_argument_; + } + + inline strings& submit:: + submit_handler_argument () + { + return this->submit_handler_argument_; + } + + inline void submit:: + submit_handler_argument (const strings& x) + { + this->submit_handler_argument_ = x; + } + + inline bool submit:: + submit_handler_argument_specified () const + { + return this->submit_handler_argument_specified_; + } + + inline void submit:: + submit_handler_argument_specified (bool x) + { + this->submit_handler_argument_specified_ = x; + } + + inline const size_t& submit:: + submit_handler_timeout () const + { + return this->submit_handler_timeout_; + } + + inline size_t& submit:: + submit_handler_timeout () + { + return this->submit_handler_timeout_; + } + + inline void submit:: + submit_handler_timeout (const size_t& x) + { + this->submit_handler_timeout_ = x; + } + + inline bool submit:: + submit_handler_timeout_specified () const + { + return this->submit_handler_timeout_specified_; + } + + inline void submit:: + submit_handler_timeout_specified (bool x) + { + this->submit_handler_timeout_specified_ = x; + } + + // ci_start + // + + inline const dir_path& ci_start:: + ci_data () const + { + return this->ci_data_; + } + + inline dir_path& ci_start:: + ci_data () + { + return this->ci_data_; + } + + inline void ci_start:: + ci_data (const dir_path& x) + { + this->ci_data_ = x; + } + + inline bool ci_start:: + ci_data_specified () const + { + return this->ci_data_specified_; + } + + inline void ci_start:: + ci_data_specified (bool x) + { + this->ci_data_specified_ = x; + } + + inline const string& ci_start:: + ci_email () const + { + return this->ci_email_; + } + + inline string& ci_start:: + ci_email () + { + return this->ci_email_; + } + + inline void ci_start:: + ci_email (const string& x) + { + this->ci_email_ = x; + } + + inline bool ci_start:: + ci_email_specified () const + { + return this->ci_email_specified_; + } + + inline void ci_start:: + ci_email_specified (bool x) + { + this->ci_email_specified_ = x; + } + + inline const path& ci_start:: + ci_handler () const + { + return this->ci_handler_; + } + + inline path& ci_start:: + ci_handler () + { + return this->ci_handler_; + } + + inline void ci_start:: + ci_handler (const path& x) + { + this->ci_handler_ = x; + } + + inline bool ci_start:: + ci_handler_specified () const + { + return this->ci_handler_specified_; + } + + inline void ci_start:: + ci_handler_specified (bool x) + { + this->ci_handler_specified_ = x; + } + + inline const strings& ci_start:: + ci_handler_argument () const + { + return this->ci_handler_argument_; + } + + inline strings& ci_start:: + ci_handler_argument () + { + return this->ci_handler_argument_; + } + + inline void ci_start:: + ci_handler_argument (const strings& x) + { + this->ci_handler_argument_ = x; + } + + inline bool ci_start:: + ci_handler_argument_specified () const + { + return this->ci_handler_argument_specified_; + } + + inline void ci_start:: + ci_handler_argument_specified (bool x) + { + this->ci_handler_argument_specified_ = x; + } + + inline const size_t& ci_start:: + ci_handler_timeout () const + { + return this->ci_handler_timeout_; + } + + inline size_t& ci_start:: + ci_handler_timeout () + { + return this->ci_handler_timeout_; + } + + inline void ci_start:: + ci_handler_timeout (const size_t& x) + { + this->ci_handler_timeout_ = x; + } + + inline bool ci_start:: + ci_handler_timeout_specified () const + { + return this->ci_handler_timeout_specified_; + } + + inline void ci_start:: + ci_handler_timeout_specified (bool x) + { + this->ci_handler_timeout_specified_ = x; + } + + // ci_cancel + // + + // ci + // + + inline const path& ci:: + ci_form () const + { + return this->ci_form_; + } + + inline path& ci:: + ci_form () + { + return this->ci_form_; + } + + inline void ci:: + ci_form (const path& x) + { + this->ci_form_ = x; + } + + inline bool ci:: + ci_form_specified () const + { + return this->ci_form_specified_; + } + + inline void ci:: + ci_form_specified (bool x) + { + this->ci_form_specified_ = x; + } + + // ci_github + // + + // upload + // + + // repository_root + // + + inline const string& repository_root:: + root_global_view () const + { + return this->root_global_view_; + } + + inline string& repository_root:: + root_global_view () + { + return this->root_global_view_; + } + + inline void repository_root:: + root_global_view (const string& x) + { + this->root_global_view_ = x; + } + + inline bool repository_root:: + root_global_view_specified () const + { + return this->root_global_view_specified_; + } + + inline void repository_root:: + root_global_view_specified (bool x) + { + this->root_global_view_specified_ = x; + } + + inline const string& repository_root:: + root_tenant_view () const + { + return this->root_tenant_view_; + } + + inline string& repository_root:: + root_tenant_view () + { + return this->root_tenant_view_; + } + + inline void repository_root:: + root_tenant_view (const string& x) + { + this->root_tenant_view_ = x; + } + + inline bool repository_root:: + root_tenant_view_specified () const + { + return this->root_tenant_view_specified_; + } + + inline void repository_root:: + root_tenant_view_specified (bool x) + { + this->root_tenant_view_specified_ = x; + } + } + + namespace params + { + // packages + // + + inline const uint16_t& packages:: + page () const + { + return this->page_; + } + + inline uint16_t& packages:: + page () + { + return this->page_; + } + + inline void packages:: + page (const uint16_t& x) + { + this->page_ = x; + } + + inline bool packages:: + page_specified () const + { + return this->page_specified_; + } + + inline void packages:: + page_specified (bool x) + { + this->page_specified_ = x; + } + + inline const string& packages:: + q () const + { + return this->q_; + } + + inline string& packages:: + q () + { + return this->q_; + } + + inline void packages:: + q (const string& x) + { + this->q_ = x; + } + + inline bool packages:: + q_specified () const + { + return this->q_specified_; + } + + inline void packages:: + q_specified (bool x) + { + this->q_specified_ = x; + } + + // package_details + // + + inline const uint16_t& package_details:: + page () const + { + return this->page_; + } + + inline uint16_t& package_details:: + page () + { + return this->page_; + } + + inline void package_details:: + page (const uint16_t& x) + { + this->page_ = x; + } + + inline bool package_details:: + page_specified () const + { + return this->page_specified_; + } + + inline void package_details:: + page_specified (bool x) + { + this->page_specified_ = x; + } + + inline const string& package_details:: + query () const + { + return this->query_; + } + + inline string& package_details:: + query () + { + return this->query_; + } + + inline void package_details:: + query (const string& x) + { + this->query_ = x; + } + + inline bool package_details:: + query_specified () const + { + return this->query_specified_; + } + + inline void package_details:: + query_specified (bool x) + { + this->query_specified_ = x; + } + + inline const page_form& package_details:: + form () const + { + return this->form_; + } + + inline page_form& package_details:: + form () + { + return this->form_; + } + + inline void package_details:: + form (const page_form& x) + { + this->form_ = x; + } + + inline bool package_details:: + form_specified () const + { + return this->form_specified_; + } + + inline void package_details:: + form_specified (bool x) + { + this->form_specified_ = x; + } + + // package_version_details + // + + inline const page_form& package_version_details:: + form () const + { + return this->form_; + } + + inline page_form& package_version_details:: + form () + { + return this->form_; + } + + inline void package_version_details:: + form (const page_form& x) + { + this->form_ = x; + } + + inline bool package_version_details:: + form_specified () const + { + return this->form_specified_; + } + + inline void package_version_details:: + form_specified (bool x) + { + this->form_specified_ = x; + } + + // repository_details + // + + // build_task + // + + inline const vector<string>& build_task:: + repository () const + { + return this->repository_; + } + + inline vector<string>& build_task:: + repository () + { + return this->repository_; + } + + inline void build_task:: + repository (const vector<string>& x) + { + this->repository_ = x; + } + + inline bool build_task:: + repository_specified () const + { + return this->repository_specified_; + } + + inline void build_task:: + repository_specified (bool x) + { + this->repository_specified_ = x; + } + + inline const bbot::interactive_mode& build_task:: + interactive () const + { + return this->interactive_; + } + + inline bbot::interactive_mode& build_task:: + interactive () + { + return this->interactive_; + } + + inline void build_task:: + interactive (const bbot::interactive_mode& x) + { + this->interactive_ = x; + } + + inline bool build_task:: + interactive_specified () const + { + return this->interactive_specified_; + } + + inline void build_task:: + interactive_specified (bool x) + { + this->interactive_specified_ = x; + } + + // build_result + // + + // build_log + // + + // build_force + // + + inline const string& build_force:: + package () const + { + return this->package_; + } + + inline string& build_force:: + package () + { + return this->package_; + } + + inline void build_force:: + package (const string& x) + { + this->package_ = x; + } + + inline bool build_force:: + package_specified () const + { + return this->package_specified_; + } + + inline void build_force:: + package_specified (bool x) + { + this->package_specified_ = x; + } + + inline const string& build_force:: + version () const + { + return this->version_; + } + + inline string& build_force:: + version () + { + return this->version_; + } + + inline void build_force:: + version (const string& x) + { + this->version_ = x; + } + + inline bool build_force:: + version_specified () const + { + return this->version_specified_; + } + + inline void build_force:: + version_specified (bool x) + { + this->version_specified_ = x; + } + + inline const string& build_force:: + target () const + { + return this->target_; + } + + inline string& build_force:: + target () + { + return this->target_; + } + + inline void build_force:: + target (const string& x) + { + this->target_ = x; + } + + inline bool build_force:: + target_specified () const + { + return this->target_specified_; + } + + inline void build_force:: + target_specified (bool x) + { + this->target_specified_ = x; + } + + inline const string& build_force:: + target_config () const + { + return this->target_config_; + } + + inline string& build_force:: + target_config () + { + return this->target_config_; + } + + inline void build_force:: + target_config (const string& x) + { + this->target_config_ = x; + } + + inline bool build_force:: + target_config_specified () const + { + return this->target_config_specified_; + } + + inline void build_force:: + target_config_specified (bool x) + { + this->target_config_specified_ = x; + } + + inline const string& build_force:: + package_config () const + { + return this->package_config_; + } + + inline string& build_force:: + package_config () + { + return this->package_config_; + } + + inline void build_force:: + package_config (const string& x) + { + this->package_config_ = x; + } + + inline bool build_force:: + package_config_specified () const + { + return this->package_config_specified_; + } + + inline void build_force:: + package_config_specified (bool x) + { + this->package_config_specified_ = x; + } + + inline const string& build_force:: + toolchain_name () const + { + return this->toolchain_name_; + } + + inline string& build_force:: + toolchain_name () + { + return this->toolchain_name_; + } + + inline void build_force:: + toolchain_name (const string& x) + { + this->toolchain_name_ = x; + } + + inline bool build_force:: + toolchain_name_specified () const + { + return this->toolchain_name_specified_; + } + + inline void build_force:: + toolchain_name_specified (bool x) + { + this->toolchain_name_specified_ = x; + } + + inline const string& build_force:: + toolchain_version () const + { + return this->toolchain_version_; + } + + inline string& build_force:: + toolchain_version () + { + return this->toolchain_version_; + } + + inline void build_force:: + toolchain_version (const string& x) + { + this->toolchain_version_ = x; + } + + inline bool build_force:: + toolchain_version_specified () const + { + return this->toolchain_version_specified_; + } + + inline void build_force:: + toolchain_version_specified (bool x) + { + this->toolchain_version_specified_ = x; + } + + inline const string& build_force:: + reason () const + { + return this->reason_; + } + + inline string& build_force:: + reason () + { + return this->reason_; + } + + inline void build_force:: + reason (const string& x) + { + this->reason_ = x; + } + + inline bool build_force:: + reason_specified () const + { + return this->reason_specified_; + } + + inline void build_force:: + reason_specified (bool x) + { + this->reason_specified_ = x; + } + + // builds + // + + inline const uint16_t& builds:: + page () const + { + return this->page_; + } + + inline uint16_t& builds:: + page () + { + return this->page_; + } + + inline void builds:: + page (const uint16_t& x) + { + this->page_ = x; + } + + inline bool builds:: + page_specified () const + { + return this->page_specified_; + } + + inline void builds:: + page_specified (bool x) + { + this->page_specified_ = x; + } + + inline const string& builds:: + name () const + { + return this->name_; + } + + inline string& builds:: + name () + { + return this->name_; + } + + inline void builds:: + name (const string& x) + { + this->name_ = x; + } + + inline bool builds:: + name_specified () const + { + return this->name_specified_; + } + + inline void builds:: + name_specified (bool x) + { + this->name_specified_ = x; + } + + inline const string& builds:: + version () const + { + return this->version_; + } + + inline string& builds:: + version () + { + return this->version_; + } + + inline void builds:: + version (const string& x) + { + this->version_ = x; + } + + inline bool builds:: + version_specified () const + { + return this->version_specified_; + } + + inline void builds:: + version_specified (bool x) + { + this->version_specified_ = x; + } + + inline const string& builds:: + toolchain () const + { + return this->toolchain_; + } + + inline string& builds:: + toolchain () + { + return this->toolchain_; + } + + inline void builds:: + toolchain (const string& x) + { + this->toolchain_ = x; + } + + inline bool builds:: + toolchain_specified () const + { + return this->toolchain_specified_; + } + + inline void builds:: + toolchain_specified (bool x) + { + this->toolchain_specified_ = x; + } + + inline const string& builds:: + target () const + { + return this->target_; + } + + inline string& builds:: + target () + { + return this->target_; + } + + inline void builds:: + target (const string& x) + { + this->target_ = x; + } + + inline bool builds:: + target_specified () const + { + return this->target_specified_; + } + + inline void builds:: + target_specified (bool x) + { + this->target_specified_ = x; + } + + inline const string& builds:: + target_config () const + { + return this->target_config_; + } + + inline string& builds:: + target_config () + { + return this->target_config_; + } + + inline void builds:: + target_config (const string& x) + { + this->target_config_ = x; + } + + inline bool builds:: + target_config_specified () const + { + return this->target_config_specified_; + } + + inline void builds:: + target_config_specified (bool x) + { + this->target_config_specified_ = x; + } + + inline const string& builds:: + package_config () const + { + return this->package_config_; + } + + inline string& builds:: + package_config () + { + return this->package_config_; + } + + inline void builds:: + package_config (const string& x) + { + this->package_config_ = x; + } + + inline bool builds:: + package_config_specified () const + { + return this->package_config_specified_; + } + + inline void builds:: + package_config_specified (bool x) + { + this->package_config_specified_ = x; + } + + inline const string& builds:: + result () const + { + return this->result_; + } + + inline string& builds:: + result () + { + return this->result_; + } + + inline void builds:: + result (const string& x) + { + this->result_ = x; + } + + inline bool builds:: + result_specified () const + { + return this->result_specified_; + } + + inline void builds:: + result_specified (bool x) + { + this->result_specified_ = x; + } + + // build_configs + // + + inline const string& build_configs:: + class_name () const + { + return this->class_name_; + } + + inline string& build_configs:: + class_name () + { + return this->class_name_; + } + + inline void build_configs:: + class_name (const string& x) + { + this->class_name_ = x; + } + + inline bool build_configs:: + class_name_specified () const + { + return this->class_name_specified_; + } + + inline void build_configs:: + class_name_specified (bool x) + { + this->class_name_specified_ = x; + } + + inline const uint16_t& build_configs:: + page () const + { + return this->page_; + } + + inline uint16_t& build_configs:: + page () + { + return this->page_; + } + + inline void build_configs:: + page (const uint16_t& x) + { + this->page_ = x; + } + + inline bool build_configs:: + page_specified () const + { + return this->page_specified_; + } + + inline void build_configs:: + page_specified (bool x) + { + this->page_specified_ = x; + } + + // submit + // + + inline const string& submit:: + archive () const + { + return this->archive_; + } + + inline string& submit:: + archive () + { + return this->archive_; + } + + inline void submit:: + archive (const string& x) + { + this->archive_ = x; + } + + inline bool submit:: + archive_specified () const + { + return this->archive_specified_; + } + + inline void submit:: + archive_specified (bool x) + { + this->archive_specified_ = x; + } + + inline const string& submit:: + sha256sum () const + { + return this->sha256sum_; + } + + inline string& submit:: + sha256sum () + { + return this->sha256sum_; + } + + inline void submit:: + sha256sum (const string& x) + { + this->sha256sum_ = x; + } + + inline bool submit:: + sha256sum_specified () const + { + return this->sha256sum_specified_; + } + + inline void submit:: + sha256sum_specified (bool x) + { + this->sha256sum_specified_ = x; + } + + inline const string& submit:: + simulate () const + { + return this->simulate_; + } + + inline string& submit:: + simulate () + { + return this->simulate_; + } + + inline void submit:: + simulate (const string& x) + { + this->simulate_ = x; + } + + inline bool submit:: + simulate_specified () const + { + return this->simulate_specified_; + } + + inline void submit:: + simulate_specified (bool x) + { + this->simulate_specified_ = x; + } + + // ci + // + + inline const bpkg::repository_location& ci:: + repository () const + { + return this->repository_; + } + + inline bpkg::repository_location& ci:: + repository () + { + return this->repository_; + } + + inline void ci:: + repository (const bpkg::repository_location& x) + { + this->repository_ = x; + } + + inline bool ci:: + repository_specified () const + { + return this->repository_specified_; + } + + inline void ci:: + repository_specified (bool x) + { + this->repository_specified_ = x; + } + + inline const strings& ci:: + package () const + { + return this->package_; + } + + inline strings& ci:: + package () + { + return this->package_; + } + + inline void ci:: + package (const strings& x) + { + this->package_ = x; + } + + inline bool ci:: + package_specified () const + { + return this->package_specified_; + } + + inline void ci:: + package_specified (bool x) + { + this->package_specified_ = x; + } + + inline const string& ci:: + overrides () const + { + return this->overrides_; + } + + inline string& ci:: + overrides () + { + return this->overrides_; + } + + inline void ci:: + overrides (const string& x) + { + this->overrides_ = x; + } + + inline bool ci:: + overrides_specified () const + { + return this->overrides_specified_; + } + + inline void ci:: + overrides_specified (bool x) + { + this->overrides_specified_ = x; + } + + inline const string& ci:: + interactive () const + { + return this->interactive_; + } + + inline string& ci:: + interactive () + { + return this->interactive_; + } + + inline void ci:: + interactive (const string& x) + { + this->interactive_ = x; + } + + inline bool ci:: + interactive_specified () const + { + return this->interactive_specified_; + } + + inline void ci:: + interactive_specified (bool x) + { + this->interactive_specified_ = x; + } + + inline const string& ci:: + simulate () const + { + return this->simulate_; + } + + inline string& ci:: + simulate () + { + return this->simulate_; + } + + inline void ci:: + simulate (const string& x) + { + this->simulate_ = x; + } + + inline bool ci:: + simulate_specified () const + { + return this->simulate_specified_; + } + + inline void ci:: + simulate_specified (bool x) + { + this->simulate_specified_ = x; + } + + // upload + // + + inline const string& upload:: + type () const + { + return this->type_; + } + + inline string& upload:: + type () + { + return this->type_; + } + + inline void upload:: + type (const string& x) + { + this->type_ = x; + } + + inline bool upload:: + type_specified () const + { + return this->type_specified_; + } + + inline void upload:: + type_specified (bool x) + { + this->type_specified_ = x; + } + + inline const string& upload:: + session () const + { + return this->session_; + } + + inline string& upload:: + session () + { + return this->session_; + } + + inline void upload:: + session (const string& x) + { + this->session_ = x; + } + + inline bool upload:: + session_specified () const + { + return this->session_specified_; + } + + inline void upload:: + session_specified (bool x) + { + this->session_specified_ = x; + } + + inline const string& upload:: + challenge () const + { + return this->challenge_; + } + + inline string& upload:: + challenge () + { + return this->challenge_; + } + + inline void upload:: + challenge (const string& x) + { + this->challenge_ = x; + } + + inline bool upload:: + challenge_specified () const + { + return this->challenge_specified_; + } + + inline void upload:: + challenge_specified (bool x) + { + this->challenge_specified_ = x; + } + + inline const string& upload:: + instance () const + { + return this->instance_; + } + + inline string& upload:: + instance () + { + return this->instance_; + } + + inline void upload:: + instance (const string& x) + { + this->instance_ = x; + } + + inline bool upload:: + instance_specified () const + { + return this->instance_specified_; + } + + inline void upload:: + instance_specified (bool x) + { + this->instance_specified_ = x; + } + + inline const string& upload:: + archive () const + { + return this->archive_; + } + + inline string& upload:: + archive () + { + return this->archive_; + } + + inline void upload:: + archive (const string& x) + { + this->archive_ = x; + } + + inline bool upload:: + archive_specified () const + { + return this->archive_specified_; + } + + inline void upload:: + archive_specified (bool x) + { + this->archive_specified_ = x; + } + + inline const string& upload:: + sha256sum () const + { + return this->sha256sum_; + } + + inline string& upload:: + sha256sum () + { + return this->sha256sum_; + } + + inline void upload:: + sha256sum (const string& x) + { + this->sha256sum_ = x; + } + + inline bool upload:: + sha256sum_specified () const + { + return this->sha256sum_specified_; + } + + inline void upload:: + sha256sum_specified (bool x) + { + this->sha256sum_specified_ = x; + } + } +} + +// Begin epilogue. +// +// +// End epilogue. diff --git a/monitor/module-options.cxx b/monitor/module-options.cxx new file mode 100644 index 0000000..f7c0ec2 --- /dev/null +++ b/monitor/module-options.cxx @@ -0,0 +1,545 @@ +// -*- C++ -*- +// +// This file was generated by CLI, a command line interface +// compiler for C++. +// + +// Begin prologue. +// +// +// End prologue. + +#include <monitor/module-options.hxx> + +#include <map> +#include <set> +#include <string> +#include <vector> +#include <utility> +#include <ostream> +#include <sstream> +#include <cstring> + +namespace brep +{ + namespace cli + { + 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, bool& xs, scanner& s) + { + const char* o (s.next ()); + + if (s.more ()) + { + const char* v (s.next ()); + + if (std::strcmp (v, "1") == 0 || + std::strcmp (v, "true") == 0 || + std::strcmp (v, "TRUE") == 0 || + std::strcmp (v, "True") == 0) + x = true; + else if (std::strcmp (v, "0") == 0 || + std::strcmp (v, "false") == 0 || + std::strcmp (v, "FALSE") == 0 || + std::strcmp (v, "False") == 0) + x = false; + else + throw invalid_value (o, v); + } + else + throw missing_value (o); + + xs = 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::pair<X, std::size_t> > + { + static void + parse (std::pair<X, std::size_t>& x, bool& xs, scanner& s) + { + x.second = s.position (); + parser<X>::parse (x.first, xs, s); + } + }; + + 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::size_t pos (s.position ()); + 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, false, pos); + parser<K>::parse (k, dummy, s); + } + + if (!vstr.empty ()) + { + av[1] = const_cast<char*> (vstr.c_str ()); + argv_scanner s (0, ac, av, false, pos); + parser<V>::parse (v, dummy, s); + } + + m[k] = v; + } + else + throw missing_value (o); + + xs = true; + } + }; + + template <typename K, typename V, typename C> + struct parser<std::multimap<K, V, C> > + { + static void + parse (std::multimap<K, V, C>& m, bool& xs, scanner& s) + { + const char* o (s.next ()); + + if (s.more ()) + { + std::size_t pos (s.position ()); + 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, false, pos); + parser<K>::parse (k, dummy, s); + } + + if (!vstr.empty ()) + { + av[1] = const_cast<char*> (vstr.c_str ()); + argv_scanner s (0, ac, av, false, pos); + parser<V>::parse (v, dummy, s); + } + + m.insert (typename std::multimap<K, V, C>::value_type (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, bool X::*M> + void + thunk (X& x, scanner& s) + { + s.next (); + x.*M = true; + } + + 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> + +namespace brep +{ + namespace options + { + // module + // + + module:: + module () + { + } + + bool module:: + parse (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + bool r = _parse (s, opt, arg); + return r; + } + + bool module:: + parse (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + bool r = _parse (s, opt, arg); + return r; + } + + bool module:: + parse (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + bool r = _parse (s, opt, arg); + end = s.end (); + return r; + } + + bool module:: + parse (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + bool r = _parse (s, opt, arg); + end = s.end (); + return r; + } + + bool module:: + parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + bool r = _parse (s, opt, arg); + return r; + } + + typedef + std::map<std::string, void (*) (module&, ::brep::cli::scanner&)> + _cli_module_map; + + static _cli_module_map _cli_module_map_; + + struct _cli_module_map_init + { + _cli_module_map_init () + { + } + }; + + static _cli_module_map_init _cli_module_map_init_; + + bool module:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_module_map::const_iterator i (_cli_module_map_.find (o)); + + if (i != _cli_module_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // build_task base + // + if (::brep::options::build_task::_parse (o, s)) + return true; + + return false; + } + + bool module:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt_mode, + ::brep::cli::unknown_mode arg_mode) + { + // Can't skip combined flags (--no-combined-flags). + // + assert (opt_mode != ::brep::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) + }; + + ::brep::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 ::brep::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 + }; + + ::brep::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 ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_option (o); + } + } + + break; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + } +} + +// Begin epilogue. +// +// +// End epilogue. + diff --git a/monitor/module-options.hxx b/monitor/module-options.hxx new file mode 100644 index 0000000..d4eaf16 --- /dev/null +++ b/monitor/module-options.hxx @@ -0,0 +1,91 @@ +// -*- C++ -*- +// +// This file was generated by CLI, a command line interface +// compiler for C++. +// + +#ifndef MONITOR_MODULE_OPTIONS_HXX +#define MONITOR_MODULE_OPTIONS_HXX + +// Begin prologue. +// +// +// End prologue. + +#include <mod/module-options.hxx> + +namespace brep +{ + namespace options + { + class module: public ::brep::options::build_task + { + public: + module (); + + // Return true if anything has been parsed. + // + bool + parse (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + bool + parse (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + bool + parse (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + bool + parse (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + bool + parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors. + // + // Implementation details. + // + protected: + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + }; + } +} + +#include <monitor/module-options.ixx> + +// Begin epilogue. +// +// +// End epilogue. + +#endif // MONITOR_MODULE_OPTIONS_HXX diff --git a/monitor/module-options.ixx b/monitor/module-options.ixx new file mode 100644 index 0000000..e456fc4 --- /dev/null +++ b/monitor/module-options.ixx @@ -0,0 +1,24 @@ +// -*- C++ -*- +// +// This file was generated by CLI, a command line interface +// compiler for C++. +// + +// Begin prologue. +// +// +// End prologue. + +namespace brep +{ + namespace options + { + // module + // + } +} + +// Begin epilogue. +// +// +// End epilogue. diff --git a/monitor/monitor-options.cxx b/monitor/monitor-options.cxx new file mode 100644 index 0000000..d56f19d --- /dev/null +++ b/monitor/monitor-options.cxx @@ -0,0 +1,913 @@ +// -*- C++ -*- +// +// This file was generated by CLI, a command line interface +// compiler for C++. +// + +// Begin prologue. +// +// +// End prologue. + +#include <monitor/monitor-options.hxx> + +#include <map> +#include <set> +#include <string> +#include <vector> +#include <utility> +#include <ostream> +#include <sstream> +#include <cstring> + +namespace brep +{ + namespace cli + { + 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, bool& xs, scanner& s) + { + const char* o (s.next ()); + + if (s.more ()) + { + const char* v (s.next ()); + + if (std::strcmp (v, "1") == 0 || + std::strcmp (v, "true") == 0 || + std::strcmp (v, "TRUE") == 0 || + std::strcmp (v, "True") == 0) + x = true; + else if (std::strcmp (v, "0") == 0 || + std::strcmp (v, "false") == 0 || + std::strcmp (v, "FALSE") == 0 || + std::strcmp (v, "False") == 0) + x = false; + else + throw invalid_value (o, v); + } + else + throw missing_value (o); + + xs = 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::pair<X, std::size_t> > + { + static void + parse (std::pair<X, std::size_t>& x, bool& xs, scanner& s) + { + x.second = s.position (); + parser<X>::parse (x.first, xs, s); + } + }; + + 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::size_t pos (s.position ()); + 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, false, pos); + parser<K>::parse (k, dummy, s); + } + + if (!vstr.empty ()) + { + av[1] = const_cast<char*> (vstr.c_str ()); + argv_scanner s (0, ac, av, false, pos); + parser<V>::parse (v, dummy, s); + } + + m[k] = v; + } + else + throw missing_value (o); + + xs = true; + } + }; + + template <typename K, typename V, typename C> + struct parser<std::multimap<K, V, C> > + { + static void + parse (std::multimap<K, V, C>& m, bool& xs, scanner& s) + { + const char* o (s.next ()); + + if (s.more ()) + { + std::size_t pos (s.position ()); + 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, false, pos); + parser<K>::parse (k, dummy, s); + } + + if (!vstr.empty ()) + { + av[1] = const_cast<char*> (vstr.c_str ()); + argv_scanner s (0, ac, av, false, pos); + parser<V>::parse (v, dummy, s); + } + + m.insert (typename std::multimap<K, V, C>::value_type (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, bool X::*M> + void + thunk (X& x, scanner& s) + { + s.next (); + x.*M = true; + } + + 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> + +namespace brep +{ + namespace options + { + // monitor + // + + monitor:: + monitor () + : soft_rebuild_timeout_ (), + soft_rebuild_timeout_specified_ (false), + hard_rebuild_timeout_ (), + hard_rebuild_timeout_specified_ (false), + report_timeout_ (), + report_timeout_specified_ (false), + full_report_ (), + clean_ (), + build_db_user_ (), + build_db_user_specified_ (false), + build_db_password_ (), + build_db_password_specified_ (false), + build_db_name_ ("brep_package"), + build_db_name_specified_ (false), + build_db_host_ (), + build_db_host_specified_ (false), + build_db_port_ (), + build_db_port_specified_ (false), + pager_ (), + pager_specified_ (false), + pager_option_ (), + pager_option_specified_ (false), + help_ (), + version_ () + { + } + + monitor:: + monitor (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : soft_rebuild_timeout_ (), + soft_rebuild_timeout_specified_ (false), + hard_rebuild_timeout_ (), + hard_rebuild_timeout_specified_ (false), + report_timeout_ (), + report_timeout_specified_ (false), + full_report_ (), + clean_ (), + build_db_user_ (), + build_db_user_specified_ (false), + build_db_password_ (), + build_db_password_specified_ (false), + build_db_name_ ("brep_package"), + build_db_name_specified_ (false), + build_db_host_ (), + build_db_host_specified_ (false), + build_db_port_ (), + build_db_port_specified_ (false), + pager_ (), + pager_specified_ (false), + pager_option_ (), + pager_option_specified_ (false), + help_ (), + version_ () + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + monitor:: + monitor (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : soft_rebuild_timeout_ (), + soft_rebuild_timeout_specified_ (false), + hard_rebuild_timeout_ (), + hard_rebuild_timeout_specified_ (false), + report_timeout_ (), + report_timeout_specified_ (false), + full_report_ (), + clean_ (), + build_db_user_ (), + build_db_user_specified_ (false), + build_db_password_ (), + build_db_password_specified_ (false), + build_db_name_ ("brep_package"), + build_db_name_specified_ (false), + build_db_host_ (), + build_db_host_specified_ (false), + build_db_port_ (), + build_db_port_specified_ (false), + pager_ (), + pager_specified_ (false), + pager_option_ (), + pager_option_specified_ (false), + help_ (), + version_ () + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + monitor:: + monitor (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : soft_rebuild_timeout_ (), + soft_rebuild_timeout_specified_ (false), + hard_rebuild_timeout_ (), + hard_rebuild_timeout_specified_ (false), + report_timeout_ (), + report_timeout_specified_ (false), + full_report_ (), + clean_ (), + build_db_user_ (), + build_db_user_specified_ (false), + build_db_password_ (), + build_db_password_specified_ (false), + build_db_name_ ("brep_package"), + build_db_name_specified_ (false), + build_db_host_ (), + build_db_host_specified_ (false), + build_db_port_ (), + build_db_port_specified_ (false), + pager_ (), + pager_specified_ (false), + pager_option_ (), + pager_option_specified_ (false), + help_ (), + version_ () + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + monitor:: + monitor (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : soft_rebuild_timeout_ (), + soft_rebuild_timeout_specified_ (false), + hard_rebuild_timeout_ (), + hard_rebuild_timeout_specified_ (false), + report_timeout_ (), + report_timeout_specified_ (false), + full_report_ (), + clean_ (), + build_db_user_ (), + build_db_user_specified_ (false), + build_db_password_ (), + build_db_password_specified_ (false), + build_db_name_ ("brep_package"), + build_db_name_specified_ (false), + build_db_host_ (), + build_db_host_specified_ (false), + build_db_port_ (), + build_db_port_specified_ (false), + pager_ (), + pager_specified_ (false), + pager_option_ (), + pager_option_specified_ (false), + help_ (), + version_ () + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + monitor:: + monitor (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : soft_rebuild_timeout_ (), + soft_rebuild_timeout_specified_ (false), + hard_rebuild_timeout_ (), + hard_rebuild_timeout_specified_ (false), + report_timeout_ (), + report_timeout_specified_ (false), + full_report_ (), + clean_ (), + build_db_user_ (), + build_db_user_specified_ (false), + build_db_password_ (), + build_db_password_specified_ (false), + build_db_name_ ("brep_package"), + build_db_name_specified_ (false), + build_db_host_ (), + build_db_host_specified_ (false), + build_db_port_ (), + build_db_port_specified_ (false), + pager_ (), + pager_specified_ (false), + pager_option_ (), + pager_option_specified_ (false), + help_ (), + version_ () + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para monitor:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p != ::brep::cli::usage_para::none) + os << ::std::endl; + + os << "\033[1mOPTIONS\033[0m" << ::std::endl; + + os << std::endl + << "\033[1m--soft-rebuild-timeout\033[0m \033[4mseconds\033[0m Time to wait (in seconds) before considering a" << ::std::endl + << " package soft (re)build as delayed. If" << ::std::endl + << " unspecified, it is the sum of the package" << ::std::endl + << " rebuild timeout (soft rebuild timeout if the" << ::std::endl + << " alternative timeout is unspecified and the" << ::std::endl + << " maximum of two otherwise) and the build result" << ::std::endl + << " timeout (see the \033[1mbuild-soft-rebuild-timeout\033[0m," << ::std::endl + << " \033[1mbuild-alt-soft-rebuild-*\033[0m, and" << ::std::endl + << " \033[1mbuild-result-timeout\033[0m \033[1mbrep\033[0m module configuration" << ::std::endl + << " options for details). The special zero value" << ::std::endl + << " disables monitoring of soft rebuilds." << ::std::endl + << ::std::endl + << " Note that if both soft and hard rebuilds are" << ::std::endl + << " disabled in the \033[1mbrep\033[0m module configuration, then" << ::std::endl + << " \033[1mbrep-monitor\033[0m is unable to come up with a" << ::std::endl + << " reasonable build timeout on its own. In this" << ::std::endl + << " case, to monitor the initial package build" << ::std::endl + << " delays, you may need to specify either" << ::std::endl + << " \033[1m--soft-rebuild-timeout\033[0m or" << ::std::endl + << " \033[1m--hard-rebuild-timeout\033[0m explicitly." << ::std::endl + << ::std::endl + << " Also note that a package that was not built" << ::std::endl + << " before it was archived is always considered as" << ::std::endl + << " delayed. However, to distinguish this case from" << ::std::endl + << " a situation where a package was archived before" << ::std::endl + << " a configuration have been added, \033[1mbrep-monitor\033[0m" << ::std::endl + << " needs to observe the package as buildable for" << ::std::endl + << " this configuration before it is archived. As" << ::std::endl + << " result, if you run \033[1mbrep-monitor\033[0m periodically" << ::std::endl + << " (for example, as a cron job), then make sure its" << ::std::endl + << " running period is less than the tenant archive" << ::std::endl + << " timeout." << ::std::endl; + + os << std::endl + << "\033[1m--hard-rebuild-timeout\033[0m \033[4mseconds\033[0m Time to wait (in seconds) before considering a" << ::std::endl + << " package hard (re)build as delayed. If" << ::std::endl + << " unspecified, it is calculated in the same way as" << ::std::endl + << " for \033[1m--soft-rebuild-timeout\033[0m but using the" << ::std::endl + << " \033[1mbuild-hard-rebuild-timeout\033[0m and" << ::std::endl + << " \033[1mbuild-alt-hard-rebuild-*\033[0m \033[1mbrep\033[0m module" << ::std::endl + << " configuration options." << ::std::endl; + + os << std::endl + << "\033[1m--report-timeout\033[0m \033[4mseconds\033[0m Time to wait (in seconds) before repeating a" << ::std::endl + << " report of a package build delay. By default" << ::std::endl + << " there is no timeout and all reports are" << ::std::endl + << " repeated." << ::std::endl; + + os << std::endl + << "\033[1m--full-report\033[0m Print the list of delayed package builds rather" << ::std::endl + << " than just their number per build configuration." << ::std::endl; + + os << std::endl + << "\033[1m--clean\033[0m Additionally clean the monitor state removing" << ::std::endl + << " outdated information related to non-existent" << ::std::endl + << " packages, configurations, etc." << ::std::endl; + + os << std::endl + << "\033[1m--build-db-user\033[0m|\033[1m-u\033[0m \033[4muser\033[0m \033[1mbuild\033[0m database user name. If unspecified, then" << ::std::endl + << " operating system (login) name is used." << ::std::endl; + + os << std::endl + << "\033[1m--build-db-password\033[0m \033[4mpass\033[0m \033[1mbuild\033[0m database password. If unspecified, then" << ::std::endl + << " login without password is expected to work." << ::std::endl; + + os << std::endl + << "\033[1m--build-db-name\033[0m|\033[1m-n\033[0m \033[4mname\033[0m \033[1mbuild\033[0m database name. If unspecified, then \033[1mbrep\033[0m's" << ::std::endl + << " \033[1mbuild-db-name\033[0m configuration option value is" << ::std::endl + << " used." << ::std::endl; + + os << std::endl + << "\033[1m--build-db-host\033[0m|\033[1m-h\033[0m \033[4mhost\033[0m \033[1mbuild\033[0m database host name, address, or socket. If" << ::std::endl + << " unspecified, then \033[1mbrep\033[0m's \033[1mbuild-db-host\033[0m" << ::std::endl + << " configuration option value is used." << ::std::endl; + + os << std::endl + << "\033[1m--build-db-port\033[0m|\033[1m-p\033[0m \033[4mport\033[0m \033[1mbuild\033[0m database port number. If unspecified, then" << ::std::endl + << " \033[1mbrep\033[0m's \033[1mbuild-db-port\033[0m configuration option value" << ::std::endl + << " is 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." << ::std::endl + << " Commonly used pager programs are \033[1mless\033[0m and \033[1mmore\033[0m." << ::std::endl + << " You can also specify additional options that" << ::std::endl + << " should be passed to the pager program with" << ::std::endl + << " \033[1m--pager-option\033[0m. If an empty string is specified" << ::std::endl + << " as the pager program, then no pager will be" << ::std::endl + << " used. If the pager program is not explicitly" << ::std::endl + << " specified, then \033[1mbrep-monitor\033[0m will try to use" << ::std::endl + << " \033[1mless\033[0m. If it is not available, then no pager will" << ::std::endl + << " 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" << ::std::endl + << " program. See \033[1m--pager\033[0m for more information on the" << ::std::endl + << " pager program. Repeat this option to specify" << ::std::endl + << " 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 = ::brep::cli::usage_para::option; + + return p; + } + + typedef + std::map<std::string, void (*) (monitor&, ::brep::cli::scanner&)> + _cli_monitor_map; + + static _cli_monitor_map _cli_monitor_map_; + + struct _cli_monitor_map_init + { + _cli_monitor_map_init () + { + _cli_monitor_map_["--soft-rebuild-timeout"] = + &::brep::cli::thunk< monitor, std::size_t, &monitor::soft_rebuild_timeout_, + &monitor::soft_rebuild_timeout_specified_ >; + _cli_monitor_map_["--hard-rebuild-timeout"] = + &::brep::cli::thunk< monitor, std::size_t, &monitor::hard_rebuild_timeout_, + &monitor::hard_rebuild_timeout_specified_ >; + _cli_monitor_map_["--report-timeout"] = + &::brep::cli::thunk< monitor, std::size_t, &monitor::report_timeout_, + &monitor::report_timeout_specified_ >; + _cli_monitor_map_["--full-report"] = + &::brep::cli::thunk< monitor, &monitor::full_report_ >; + _cli_monitor_map_["--clean"] = + &::brep::cli::thunk< monitor, &monitor::clean_ >; + _cli_monitor_map_["--build-db-user"] = + &::brep::cli::thunk< monitor, std::string, &monitor::build_db_user_, + &monitor::build_db_user_specified_ >; + _cli_monitor_map_["-u"] = + &::brep::cli::thunk< monitor, std::string, &monitor::build_db_user_, + &monitor::build_db_user_specified_ >; + _cli_monitor_map_["--build-db-password"] = + &::brep::cli::thunk< monitor, std::string, &monitor::build_db_password_, + &monitor::build_db_password_specified_ >; + _cli_monitor_map_["--build-db-name"] = + &::brep::cli::thunk< monitor, std::string, &monitor::build_db_name_, + &monitor::build_db_name_specified_ >; + _cli_monitor_map_["-n"] = + &::brep::cli::thunk< monitor, std::string, &monitor::build_db_name_, + &monitor::build_db_name_specified_ >; + _cli_monitor_map_["--build-db-host"] = + &::brep::cli::thunk< monitor, std::string, &monitor::build_db_host_, + &monitor::build_db_host_specified_ >; + _cli_monitor_map_["-h"] = + &::brep::cli::thunk< monitor, std::string, &monitor::build_db_host_, + &monitor::build_db_host_specified_ >; + _cli_monitor_map_["--build-db-port"] = + &::brep::cli::thunk< monitor, std::uint16_t, &monitor::build_db_port_, + &monitor::build_db_port_specified_ >; + _cli_monitor_map_["-p"] = + &::brep::cli::thunk< monitor, std::uint16_t, &monitor::build_db_port_, + &monitor::build_db_port_specified_ >; + _cli_monitor_map_["--pager"] = + &::brep::cli::thunk< monitor, std::string, &monitor::pager_, + &monitor::pager_specified_ >; + _cli_monitor_map_["--pager-option"] = + &::brep::cli::thunk< monitor, std::vector<std::string>, &monitor::pager_option_, + &monitor::pager_option_specified_ >; + _cli_monitor_map_["--help"] = + &::brep::cli::thunk< monitor, &monitor::help_ >; + _cli_monitor_map_["--version"] = + &::brep::cli::thunk< monitor, &monitor::version_ >; + } + }; + + static _cli_monitor_map_init _cli_monitor_map_init_; + + bool monitor:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_monitor_map::const_iterator i (_cli_monitor_map_.find (o)); + + if (i != _cli_monitor_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool monitor:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt_mode, + ::brep::cli::unknown_mode arg_mode) + { + // Can't skip combined flags (--no-combined-flags). + // + assert (opt_mode != ::brep::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) + }; + + ::brep::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 ::brep::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 + }; + + ::brep::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 ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_option (o); + } + } + + break; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + } +} + +::brep::cli::usage_para +print_usage (::std::ostream& os, ::brep::cli::usage_para p) +{ + CLI_POTENTIALLY_UNUSED (os); + + if (p != ::brep::cli::usage_para::none) + os << ::std::endl; + + os << "\033[1mSYNOPSIS\033[0m" << ::std::endl + << ::std::endl + << "\033[1mbrep-monitor --help\033[0m" << ::std::endl + << "\033[1mbrep-monitor --version\033[0m" << ::std::endl + << "\033[1mbrep-monitor\033[0m [\033[4moptions\033[0m] \033[4mbrep-config\033[0m \033[4mtoolchain\033[0m [\033[4mtoolchain\033[0m...]\033[0m" << ::std::endl + << ::std::endl + << "\033[4mtoolchain\033[0m = \033[4mname\033[0m[\033[1m/\033[0m\033[4mversion\033[0m]\033[0m" << ::std::endl + << ::std::endl + << "\033[1mDESCRIPTION\033[0m" << ::std::endl + << ::std::endl + << "\033[1mbrep-monitor\033[0m analyzes the \033[1mbrep\033[0m internal state and reports the infrastructure" << ::std::endl + << "issues printing their descriptions to \033[1mstderr\033[0m." << ::std::endl + << ::std::endl + << "The specified \033[1mbrep\033[0m module configuration file (\033[4mbrep-config\033[0m) is used to retrieve" << ::std::endl + << "information required to access the databases and deduce the expected behavior." << ::std::endl + << "Most of this information can be overridden via the command line options." << ::std::endl + << ::std::endl + << "Currently, only delayed package builds for the specified toolchains are" << ::std::endl + << "reported. If toolchain version is omitted then all package builds with this" << ::std::endl + << "toolchain name are considered." << ::std::endl + << ::std::endl + << "\033[1mbrep-monitor\033[0m maintains its own state in the brep \033[1mbuild\033[0m database. In particular," << ::std::endl + << "it records timestamps of the reported package build delays and optionally omits" << ::std::endl + << "them from being reported again during the timeout specified with the" << ::std::endl + << "\033[1m--report-timeout\033[0m option. If the timeout is unspecified, then the report" << ::std::endl + << "timestamps are not updated. To report all delays and still update the" << ::std::endl + << "timestamps specify the zero report timeout." << ::std::endl + << ::std::endl + << "By default, a brief report is printed. Use the \033[1m--full-report\033[0m option to obtain" << ::std::endl + << "the full report (which may be large)." << ::std::endl + << ::std::endl + << "Note that \033[1mbrep-monitor\033[0m expects the \033[1mbuild\033[0m database schema to have already been" << ::std::endl + << "created using \033[1mbrep-migrate(1)\033[0m." << ::std::endl; + + p = ::brep::options::monitor::print_usage (os, ::brep::cli::usage_para::text); + + if (p != ::brep::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-monitor\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 = ::brep::cli::usage_para::text; + + return p; +} + +// Begin epilogue. +// +// +// End epilogue. + diff --git a/monitor/monitor-options.hxx b/monitor/monitor-options.hxx new file mode 100644 index 0000000..ac0e89e --- /dev/null +++ b/monitor/monitor-options.hxx @@ -0,0 +1,200 @@ +// -*- C++ -*- +// +// This file was generated by CLI, a command line interface +// compiler for C++. +// + +#ifndef MONITOR_MONITOR_OPTIONS_HXX +#define MONITOR_MONITOR_OPTIONS_HXX + +// Begin prologue. +// +// +// End prologue. + +#include <vector> + +#include <string> + +#include <cstddef> + +#include <cstdint> + +#include <mod/module-options.hxx> + +namespace brep +{ + namespace options + { + class monitor + { + public: + monitor (); + + monitor (int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + monitor (int start, + int& argc, + char** argv, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + monitor (int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + monitor (int start, + int& argc, + char** argv, + int& end, + bool erase = false, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + monitor (::brep::cli::scanner&, + ::brep::cli::unknown_mode option = ::brep::cli::unknown_mode::fail, + ::brep::cli::unknown_mode argument = ::brep::cli::unknown_mode::stop); + + // Option accessors. + // + const std::size_t& + soft_rebuild_timeout () const; + + bool + soft_rebuild_timeout_specified () const; + + const std::size_t& + hard_rebuild_timeout () const; + + bool + hard_rebuild_timeout_specified () const; + + const std::size_t& + report_timeout () const; + + bool + report_timeout_specified () const; + + const bool& + full_report () const; + + const bool& + clean () const; + + const std::string& + build_db_user () const; + + bool + build_db_user_specified () const; + + const std::string& + build_db_password () const; + + bool + build_db_password_specified () const; + + const std::string& + build_db_name () const; + + bool + build_db_name_specified () const; + + const std::string& + build_db_host () const; + + bool + build_db_host_specified () const; + + const std::uint16_t& + build_db_port () const; + + bool + build_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 ::brep::cli::usage_para + print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + + // Implementation details. + // + protected: + bool + _parse (const char*, ::brep::cli::scanner&); + + private: + bool + _parse (::brep::cli::scanner&, + ::brep::cli::unknown_mode option, + ::brep::cli::unknown_mode argument); + + public: + std::size_t soft_rebuild_timeout_; + bool soft_rebuild_timeout_specified_; + std::size_t hard_rebuild_timeout_; + bool hard_rebuild_timeout_specified_; + std::size_t report_timeout_; + bool report_timeout_specified_; + bool full_report_; + bool clean_; + std::string build_db_user_; + bool build_db_user_specified_; + std::string build_db_password_; + bool build_db_password_specified_; + std::string build_db_name_; + bool build_db_name_specified_; + std::string build_db_host_; + bool build_db_host_specified_; + std::uint16_t build_db_port_; + bool build_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. +// +::brep::cli::usage_para +print_usage (::std::ostream&, + ::brep::cli::usage_para = ::brep::cli::usage_para::none); + +#include <monitor/monitor-options.ixx> + +// Begin epilogue. +// +// +// End epilogue. + +#endif // MONITOR_MONITOR_OPTIONS_HXX diff --git a/monitor/monitor-options.ixx b/monitor/monitor-options.ixx new file mode 100644 index 0000000..c08196a --- /dev/null +++ b/monitor/monitor-options.ixx @@ -0,0 +1,168 @@ +// -*- C++ -*- +// +// This file was generated by CLI, a command line interface +// compiler for C++. +// + +// Begin prologue. +// +// +// End prologue. + +namespace brep +{ + namespace options + { + // monitor + // + + inline const std::size_t& monitor:: + soft_rebuild_timeout () const + { + return this->soft_rebuild_timeout_; + } + + inline bool monitor:: + soft_rebuild_timeout_specified () const + { + return this->soft_rebuild_timeout_specified_; + } + + inline const std::size_t& monitor:: + hard_rebuild_timeout () const + { + return this->hard_rebuild_timeout_; + } + + inline bool monitor:: + hard_rebuild_timeout_specified () const + { + return this->hard_rebuild_timeout_specified_; + } + + inline const std::size_t& monitor:: + report_timeout () const + { + return this->report_timeout_; + } + + inline bool monitor:: + report_timeout_specified () const + { + return this->report_timeout_specified_; + } + + inline const bool& monitor:: + full_report () const + { + return this->full_report_; + } + + inline const bool& monitor:: + clean () const + { + return this->clean_; + } + + inline const std::string& monitor:: + build_db_user () const + { + return this->build_db_user_; + } + + inline bool monitor:: + build_db_user_specified () const + { + return this->build_db_user_specified_; + } + + inline const std::string& monitor:: + build_db_password () const + { + return this->build_db_password_; + } + + inline bool monitor:: + build_db_password_specified () const + { + return this->build_db_password_specified_; + } + + inline const std::string& monitor:: + build_db_name () const + { + return this->build_db_name_; + } + + inline bool monitor:: + build_db_name_specified () const + { + return this->build_db_name_specified_; + } + + inline const std::string& monitor:: + build_db_host () const + { + return this->build_db_host_; + } + + inline bool monitor:: + build_db_host_specified () const + { + return this->build_db_host_specified_; + } + + inline const std::uint16_t& monitor:: + build_db_port () const + { + return this->build_db_port_; + } + + inline bool monitor:: + build_db_port_specified () const + { + return this->build_db_port_specified_; + } + + inline const std::string& monitor:: + pager () const + { + return this->pager_; + } + + inline bool monitor:: + pager_specified () const + { + return this->pager_specified_; + } + + inline const std::vector<std::string>& monitor:: + pager_option () const + { + return this->pager_option_; + } + + inline bool monitor:: + pager_option_specified () const + { + return this->pager_option_specified_; + } + + inline const bool& monitor:: + help () const + { + return this->help_; + } + + inline const bool& monitor:: + version () const + { + return this->version_; + } + } +} + +// Begin epilogue. +// +// +// End epilogue. diff --git a/repositories.manifest b/repositories.manifest index faed09f..981a363 100644 --- a/repositories.manifest +++ b/repositories.manifest @@ -3,40 +3,5 @@ summary: build2 package repository web interface repository : role: prerequisite -location: ../libbutl.git##HEAD - -: -role: prerequisite -location: ../libbpkg.git##HEAD - -: -role: prerequisite -location: ../libbbot.git##HEAD - -: -role: prerequisite -location: ../libbutl.bash.git##HEAD - -: -role: prerequisite -location: ../bpkg-util.git##HEAD - -: -role: prerequisite -location: https://git.build2.org/packaging/libapr/libapr1.git##HEAD - -: -role: prerequisite -location: https://git.build2.org/packaging/libapreq/libapreq2.git##HEAD - -: -role: prerequisite -location: https://git.build2.org/packaging/cmark-gfm/cmark-gfm.git##HEAD - -: -role: prerequisite -location: https://git.codesynthesis.com/odb/odb.git##HEAD - -: -role: prerequisite -location: https://git.codesynthesis.com/libstudxml/libstudxml.git##HEAD +location: https://stage.build2.org/1 +trust: EC:50:13:E2:3D:F7:92:B4:50:0B:BF:2A:1F:7D:31:04:C6:57:6F:BC:BE:04:2E:E0:58:14:FA:66:66:21:1F:14 |