// -*- C++ -*-
//
// This file was generated by ODB, object-relational mapping (ORM)
// compiler for C++.
//

#ifndef BDEP_DATABASE_VIEWS_ODB_HXX
#define BDEP_DATABASE_VIEWS_ODB_HXX

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

#include <odb/version.hxx>

#if ODB_VERSION != 20477UL
#error ODB runtime version mismatch
#endif

#include <odb/pre.hxx>

#include <bdep/database-views.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/view-image.hxx>
#include <odb/view-result.hxx>

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

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

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

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

#include <odb/details/buffer.hxx>

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

namespace odb
{
  // sqlite_master
  //
  template <>
  class access::view_traits_impl< ::bdep::sqlite_master, id_sqlite >:
    public access::view_traits< ::bdep::sqlite_master >
  {
    public:
    struct image_type
    {
      // type
      //
      details::buffer type_value;
      std::size_t type_size;
      bool type_null;

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

      // sql
      //
      details::buffer sql_value;
      std::size_t sql_size;
      bool sql_null;

      std::size_t version;
    };

    typedef sqlite::view_statements<view_type> statements_type;

    typedef sqlite::query_base query_base_type;
    struct query_columns
    {
    };

    static const bool versioned = false;

    static bool
    grow (image_type&,
          bool*);

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

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

    static const std::size_t column_count = 3UL;

    static query_base_type
    query_statement (const query_base_type&);

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

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

#include <bdep/database-views-odb.ixx>

#include <odb/post.hxx>

#endif // BDEP_DATABASE_VIEWS_ODB_HXX
