mirror of
https://github.com/latentPrion/cppbessot.git
synced 2026-04-17 18:44:23 +00:00
Commit the generated files
This commit is contained in:
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* AUTO-GENERATED BY CppBeSsot.
|
||||||
|
* Direct edits are pointless: this file is regenerated.
|
||||||
|
* Update the OpenAPI schema and/or CppBeSsot templates, then regenerate generated-* outputs.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <nlohmann/json.hpp>
|
||||||
|
#include <odb/core.hxx>
|
||||||
|
|
||||||
|
namespace models {
|
||||||
|
|
||||||
|
#pragma db model version(1, 1)
|
||||||
|
#pragma db object table("Agent")
|
||||||
|
class Agent
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
#pragma db id
|
||||||
|
// odbAddedIn: 1.1
|
||||||
|
std::string id{};
|
||||||
|
// odbAddedIn: 1.1
|
||||||
|
std::string role{};
|
||||||
|
// odbAddedIn: 1.1
|
||||||
|
bool persistent{};
|
||||||
|
// odbAddedIn: 1.1
|
||||||
|
std::string displayName{};
|
||||||
|
|
||||||
|
NLOHMANN_DEFINE_TYPE_INTRUSIVE(Agent, id, role, persistent, displayName)
|
||||||
|
|
||||||
|
nlohmann::json toJson() const
|
||||||
|
{
|
||||||
|
return nlohmann::json(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Agent fromJson(const nlohmann::json& j)
|
||||||
|
{
|
||||||
|
return j.get<Agent>();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace models
|
||||||
|
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* AUTO-GENERATED BY CppBeSsot.
|
||||||
|
* Direct edits are pointless: this file is regenerated.
|
||||||
|
* Update the OpenAPI schema and/or CppBeSsot templates, then regenerate generated-* outputs.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <nlohmann/json.hpp>
|
||||||
|
#include <odb/core.hxx>
|
||||||
|
|
||||||
|
namespace models {
|
||||||
|
|
||||||
|
#pragma db model version(1, 1)
|
||||||
|
#pragma db object table("GovernmentAddress")
|
||||||
|
class GovernmentAddress
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
#pragma db id
|
||||||
|
// odbAddedIn: 1.1
|
||||||
|
std::string id{};
|
||||||
|
// odbAddedIn: 1.1
|
||||||
|
std::string addressLabel{};
|
||||||
|
// odbAddedIn: 1.1
|
||||||
|
std::string regionLookupKey{};
|
||||||
|
|
||||||
|
NLOHMANN_DEFINE_TYPE_INTRUSIVE(GovernmentAddress, id, addressLabel, regionLookupKey)
|
||||||
|
|
||||||
|
nlohmann::json toJson() const
|
||||||
|
{
|
||||||
|
return nlohmann::json(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
static GovernmentAddress fromJson(const nlohmann::json& j)
|
||||||
|
{
|
||||||
|
return j.get<GovernmentAddress>();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace models
|
||||||
|
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* AUTO-GENERATED BY CppBeSsot.
|
||||||
|
* Direct edits are pointless: this file is regenerated.
|
||||||
|
* Update the OpenAPI schema and/or CppBeSsot templates, then regenerate generated-* outputs.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <nlohmann/json.hpp>
|
||||||
|
#include <odb/core.hxx>
|
||||||
|
|
||||||
|
namespace models {
|
||||||
|
|
||||||
|
#pragma db model version(1, 1)
|
||||||
|
#pragma db object table("TripAttemptResult")
|
||||||
|
class TripAttemptResult
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
#pragma db id
|
||||||
|
// odbAddedIn: 1.1
|
||||||
|
std::string id{};
|
||||||
|
// odbAddedIn: 1.1
|
||||||
|
std::string result{};
|
||||||
|
// odbAddedIn: 1.1
|
||||||
|
std::string retryReason{};
|
||||||
|
// odbAddedIn: 1.1
|
||||||
|
std::string governmentSuspensionReason{};
|
||||||
|
// odbAddedIn: 1.1
|
||||||
|
std::string governmentTerminationReason{};
|
||||||
|
// odbAddedIn: 1.1
|
||||||
|
std::string complianceSuspensionReason{};
|
||||||
|
// odbAddedIn: 1.1
|
||||||
|
std::string complianceTerminationReason{};
|
||||||
|
// odbAddedIn: 1.1
|
||||||
|
std::string policySuspensionReason{};
|
||||||
|
// odbAddedIn: 1.1
|
||||||
|
std::string policyTerminationReason{};
|
||||||
|
// odbAddedIn: 1.1
|
||||||
|
std::string cancelationReason{};
|
||||||
|
// odbAddedIn: 1.1
|
||||||
|
std::string failureReason{};
|
||||||
|
// odbAddedIn: 1.1
|
||||||
|
std::string details{};
|
||||||
|
|
||||||
|
NLOHMANN_DEFINE_TYPE_INTRUSIVE(TripAttemptResult, id, result, retryReason, governmentSuspensionReason, governmentTerminationReason, complianceSuspensionReason, complianceTerminationReason, policySuspensionReason, policyTerminationReason, cancelationReason, failureReason, details)
|
||||||
|
|
||||||
|
nlohmann::json toJson() const
|
||||||
|
{
|
||||||
|
return nlohmann::json(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
static TripAttemptResult fromJson(const nlohmann::json& j)
|
||||||
|
{
|
||||||
|
return j.get<TripAttemptResult>();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace models
|
||||||
|
|
||||||
11
db/test-schema-v1.1/generated-cpp-source/src/model/Agent.cpp
Normal file
11
db/test-schema-v1.1/generated-cpp-source/src/model/Agent.cpp
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
/*
|
||||||
|
* AUTO-GENERATED BY CppBeSsot.
|
||||||
|
* Direct edits are pointless: this file is regenerated.
|
||||||
|
* Update the OpenAPI schema and/or CppBeSsot templates, then regenerate generated-* outputs.
|
||||||
|
*/
|
||||||
|
#include "cppbessot/model/Agent.h"
|
||||||
|
|
||||||
|
namespace models {
|
||||||
|
// Nlohmann-based models are header-only for now.
|
||||||
|
} // namespace models
|
||||||
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
/*
|
||||||
|
* AUTO-GENERATED BY CppBeSsot.
|
||||||
|
* Direct edits are pointless: this file is regenerated.
|
||||||
|
* Update the OpenAPI schema and/or CppBeSsot templates, then regenerate generated-* outputs.
|
||||||
|
*/
|
||||||
|
#include "cppbessot/model/GovernmentAddress.h"
|
||||||
|
|
||||||
|
namespace models {
|
||||||
|
// Nlohmann-based models are header-only for now.
|
||||||
|
} // namespace models
|
||||||
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
/*
|
||||||
|
* AUTO-GENERATED BY CppBeSsot.
|
||||||
|
* Direct edits are pointless: this file is regenerated.
|
||||||
|
* Update the OpenAPI schema and/or CppBeSsot templates, then regenerate generated-* outputs.
|
||||||
|
*/
|
||||||
|
#include "cppbessot/model/TripAttemptResult.h"
|
||||||
|
|
||||||
|
namespace models {
|
||||||
|
// Nlohmann-based models are header-only for now.
|
||||||
|
} // namespace models
|
||||||
|
|
||||||
819
db/test-schema-v1.1/generated-odb-source/postgre/Agent-odb.cxx
Normal file
819
db/test-schema-v1.1/generated-odb-source/postgre/Agent-odb.cxx
Normal file
@@ -0,0 +1,819 @@
|
|||||||
|
// This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
// compiler for C++.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <odb/pre.hxx>
|
||||||
|
|
||||||
|
#include "Agent-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/container-statements.hxx>
|
||||||
|
#include <odb/pgsql/exceptions.hxx>
|
||||||
|
#include <odb/pgsql/simple-object-result.hxx>
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// Agent
|
||||||
|
//
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
persist_statement_name[] = "persist_models_Agent";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
find_statement_name[] = "find_models_Agent";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
update_statement_name[] = "update_models_Agent";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
erase_statement_name[] = "erase_models_Agent";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
query_statement_name[] = "query_models_Agent";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
erase_query_statement_name[] = "erase_query_models_Agent";
|
||||||
|
|
||||||
|
const unsigned int access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
persist_statement_types[] =
|
||||||
|
{
|
||||||
|
pgsql::text_oid,
|
||||||
|
pgsql::text_oid,
|
||||||
|
pgsql::bool_oid,
|
||||||
|
pgsql::text_oid
|
||||||
|
};
|
||||||
|
|
||||||
|
const unsigned int access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
find_statement_types[] =
|
||||||
|
{
|
||||||
|
pgsql::text_oid
|
||||||
|
};
|
||||||
|
|
||||||
|
const unsigned int access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
update_statement_types[] =
|
||||||
|
{
|
||||||
|
pgsql::text_oid,
|
||||||
|
pgsql::bool_oid,
|
||||||
|
pgsql::text_oid,
|
||||||
|
pgsql::text_oid
|
||||||
|
};
|
||||||
|
|
||||||
|
struct access::object_traits_impl< ::models::Agent, 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< ::models::Agent, id_pgsql >::id_type
|
||||||
|
access::object_traits_impl< ::models::Agent, 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< ::models::Agent, 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// role
|
||||||
|
//
|
||||||
|
if (t[1UL])
|
||||||
|
{
|
||||||
|
i.role_value.capacity (i.role_size);
|
||||||
|
grew = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// persistent
|
||||||
|
//
|
||||||
|
t[2UL] = 0;
|
||||||
|
|
||||||
|
// displayName
|
||||||
|
//
|
||||||
|
if (t[3UL])
|
||||||
|
{
|
||||||
|
i.displayName_value.capacity (i.displayName_size);
|
||||||
|
grew = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return grew;
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
bind (pgsql::bind* b,
|
||||||
|
image_type& i,
|
||||||
|
pgsql::statement_kind sk)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (sk);
|
||||||
|
|
||||||
|
using namespace pgsql;
|
||||||
|
|
||||||
|
std::size_t n (0);
|
||||||
|
|
||||||
|
// id
|
||||||
|
//
|
||||||
|
if (sk != statement_update)
|
||||||
|
{
|
||||||
|
b[n].type = pgsql::bind::text;
|
||||||
|
b[n].buffer = i.id_value.data ();
|
||||||
|
b[n].capacity = i.id_value.capacity ();
|
||||||
|
b[n].size = &i.id_size;
|
||||||
|
b[n].is_null = &i.id_null;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// role
|
||||||
|
//
|
||||||
|
b[n].type = pgsql::bind::text;
|
||||||
|
b[n].buffer = i.role_value.data ();
|
||||||
|
b[n].capacity = i.role_value.capacity ();
|
||||||
|
b[n].size = &i.role_size;
|
||||||
|
b[n].is_null = &i.role_null;
|
||||||
|
n++;
|
||||||
|
|
||||||
|
// persistent
|
||||||
|
//
|
||||||
|
b[n].type = pgsql::bind::boolean_;
|
||||||
|
b[n].buffer = &i.persistent_value;
|
||||||
|
b[n].is_null = &i.persistent_null;
|
||||||
|
n++;
|
||||||
|
|
||||||
|
// displayName
|
||||||
|
//
|
||||||
|
b[n].type = pgsql::bind::text;
|
||||||
|
b[n].buffer = i.displayName_value.data ();
|
||||||
|
b[n].capacity = i.displayName_value.capacity ();
|
||||||
|
b[n].size = &i.displayName_size;
|
||||||
|
b[n].is_null = &i.displayName_null;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
bind (pgsql::bind* b, id_image_type& i)
|
||||||
|
{
|
||||||
|
std::size_t n (0);
|
||||||
|
b[n].type = pgsql::bind::text;
|
||||||
|
b[n].buffer = i.id_value.data ();
|
||||||
|
b[n].capacity = i.id_value.capacity ();
|
||||||
|
b[n].size = &i.id_size;
|
||||||
|
b[n].is_null = &i.id_null;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool access::object_traits_impl< ::models::Agent, 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 ());
|
||||||
|
}
|
||||||
|
|
||||||
|
// role
|
||||||
|
//
|
||||||
|
{
|
||||||
|
::std::string const& v =
|
||||||
|
o.role;
|
||||||
|
|
||||||
|
bool is_null (false);
|
||||||
|
std::size_t size (0);
|
||||||
|
std::size_t cap (i.role_value.capacity ());
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::set_image (
|
||||||
|
i.role_value,
|
||||||
|
size,
|
||||||
|
is_null,
|
||||||
|
v);
|
||||||
|
i.role_null = is_null;
|
||||||
|
i.role_size = size;
|
||||||
|
grew = grew || (cap != i.role_value.capacity ());
|
||||||
|
}
|
||||||
|
|
||||||
|
// persistent
|
||||||
|
//
|
||||||
|
{
|
||||||
|
bool const& v =
|
||||||
|
o.persistent;
|
||||||
|
|
||||||
|
bool is_null (false);
|
||||||
|
pgsql::value_traits<
|
||||||
|
bool,
|
||||||
|
pgsql::id_boolean >::set_image (
|
||||||
|
i.persistent_value, is_null, v);
|
||||||
|
i.persistent_null = is_null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// displayName
|
||||||
|
//
|
||||||
|
{
|
||||||
|
::std::string const& v =
|
||||||
|
o.displayName;
|
||||||
|
|
||||||
|
bool is_null (false);
|
||||||
|
std::size_t size (0);
|
||||||
|
std::size_t cap (i.displayName_value.capacity ());
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::set_image (
|
||||||
|
i.displayName_value,
|
||||||
|
size,
|
||||||
|
is_null,
|
||||||
|
v);
|
||||||
|
i.displayName_null = is_null;
|
||||||
|
i.displayName_size = size;
|
||||||
|
grew = grew || (cap != i.displayName_value.capacity ());
|
||||||
|
}
|
||||||
|
|
||||||
|
return grew;
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::Agent, 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
// role
|
||||||
|
//
|
||||||
|
{
|
||||||
|
::std::string& v =
|
||||||
|
o.role;
|
||||||
|
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::set_value (
|
||||||
|
v,
|
||||||
|
i.role_value,
|
||||||
|
i.role_size,
|
||||||
|
i.role_null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// persistent
|
||||||
|
//
|
||||||
|
{
|
||||||
|
bool& v =
|
||||||
|
o.persistent;
|
||||||
|
|
||||||
|
pgsql::value_traits<
|
||||||
|
bool,
|
||||||
|
pgsql::id_boolean >::set_value (
|
||||||
|
v,
|
||||||
|
i.persistent_value,
|
||||||
|
i.persistent_null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// displayName
|
||||||
|
//
|
||||||
|
{
|
||||||
|
::std::string& v =
|
||||||
|
o.displayName;
|
||||||
|
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::set_value (
|
||||||
|
v,
|
||||||
|
i.displayName_value,
|
||||||
|
i.displayName_size,
|
||||||
|
i.displayName_null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::Agent, 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< ::models::Agent, id_pgsql >::persist_statement[] =
|
||||||
|
"INSERT INTO \"Agent\" "
|
||||||
|
"(\"id\", "
|
||||||
|
"\"role\", "
|
||||||
|
"\"persistent\", "
|
||||||
|
"\"displayName\") "
|
||||||
|
"VALUES "
|
||||||
|
"($1, $2, $3, $4)";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_pgsql >::find_statement[] =
|
||||||
|
"SELECT "
|
||||||
|
"\"Agent\".\"id\", "
|
||||||
|
"\"Agent\".\"role\", "
|
||||||
|
"\"Agent\".\"persistent\", "
|
||||||
|
"\"Agent\".\"displayName\" "
|
||||||
|
"FROM \"Agent\" "
|
||||||
|
"WHERE \"Agent\".\"id\"=$1";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_pgsql >::update_statement[] =
|
||||||
|
"UPDATE \"Agent\" "
|
||||||
|
"SET "
|
||||||
|
"\"role\"=$1, "
|
||||||
|
"\"persistent\"=$2, "
|
||||||
|
"\"displayName\"=$3 "
|
||||||
|
"WHERE \"id\"=$4";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_pgsql >::erase_statement[] =
|
||||||
|
"DELETE FROM \"Agent\" "
|
||||||
|
"WHERE \"id\"=$1";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_pgsql >::query_statement[] =
|
||||||
|
"SELECT "
|
||||||
|
"\"Agent\".\"id\", "
|
||||||
|
"\"Agent\".\"role\", "
|
||||||
|
"\"Agent\".\"persistent\", "
|
||||||
|
"\"Agent\".\"displayName\" "
|
||||||
|
"FROM \"Agent\"";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_pgsql >::erase_query_statement[] =
|
||||||
|
"DELETE FROM \"Agent\"";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_pgsql >::table_name[] =
|
||||||
|
"\"Agent\"";
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
persist (database& db, const object_type& obj)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
|
||||||
|
using namespace pgsql;
|
||||||
|
|
||||||
|
pgsql::connection& conn (
|
||||||
|
pgsql::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
callback (db,
|
||||||
|
obj,
|
||||||
|
callback_event::pre_persist);
|
||||||
|
|
||||||
|
image_type& im (sts.image ());
|
||||||
|
binding& imb (sts.insert_image_binding ());
|
||||||
|
|
||||||
|
if (init (im, obj, statement_insert))
|
||||||
|
im.version++;
|
||||||
|
|
||||||
|
if (im.version != sts.insert_image_version () ||
|
||||||
|
imb.version == 0)
|
||||||
|
{
|
||||||
|
bind (imb.bind, im, statement_insert);
|
||||||
|
sts.insert_image_version (im.version);
|
||||||
|
imb.version++;
|
||||||
|
}
|
||||||
|
|
||||||
|
insert_statement& st (sts.persist_statement ());
|
||||||
|
if (!st.execute ())
|
||||||
|
throw object_already_persistent ();
|
||||||
|
|
||||||
|
callback (db,
|
||||||
|
obj,
|
||||||
|
callback_event::post_persist);
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
update (database& db, const object_type& obj)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
|
||||||
|
using namespace pgsql;
|
||||||
|
using pgsql::update_statement;
|
||||||
|
|
||||||
|
callback (db, obj, callback_event::pre_update);
|
||||||
|
|
||||||
|
pgsql::transaction& tr (pgsql::transaction::current ());
|
||||||
|
pgsql::connection& conn (tr.connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
const id_type& id (
|
||||||
|
obj.id);
|
||||||
|
id_image_type& idi (sts.id_image ());
|
||||||
|
init (idi, id);
|
||||||
|
|
||||||
|
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< ::models::Agent, id_pgsql >::
|
||||||
|
erase (database& db, const id_type& id)
|
||||||
|
{
|
||||||
|
using namespace pgsql;
|
||||||
|
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
|
||||||
|
pgsql::connection& conn (
|
||||||
|
pgsql::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
id_image_type& i (sts.id_image ());
|
||||||
|
init (i, id);
|
||||||
|
|
||||||
|
binding& idb (sts.id_image_binding ());
|
||||||
|
if (i.version != sts.id_image_version () || idb.version == 0)
|
||||||
|
{
|
||||||
|
bind (idb.bind, i);
|
||||||
|
sts.id_image_version (i.version);
|
||||||
|
idb.version++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sts.erase_statement ().execute () != 1)
|
||||||
|
throw object_not_persistent ();
|
||||||
|
|
||||||
|
pointer_cache_traits::erase (db, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
access::object_traits_impl< ::models::Agent, id_pgsql >::pointer_type
|
||||||
|
access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
find (database& db, const id_type& id)
|
||||||
|
{
|
||||||
|
using namespace pgsql;
|
||||||
|
|
||||||
|
{
|
||||||
|
pointer_type p (pointer_cache_traits::find (db, id));
|
||||||
|
|
||||||
|
if (!pointer_traits::null_ptr (p))
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
pgsql::connection& conn (
|
||||||
|
pgsql::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
statements_type::auto_lock l (sts);
|
||||||
|
|
||||||
|
if (l.locked ())
|
||||||
|
{
|
||||||
|
if (!find_ (sts, &id))
|
||||||
|
return pointer_type ();
|
||||||
|
}
|
||||||
|
|
||||||
|
pointer_type p (
|
||||||
|
access::object_factory<object_type, pointer_type>::create ());
|
||||||
|
pointer_traits::guard pg (p);
|
||||||
|
|
||||||
|
pointer_cache_traits::insert_guard ig (
|
||||||
|
pointer_cache_traits::insert (db, id, p));
|
||||||
|
|
||||||
|
object_type& obj (pointer_traits::get_ref (p));
|
||||||
|
|
||||||
|
if (l.locked ())
|
||||||
|
{
|
||||||
|
select_statement& st (sts.find_statement ());
|
||||||
|
ODB_POTENTIALLY_UNUSED (st);
|
||||||
|
|
||||||
|
callback (db, obj, callback_event::pre_load);
|
||||||
|
init (obj, sts.image (), &db);
|
||||||
|
load_ (sts, obj, false);
|
||||||
|
sts.load_delayed (0);
|
||||||
|
l.unlock ();
|
||||||
|
callback (db, obj, callback_event::post_load);
|
||||||
|
pointer_cache_traits::load (ig.position ());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sts.delay_load (id, obj, ig.position ());
|
||||||
|
|
||||||
|
ig.release ();
|
||||||
|
pg.release ();
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
find (database& db, const id_type& id, object_type& obj)
|
||||||
|
{
|
||||||
|
using namespace pgsql;
|
||||||
|
|
||||||
|
pgsql::connection& conn (
|
||||||
|
pgsql::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
statements_type::auto_lock l (sts);
|
||||||
|
|
||||||
|
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< ::models::Agent, id_pgsql >::
|
||||||
|
reload (database& db, object_type& obj)
|
||||||
|
{
|
||||||
|
using namespace pgsql;
|
||||||
|
|
||||||
|
pgsql::connection& conn (
|
||||||
|
pgsql::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
statements_type::auto_lock l (sts);
|
||||||
|
|
||||||
|
const id_type& id (
|
||||||
|
obj.id);
|
||||||
|
|
||||||
|
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< ::models::Agent, 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< ::models::Agent, id_pgsql >::object_type >
|
||||||
|
access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
query (database&, const query_base_type& q)
|
||||||
|
{
|
||||||
|
using namespace pgsql;
|
||||||
|
using odb::details::shared;
|
||||||
|
using odb::details::shared_ptr;
|
||||||
|
|
||||||
|
pgsql::connection& conn (
|
||||||
|
pgsql::transaction::current ().connection ());
|
||||||
|
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
image_type& im (sts.image ());
|
||||||
|
binding& imb (sts.select_image_binding ());
|
||||||
|
|
||||||
|
if (im.version != sts.select_image_version () ||
|
||||||
|
imb.version == 0)
|
||||||
|
{
|
||||||
|
bind (imb.bind, im, statement_select);
|
||||||
|
sts.select_image_version (im.version);
|
||||||
|
imb.version++;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string text (query_statement);
|
||||||
|
if (!q.empty ())
|
||||||
|
{
|
||||||
|
text += " ";
|
||||||
|
text += q.clause ();
|
||||||
|
}
|
||||||
|
|
||||||
|
q.init_parameters ();
|
||||||
|
shared_ptr<select_statement> st (
|
||||||
|
new (shared) select_statement (
|
||||||
|
sts.connection (),
|
||||||
|
query_statement_name,
|
||||||
|
text,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
q.parameter_types (),
|
||||||
|
q.parameter_count (),
|
||||||
|
q.parameters_binding (),
|
||||||
|
imb));
|
||||||
|
|
||||||
|
st->execute ();
|
||||||
|
st->deallocate ();
|
||||||
|
|
||||||
|
shared_ptr< odb::object_result_impl<object_type> > r (
|
||||||
|
new (shared) pgsql::object_result_impl<object_type> (
|
||||||
|
q, st, sts, 0));
|
||||||
|
|
||||||
|
return result<object_type> (r);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned long long access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
erase_query (database&, const query_base_type& q)
|
||||||
|
{
|
||||||
|
using namespace pgsql;
|
||||||
|
|
||||||
|
pgsql::connection& conn (
|
||||||
|
pgsql::transaction::current ().connection ());
|
||||||
|
|
||||||
|
std::string text (erase_query_statement);
|
||||||
|
if (!q.empty ())
|
||||||
|
{
|
||||||
|
text += ' ';
|
||||||
|
text += q.clause ();
|
||||||
|
}
|
||||||
|
|
||||||
|
q.init_parameters ();
|
||||||
|
delete_statement st (
|
||||||
|
conn,
|
||||||
|
erase_query_statement_name,
|
||||||
|
text,
|
||||||
|
q.parameter_types (),
|
||||||
|
q.parameter_count (),
|
||||||
|
q.parameters_binding ());
|
||||||
|
|
||||||
|
return st.execute ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#include <odb/post.hxx>
|
||||||
331
db/test-schema-v1.1/generated-odb-source/postgre/Agent-odb.hxx
Normal file
331
db/test-schema-v1.1/generated-odb-source/postgre/Agent-odb.hxx
Normal file
@@ -0,0 +1,331 @@
|
|||||||
|
// This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
// compiler for C++.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef AGENT_ODB_HXX
|
||||||
|
#define AGENT_ODB_HXX
|
||||||
|
|
||||||
|
#include <odb/version.hxx>
|
||||||
|
|
||||||
|
#if (ODB_VERSION != 20400UL)
|
||||||
|
#error ODB runtime version mismatch
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <odb/pre.hxx>
|
||||||
|
|
||||||
|
#include "Agent.h"
|
||||||
|
|
||||||
|
#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/simple-object-result.hxx>
|
||||||
|
|
||||||
|
#include <odb/details/unused.hxx>
|
||||||
|
#include <odb/details/shared-ptr.hxx>
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// Agent
|
||||||
|
//
|
||||||
|
template <>
|
||||||
|
struct class_traits< ::models::Agent >
|
||||||
|
{
|
||||||
|
static const class_kind kind = class_object;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits< ::models::Agent >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef ::models::Agent object_type;
|
||||||
|
typedef ::models::Agent* 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);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#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
|
||||||
|
{
|
||||||
|
// Agent
|
||||||
|
//
|
||||||
|
template <typename A>
|
||||||
|
struct query_columns< ::models::Agent, 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;
|
||||||
|
|
||||||
|
// role
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
pgsql::query_column<
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::query_type,
|
||||||
|
pgsql::id_string >
|
||||||
|
role_type_;
|
||||||
|
|
||||||
|
static const role_type_ role;
|
||||||
|
|
||||||
|
// persistent
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
pgsql::query_column<
|
||||||
|
pgsql::value_traits<
|
||||||
|
bool,
|
||||||
|
pgsql::id_boolean >::query_type,
|
||||||
|
pgsql::id_boolean >
|
||||||
|
persistent_type_;
|
||||||
|
|
||||||
|
static const persistent_type_ persistent;
|
||||||
|
|
||||||
|
// displayName
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
pgsql::query_column<
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::query_type,
|
||||||
|
pgsql::id_string >
|
||||||
|
displayName_type_;
|
||||||
|
|
||||||
|
static const displayName_type_ displayName;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::Agent, id_pgsql, A >::id_type_
|
||||||
|
query_columns< ::models::Agent, id_pgsql, A >::
|
||||||
|
id (A::table_name, "\"id\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::Agent, id_pgsql, A >::role_type_
|
||||||
|
query_columns< ::models::Agent, id_pgsql, A >::
|
||||||
|
role (A::table_name, "\"role\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::Agent, id_pgsql, A >::persistent_type_
|
||||||
|
query_columns< ::models::Agent, id_pgsql, A >::
|
||||||
|
persistent (A::table_name, "\"persistent\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::Agent, id_pgsql, A >::displayName_type_
|
||||||
|
query_columns< ::models::Agent, id_pgsql, A >::
|
||||||
|
displayName (A::table_name, "\"displayName\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
struct pointer_query_columns< ::models::Agent, id_pgsql, A >:
|
||||||
|
query_columns< ::models::Agent, id_pgsql, A >
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits_impl< ::models::Agent, id_pgsql >:
|
||||||
|
public access::object_traits< ::models::Agent >
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
|
||||||
|
// role
|
||||||
|
//
|
||||||
|
details::buffer role_value;
|
||||||
|
std::size_t role_size;
|
||||||
|
bool role_null;
|
||||||
|
|
||||||
|
// persistent
|
||||||
|
//
|
||||||
|
bool persistent_value;
|
||||||
|
bool persistent_null;
|
||||||
|
|
||||||
|
// displayName
|
||||||
|
//
|
||||||
|
details::buffer displayName_value;
|
||||||
|
std::size_t displayName_size;
|
||||||
|
bool displayName_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 = 4UL;
|
||||||
|
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 const char persist_statement_name[];
|
||||||
|
static const char find_statement_name[];
|
||||||
|
static const char update_statement_name[];
|
||||||
|
static const char erase_statement_name[];
|
||||||
|
static const char query_statement_name[];
|
||||||
|
static const char erase_query_statement_name[];
|
||||||
|
|
||||||
|
static const unsigned int persist_statement_types[];
|
||||||
|
static const unsigned int find_statement_types[];
|
||||||
|
static const unsigned int update_statement_types[];
|
||||||
|
|
||||||
|
public:
|
||||||
|
static bool
|
||||||
|
find_ (statements_type&,
|
||||||
|
const id_type*);
|
||||||
|
|
||||||
|
static void
|
||||||
|
load_ (statements_type&,
|
||||||
|
object_type&,
|
||||||
|
bool reload);
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits_impl< ::models::Agent, id_common >:
|
||||||
|
public access::object_traits_impl< ::models::Agent, id_pgsql >
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
// Agent
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "Agent-odb.ixx"
|
||||||
|
|
||||||
|
#include <odb/post.hxx>
|
||||||
|
|
||||||
|
#endif // AGENT_ODB_HXX
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
// This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
// compiler for C++.
|
||||||
|
//
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// Agent
|
||||||
|
//
|
||||||
|
|
||||||
|
inline
|
||||||
|
access::object_traits< ::models::Agent >::id_type
|
||||||
|
access::object_traits< ::models::Agent >::
|
||||||
|
id (const object_type& o)
|
||||||
|
{
|
||||||
|
return o.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
void access::object_traits< ::models::Agent >::
|
||||||
|
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< ::models::Agent >::
|
||||||
|
callback (database& db, const object_type& x, callback_event e)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
ODB_POTENTIALLY_UNUSED (x);
|
||||||
|
ODB_POTENTIALLY_UNUSED (e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// Agent
|
||||||
|
//
|
||||||
|
|
||||||
|
inline
|
||||||
|
void access::object_traits_impl< ::models::Agent, 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< ::models::Agent, id_pgsql >::
|
||||||
|
load_ (statements_type& sts,
|
||||||
|
object_type& obj,
|
||||||
|
bool)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (sts);
|
||||||
|
ODB_POTENTIALLY_UNUSED (obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
13
db/test-schema-v1.1/generated-odb-source/postgre/Agent.xml
Normal file
13
db/test-schema-v1.1/generated-odb-source/postgre/Agent.xml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" version="1">
|
||||||
|
<model version="1">
|
||||||
|
<table name="Agent" kind="object">
|
||||||
|
<column name="id" type="TEXT" null="false"/>
|
||||||
|
<column name="role" type="TEXT" null="false"/>
|
||||||
|
<column name="persistent" type="BOOLEAN" null="false"/>
|
||||||
|
<column name="displayName" type="TEXT" null="false"/>
|
||||||
|
<primary-key>
|
||||||
|
<column name="id"/>
|
||||||
|
</primary-key>
|
||||||
|
</table>
|
||||||
|
</model>
|
||||||
|
</changelog>
|
||||||
@@ -0,0 +1,774 @@
|
|||||||
|
// This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
// compiler for C++.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <odb/pre.hxx>
|
||||||
|
|
||||||
|
#include "GovernmentAddress-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/container-statements.hxx>
|
||||||
|
#include <odb/pgsql/exceptions.hxx>
|
||||||
|
#include <odb/pgsql/simple-object-result.hxx>
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// GovernmentAddress
|
||||||
|
//
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
persist_statement_name[] = "persist_models_GovernmentAddress";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
find_statement_name[] = "find_models_GovernmentAddress";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
update_statement_name[] = "update_models_GovernmentAddress";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
erase_statement_name[] = "erase_models_GovernmentAddress";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
query_statement_name[] = "query_models_GovernmentAddress";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
erase_query_statement_name[] = "erase_query_models_GovernmentAddress";
|
||||||
|
|
||||||
|
const unsigned int access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
persist_statement_types[] =
|
||||||
|
{
|
||||||
|
pgsql::text_oid,
|
||||||
|
pgsql::text_oid,
|
||||||
|
pgsql::text_oid
|
||||||
|
};
|
||||||
|
|
||||||
|
const unsigned int access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
find_statement_types[] =
|
||||||
|
{
|
||||||
|
pgsql::text_oid
|
||||||
|
};
|
||||||
|
|
||||||
|
const unsigned int access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
update_statement_types[] =
|
||||||
|
{
|
||||||
|
pgsql::text_oid,
|
||||||
|
pgsql::text_oid,
|
||||||
|
pgsql::text_oid
|
||||||
|
};
|
||||||
|
|
||||||
|
struct access::object_traits_impl< ::models::GovernmentAddress, 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< ::models::GovernmentAddress, id_pgsql >::id_type
|
||||||
|
access::object_traits_impl< ::models::GovernmentAddress, 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< ::models::GovernmentAddress, 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// addressLabel
|
||||||
|
//
|
||||||
|
if (t[1UL])
|
||||||
|
{
|
||||||
|
i.addressLabel_value.capacity (i.addressLabel_size);
|
||||||
|
grew = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// regionLookupKey
|
||||||
|
//
|
||||||
|
if (t[2UL])
|
||||||
|
{
|
||||||
|
i.regionLookupKey_value.capacity (i.regionLookupKey_size);
|
||||||
|
grew = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return grew;
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
bind (pgsql::bind* b,
|
||||||
|
image_type& i,
|
||||||
|
pgsql::statement_kind sk)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (sk);
|
||||||
|
|
||||||
|
using namespace pgsql;
|
||||||
|
|
||||||
|
std::size_t n (0);
|
||||||
|
|
||||||
|
// id
|
||||||
|
//
|
||||||
|
if (sk != statement_update)
|
||||||
|
{
|
||||||
|
b[n].type = pgsql::bind::text;
|
||||||
|
b[n].buffer = i.id_value.data ();
|
||||||
|
b[n].capacity = i.id_value.capacity ();
|
||||||
|
b[n].size = &i.id_size;
|
||||||
|
b[n].is_null = &i.id_null;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// addressLabel
|
||||||
|
//
|
||||||
|
b[n].type = pgsql::bind::text;
|
||||||
|
b[n].buffer = i.addressLabel_value.data ();
|
||||||
|
b[n].capacity = i.addressLabel_value.capacity ();
|
||||||
|
b[n].size = &i.addressLabel_size;
|
||||||
|
b[n].is_null = &i.addressLabel_null;
|
||||||
|
n++;
|
||||||
|
|
||||||
|
// regionLookupKey
|
||||||
|
//
|
||||||
|
b[n].type = pgsql::bind::text;
|
||||||
|
b[n].buffer = i.regionLookupKey_value.data ();
|
||||||
|
b[n].capacity = i.regionLookupKey_value.capacity ();
|
||||||
|
b[n].size = &i.regionLookupKey_size;
|
||||||
|
b[n].is_null = &i.regionLookupKey_null;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
bind (pgsql::bind* b, id_image_type& i)
|
||||||
|
{
|
||||||
|
std::size_t n (0);
|
||||||
|
b[n].type = pgsql::bind::text;
|
||||||
|
b[n].buffer = i.id_value.data ();
|
||||||
|
b[n].capacity = i.id_value.capacity ();
|
||||||
|
b[n].size = &i.id_size;
|
||||||
|
b[n].is_null = &i.id_null;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool access::object_traits_impl< ::models::GovernmentAddress, 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 ());
|
||||||
|
}
|
||||||
|
|
||||||
|
// addressLabel
|
||||||
|
//
|
||||||
|
{
|
||||||
|
::std::string const& v =
|
||||||
|
o.addressLabel;
|
||||||
|
|
||||||
|
bool is_null (false);
|
||||||
|
std::size_t size (0);
|
||||||
|
std::size_t cap (i.addressLabel_value.capacity ());
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::set_image (
|
||||||
|
i.addressLabel_value,
|
||||||
|
size,
|
||||||
|
is_null,
|
||||||
|
v);
|
||||||
|
i.addressLabel_null = is_null;
|
||||||
|
i.addressLabel_size = size;
|
||||||
|
grew = grew || (cap != i.addressLabel_value.capacity ());
|
||||||
|
}
|
||||||
|
|
||||||
|
// regionLookupKey
|
||||||
|
//
|
||||||
|
{
|
||||||
|
::std::string const& v =
|
||||||
|
o.regionLookupKey;
|
||||||
|
|
||||||
|
bool is_null (false);
|
||||||
|
std::size_t size (0);
|
||||||
|
std::size_t cap (i.regionLookupKey_value.capacity ());
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::set_image (
|
||||||
|
i.regionLookupKey_value,
|
||||||
|
size,
|
||||||
|
is_null,
|
||||||
|
v);
|
||||||
|
i.regionLookupKey_null = is_null;
|
||||||
|
i.regionLookupKey_size = size;
|
||||||
|
grew = grew || (cap != i.regionLookupKey_value.capacity ());
|
||||||
|
}
|
||||||
|
|
||||||
|
return grew;
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::GovernmentAddress, 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
// addressLabel
|
||||||
|
//
|
||||||
|
{
|
||||||
|
::std::string& v =
|
||||||
|
o.addressLabel;
|
||||||
|
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::set_value (
|
||||||
|
v,
|
||||||
|
i.addressLabel_value,
|
||||||
|
i.addressLabel_size,
|
||||||
|
i.addressLabel_null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// regionLookupKey
|
||||||
|
//
|
||||||
|
{
|
||||||
|
::std::string& v =
|
||||||
|
o.regionLookupKey;
|
||||||
|
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::set_value (
|
||||||
|
v,
|
||||||
|
i.regionLookupKey_value,
|
||||||
|
i.regionLookupKey_size,
|
||||||
|
i.regionLookupKey_null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::GovernmentAddress, 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< ::models::GovernmentAddress, id_pgsql >::persist_statement[] =
|
||||||
|
"INSERT INTO \"GovernmentAddress\" "
|
||||||
|
"(\"id\", "
|
||||||
|
"\"addressLabel\", "
|
||||||
|
"\"regionLookupKey\") "
|
||||||
|
"VALUES "
|
||||||
|
"($1, $2, $3)";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::find_statement[] =
|
||||||
|
"SELECT "
|
||||||
|
"\"GovernmentAddress\".\"id\", "
|
||||||
|
"\"GovernmentAddress\".\"addressLabel\", "
|
||||||
|
"\"GovernmentAddress\".\"regionLookupKey\" "
|
||||||
|
"FROM \"GovernmentAddress\" "
|
||||||
|
"WHERE \"GovernmentAddress\".\"id\"=$1";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::update_statement[] =
|
||||||
|
"UPDATE \"GovernmentAddress\" "
|
||||||
|
"SET "
|
||||||
|
"\"addressLabel\"=$1, "
|
||||||
|
"\"regionLookupKey\"=$2 "
|
||||||
|
"WHERE \"id\"=$3";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::erase_statement[] =
|
||||||
|
"DELETE FROM \"GovernmentAddress\" "
|
||||||
|
"WHERE \"id\"=$1";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::query_statement[] =
|
||||||
|
"SELECT "
|
||||||
|
"\"GovernmentAddress\".\"id\", "
|
||||||
|
"\"GovernmentAddress\".\"addressLabel\", "
|
||||||
|
"\"GovernmentAddress\".\"regionLookupKey\" "
|
||||||
|
"FROM \"GovernmentAddress\"";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::erase_query_statement[] =
|
||||||
|
"DELETE FROM \"GovernmentAddress\"";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::table_name[] =
|
||||||
|
"\"GovernmentAddress\"";
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
persist (database& db, const object_type& obj)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
|
||||||
|
using namespace pgsql;
|
||||||
|
|
||||||
|
pgsql::connection& conn (
|
||||||
|
pgsql::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
callback (db,
|
||||||
|
obj,
|
||||||
|
callback_event::pre_persist);
|
||||||
|
|
||||||
|
image_type& im (sts.image ());
|
||||||
|
binding& imb (sts.insert_image_binding ());
|
||||||
|
|
||||||
|
if (init (im, obj, statement_insert))
|
||||||
|
im.version++;
|
||||||
|
|
||||||
|
if (im.version != sts.insert_image_version () ||
|
||||||
|
imb.version == 0)
|
||||||
|
{
|
||||||
|
bind (imb.bind, im, statement_insert);
|
||||||
|
sts.insert_image_version (im.version);
|
||||||
|
imb.version++;
|
||||||
|
}
|
||||||
|
|
||||||
|
insert_statement& st (sts.persist_statement ());
|
||||||
|
if (!st.execute ())
|
||||||
|
throw object_already_persistent ();
|
||||||
|
|
||||||
|
callback (db,
|
||||||
|
obj,
|
||||||
|
callback_event::post_persist);
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
update (database& db, const object_type& obj)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
|
||||||
|
using namespace pgsql;
|
||||||
|
using pgsql::update_statement;
|
||||||
|
|
||||||
|
callback (db, obj, callback_event::pre_update);
|
||||||
|
|
||||||
|
pgsql::transaction& tr (pgsql::transaction::current ());
|
||||||
|
pgsql::connection& conn (tr.connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
const id_type& id (
|
||||||
|
obj.id);
|
||||||
|
id_image_type& idi (sts.id_image ());
|
||||||
|
init (idi, id);
|
||||||
|
|
||||||
|
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< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
erase (database& db, const id_type& id)
|
||||||
|
{
|
||||||
|
using namespace pgsql;
|
||||||
|
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
|
||||||
|
pgsql::connection& conn (
|
||||||
|
pgsql::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
id_image_type& i (sts.id_image ());
|
||||||
|
init (i, id);
|
||||||
|
|
||||||
|
binding& idb (sts.id_image_binding ());
|
||||||
|
if (i.version != sts.id_image_version () || idb.version == 0)
|
||||||
|
{
|
||||||
|
bind (idb.bind, i);
|
||||||
|
sts.id_image_version (i.version);
|
||||||
|
idb.version++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sts.erase_statement ().execute () != 1)
|
||||||
|
throw object_not_persistent ();
|
||||||
|
|
||||||
|
pointer_cache_traits::erase (db, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::pointer_type
|
||||||
|
access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
find (database& db, const id_type& id)
|
||||||
|
{
|
||||||
|
using namespace pgsql;
|
||||||
|
|
||||||
|
{
|
||||||
|
pointer_type p (pointer_cache_traits::find (db, id));
|
||||||
|
|
||||||
|
if (!pointer_traits::null_ptr (p))
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
pgsql::connection& conn (
|
||||||
|
pgsql::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
statements_type::auto_lock l (sts);
|
||||||
|
|
||||||
|
if (l.locked ())
|
||||||
|
{
|
||||||
|
if (!find_ (sts, &id))
|
||||||
|
return pointer_type ();
|
||||||
|
}
|
||||||
|
|
||||||
|
pointer_type p (
|
||||||
|
access::object_factory<object_type, pointer_type>::create ());
|
||||||
|
pointer_traits::guard pg (p);
|
||||||
|
|
||||||
|
pointer_cache_traits::insert_guard ig (
|
||||||
|
pointer_cache_traits::insert (db, id, p));
|
||||||
|
|
||||||
|
object_type& obj (pointer_traits::get_ref (p));
|
||||||
|
|
||||||
|
if (l.locked ())
|
||||||
|
{
|
||||||
|
select_statement& st (sts.find_statement ());
|
||||||
|
ODB_POTENTIALLY_UNUSED (st);
|
||||||
|
|
||||||
|
callback (db, obj, callback_event::pre_load);
|
||||||
|
init (obj, sts.image (), &db);
|
||||||
|
load_ (sts, obj, false);
|
||||||
|
sts.load_delayed (0);
|
||||||
|
l.unlock ();
|
||||||
|
callback (db, obj, callback_event::post_load);
|
||||||
|
pointer_cache_traits::load (ig.position ());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sts.delay_load (id, obj, ig.position ());
|
||||||
|
|
||||||
|
ig.release ();
|
||||||
|
pg.release ();
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
find (database& db, const id_type& id, object_type& obj)
|
||||||
|
{
|
||||||
|
using namespace pgsql;
|
||||||
|
|
||||||
|
pgsql::connection& conn (
|
||||||
|
pgsql::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
statements_type::auto_lock l (sts);
|
||||||
|
|
||||||
|
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< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
reload (database& db, object_type& obj)
|
||||||
|
{
|
||||||
|
using namespace pgsql;
|
||||||
|
|
||||||
|
pgsql::connection& conn (
|
||||||
|
pgsql::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
statements_type::auto_lock l (sts);
|
||||||
|
|
||||||
|
const id_type& id (
|
||||||
|
obj.id);
|
||||||
|
|
||||||
|
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< ::models::GovernmentAddress, 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< ::models::GovernmentAddress, id_pgsql >::object_type >
|
||||||
|
access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
query (database&, const query_base_type& q)
|
||||||
|
{
|
||||||
|
using namespace pgsql;
|
||||||
|
using odb::details::shared;
|
||||||
|
using odb::details::shared_ptr;
|
||||||
|
|
||||||
|
pgsql::connection& conn (
|
||||||
|
pgsql::transaction::current ().connection ());
|
||||||
|
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
image_type& im (sts.image ());
|
||||||
|
binding& imb (sts.select_image_binding ());
|
||||||
|
|
||||||
|
if (im.version != sts.select_image_version () ||
|
||||||
|
imb.version == 0)
|
||||||
|
{
|
||||||
|
bind (imb.bind, im, statement_select);
|
||||||
|
sts.select_image_version (im.version);
|
||||||
|
imb.version++;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string text (query_statement);
|
||||||
|
if (!q.empty ())
|
||||||
|
{
|
||||||
|
text += " ";
|
||||||
|
text += q.clause ();
|
||||||
|
}
|
||||||
|
|
||||||
|
q.init_parameters ();
|
||||||
|
shared_ptr<select_statement> st (
|
||||||
|
new (shared) select_statement (
|
||||||
|
sts.connection (),
|
||||||
|
query_statement_name,
|
||||||
|
text,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
q.parameter_types (),
|
||||||
|
q.parameter_count (),
|
||||||
|
q.parameters_binding (),
|
||||||
|
imb));
|
||||||
|
|
||||||
|
st->execute ();
|
||||||
|
st->deallocate ();
|
||||||
|
|
||||||
|
shared_ptr< odb::object_result_impl<object_type> > r (
|
||||||
|
new (shared) pgsql::object_result_impl<object_type> (
|
||||||
|
q, st, sts, 0));
|
||||||
|
|
||||||
|
return result<object_type> (r);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned long long access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
erase_query (database&, const query_base_type& q)
|
||||||
|
{
|
||||||
|
using namespace pgsql;
|
||||||
|
|
||||||
|
pgsql::connection& conn (
|
||||||
|
pgsql::transaction::current ().connection ());
|
||||||
|
|
||||||
|
std::string text (erase_query_statement);
|
||||||
|
if (!q.empty ())
|
||||||
|
{
|
||||||
|
text += ' ';
|
||||||
|
text += q.clause ();
|
||||||
|
}
|
||||||
|
|
||||||
|
q.init_parameters ();
|
||||||
|
delete_statement st (
|
||||||
|
conn,
|
||||||
|
erase_query_statement_name,
|
||||||
|
text,
|
||||||
|
q.parameter_types (),
|
||||||
|
q.parameter_count (),
|
||||||
|
q.parameters_binding ());
|
||||||
|
|
||||||
|
return st.execute ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#include <odb/post.hxx>
|
||||||
@@ -0,0 +1,309 @@
|
|||||||
|
// This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
// compiler for C++.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef GOVERNMENT_ADDRESS_ODB_HXX
|
||||||
|
#define GOVERNMENT_ADDRESS_ODB_HXX
|
||||||
|
|
||||||
|
#include <odb/version.hxx>
|
||||||
|
|
||||||
|
#if (ODB_VERSION != 20400UL)
|
||||||
|
#error ODB runtime version mismatch
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <odb/pre.hxx>
|
||||||
|
|
||||||
|
#include "GovernmentAddress.h"
|
||||||
|
|
||||||
|
#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/simple-object-result.hxx>
|
||||||
|
|
||||||
|
#include <odb/details/unused.hxx>
|
||||||
|
#include <odb/details/shared-ptr.hxx>
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// GovernmentAddress
|
||||||
|
//
|
||||||
|
template <>
|
||||||
|
struct class_traits< ::models::GovernmentAddress >
|
||||||
|
{
|
||||||
|
static const class_kind kind = class_object;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits< ::models::GovernmentAddress >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef ::models::GovernmentAddress object_type;
|
||||||
|
typedef ::models::GovernmentAddress* 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);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#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
|
||||||
|
{
|
||||||
|
// GovernmentAddress
|
||||||
|
//
|
||||||
|
template <typename A>
|
||||||
|
struct query_columns< ::models::GovernmentAddress, 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;
|
||||||
|
|
||||||
|
// addressLabel
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
pgsql::query_column<
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::query_type,
|
||||||
|
pgsql::id_string >
|
||||||
|
addressLabel_type_;
|
||||||
|
|
||||||
|
static const addressLabel_type_ addressLabel;
|
||||||
|
|
||||||
|
// regionLookupKey
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
pgsql::query_column<
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::query_type,
|
||||||
|
pgsql::id_string >
|
||||||
|
regionLookupKey_type_;
|
||||||
|
|
||||||
|
static const regionLookupKey_type_ regionLookupKey;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::GovernmentAddress, id_pgsql, A >::id_type_
|
||||||
|
query_columns< ::models::GovernmentAddress, id_pgsql, A >::
|
||||||
|
id (A::table_name, "\"id\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::GovernmentAddress, id_pgsql, A >::addressLabel_type_
|
||||||
|
query_columns< ::models::GovernmentAddress, id_pgsql, A >::
|
||||||
|
addressLabel (A::table_name, "\"addressLabel\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::GovernmentAddress, id_pgsql, A >::regionLookupKey_type_
|
||||||
|
query_columns< ::models::GovernmentAddress, id_pgsql, A >::
|
||||||
|
regionLookupKey (A::table_name, "\"regionLookupKey\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
struct pointer_query_columns< ::models::GovernmentAddress, id_pgsql, A >:
|
||||||
|
query_columns< ::models::GovernmentAddress, id_pgsql, A >
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >:
|
||||||
|
public access::object_traits< ::models::GovernmentAddress >
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
|
||||||
|
// addressLabel
|
||||||
|
//
|
||||||
|
details::buffer addressLabel_value;
|
||||||
|
std::size_t addressLabel_size;
|
||||||
|
bool addressLabel_null;
|
||||||
|
|
||||||
|
// regionLookupKey
|
||||||
|
//
|
||||||
|
details::buffer regionLookupKey_value;
|
||||||
|
std::size_t regionLookupKey_size;
|
||||||
|
bool regionLookupKey_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 = 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 const char persist_statement_name[];
|
||||||
|
static const char find_statement_name[];
|
||||||
|
static const char update_statement_name[];
|
||||||
|
static const char erase_statement_name[];
|
||||||
|
static const char query_statement_name[];
|
||||||
|
static const char erase_query_statement_name[];
|
||||||
|
|
||||||
|
static const unsigned int persist_statement_types[];
|
||||||
|
static const unsigned int find_statement_types[];
|
||||||
|
static const unsigned int update_statement_types[];
|
||||||
|
|
||||||
|
public:
|
||||||
|
static bool
|
||||||
|
find_ (statements_type&,
|
||||||
|
const id_type*);
|
||||||
|
|
||||||
|
static void
|
||||||
|
load_ (statements_type&,
|
||||||
|
object_type&,
|
||||||
|
bool reload);
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits_impl< ::models::GovernmentAddress, id_common >:
|
||||||
|
public access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
// GovernmentAddress
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "GovernmentAddress-odb.ixx"
|
||||||
|
|
||||||
|
#include <odb/post.hxx>
|
||||||
|
|
||||||
|
#endif // GOVERNMENT_ADDRESS_ODB_HXX
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
// This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
// compiler for C++.
|
||||||
|
//
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// GovernmentAddress
|
||||||
|
//
|
||||||
|
|
||||||
|
inline
|
||||||
|
access::object_traits< ::models::GovernmentAddress >::id_type
|
||||||
|
access::object_traits< ::models::GovernmentAddress >::
|
||||||
|
id (const object_type& o)
|
||||||
|
{
|
||||||
|
return o.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
void access::object_traits< ::models::GovernmentAddress >::
|
||||||
|
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< ::models::GovernmentAddress >::
|
||||||
|
callback (database& db, const object_type& x, callback_event e)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
ODB_POTENTIALLY_UNUSED (x);
|
||||||
|
ODB_POTENTIALLY_UNUSED (e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// GovernmentAddress
|
||||||
|
//
|
||||||
|
|
||||||
|
inline
|
||||||
|
void access::object_traits_impl< ::models::GovernmentAddress, 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< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
load_ (statements_type& sts,
|
||||||
|
object_type& obj,
|
||||||
|
bool)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (sts);
|
||||||
|
ODB_POTENTIALLY_UNUSED (obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" version="1">
|
||||||
|
<model version="1">
|
||||||
|
<table name="GovernmentAddress" kind="object">
|
||||||
|
<column name="id" type="TEXT" null="false"/>
|
||||||
|
<column name="addressLabel" type="TEXT" null="false"/>
|
||||||
|
<column name="regionLookupKey" type="TEXT" null="false"/>
|
||||||
|
<primary-key>
|
||||||
|
<column name="id"/>
|
||||||
|
</primary-key>
|
||||||
|
</table>
|
||||||
|
</model>
|
||||||
|
</changelog>
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,516 @@
|
|||||||
|
// This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
// compiler for C++.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef TRIP_ATTEMPT_RESULT_ODB_HXX
|
||||||
|
#define TRIP_ATTEMPT_RESULT_ODB_HXX
|
||||||
|
|
||||||
|
#include <odb/version.hxx>
|
||||||
|
|
||||||
|
#if (ODB_VERSION != 20400UL)
|
||||||
|
#error ODB runtime version mismatch
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <odb/pre.hxx>
|
||||||
|
|
||||||
|
#include "TripAttemptResult.h"
|
||||||
|
|
||||||
|
#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/simple-object-result.hxx>
|
||||||
|
|
||||||
|
#include <odb/details/unused.hxx>
|
||||||
|
#include <odb/details/shared-ptr.hxx>
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// TripAttemptResult
|
||||||
|
//
|
||||||
|
template <>
|
||||||
|
struct class_traits< ::models::TripAttemptResult >
|
||||||
|
{
|
||||||
|
static const class_kind kind = class_object;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits< ::models::TripAttemptResult >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef ::models::TripAttemptResult object_type;
|
||||||
|
typedef ::models::TripAttemptResult* 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);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#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
|
||||||
|
{
|
||||||
|
// TripAttemptResult
|
||||||
|
//
|
||||||
|
template <typename A>
|
||||||
|
struct query_columns< ::models::TripAttemptResult, 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;
|
||||||
|
|
||||||
|
// result
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
pgsql::query_column<
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::query_type,
|
||||||
|
pgsql::id_string >
|
||||||
|
result_type_;
|
||||||
|
|
||||||
|
static const result_type_ result;
|
||||||
|
|
||||||
|
// retryReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
pgsql::query_column<
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::query_type,
|
||||||
|
pgsql::id_string >
|
||||||
|
retryReason_type_;
|
||||||
|
|
||||||
|
static const retryReason_type_ retryReason;
|
||||||
|
|
||||||
|
// governmentSuspensionReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
pgsql::query_column<
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::query_type,
|
||||||
|
pgsql::id_string >
|
||||||
|
governmentSuspensionReason_type_;
|
||||||
|
|
||||||
|
static const governmentSuspensionReason_type_ governmentSuspensionReason;
|
||||||
|
|
||||||
|
// governmentTerminationReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
pgsql::query_column<
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::query_type,
|
||||||
|
pgsql::id_string >
|
||||||
|
governmentTerminationReason_type_;
|
||||||
|
|
||||||
|
static const governmentTerminationReason_type_ governmentTerminationReason;
|
||||||
|
|
||||||
|
// complianceSuspensionReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
pgsql::query_column<
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::query_type,
|
||||||
|
pgsql::id_string >
|
||||||
|
complianceSuspensionReason_type_;
|
||||||
|
|
||||||
|
static const complianceSuspensionReason_type_ complianceSuspensionReason;
|
||||||
|
|
||||||
|
// complianceTerminationReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
pgsql::query_column<
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::query_type,
|
||||||
|
pgsql::id_string >
|
||||||
|
complianceTerminationReason_type_;
|
||||||
|
|
||||||
|
static const complianceTerminationReason_type_ complianceTerminationReason;
|
||||||
|
|
||||||
|
// policySuspensionReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
pgsql::query_column<
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::query_type,
|
||||||
|
pgsql::id_string >
|
||||||
|
policySuspensionReason_type_;
|
||||||
|
|
||||||
|
static const policySuspensionReason_type_ policySuspensionReason;
|
||||||
|
|
||||||
|
// policyTerminationReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
pgsql::query_column<
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::query_type,
|
||||||
|
pgsql::id_string >
|
||||||
|
policyTerminationReason_type_;
|
||||||
|
|
||||||
|
static const policyTerminationReason_type_ policyTerminationReason;
|
||||||
|
|
||||||
|
// cancelationReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
pgsql::query_column<
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::query_type,
|
||||||
|
pgsql::id_string >
|
||||||
|
cancelationReason_type_;
|
||||||
|
|
||||||
|
static const cancelationReason_type_ cancelationReason;
|
||||||
|
|
||||||
|
// failureReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
pgsql::query_column<
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::query_type,
|
||||||
|
pgsql::id_string >
|
||||||
|
failureReason_type_;
|
||||||
|
|
||||||
|
static const failureReason_type_ failureReason;
|
||||||
|
|
||||||
|
// details
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
pgsql::query_column<
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::query_type,
|
||||||
|
pgsql::id_string >
|
||||||
|
details_type_;
|
||||||
|
|
||||||
|
static const details_type_ details;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_pgsql, A >::id_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_pgsql, A >::
|
||||||
|
id (A::table_name, "\"id\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_pgsql, A >::result_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_pgsql, A >::
|
||||||
|
result (A::table_name, "\"result\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_pgsql, A >::retryReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_pgsql, A >::
|
||||||
|
retryReason (A::table_name, "\"retryReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_pgsql, A >::governmentSuspensionReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_pgsql, A >::
|
||||||
|
governmentSuspensionReason (A::table_name, "\"governmentSuspensionReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_pgsql, A >::governmentTerminationReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_pgsql, A >::
|
||||||
|
governmentTerminationReason (A::table_name, "\"governmentTerminationReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_pgsql, A >::complianceSuspensionReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_pgsql, A >::
|
||||||
|
complianceSuspensionReason (A::table_name, "\"complianceSuspensionReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_pgsql, A >::complianceTerminationReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_pgsql, A >::
|
||||||
|
complianceTerminationReason (A::table_name, "\"complianceTerminationReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_pgsql, A >::policySuspensionReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_pgsql, A >::
|
||||||
|
policySuspensionReason (A::table_name, "\"policySuspensionReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_pgsql, A >::policyTerminationReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_pgsql, A >::
|
||||||
|
policyTerminationReason (A::table_name, "\"policyTerminationReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_pgsql, A >::cancelationReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_pgsql, A >::
|
||||||
|
cancelationReason (A::table_name, "\"cancelationReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_pgsql, A >::failureReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_pgsql, A >::
|
||||||
|
failureReason (A::table_name, "\"failureReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_pgsql, A >::details_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_pgsql, A >::
|
||||||
|
details (A::table_name, "\"details\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
struct pointer_query_columns< ::models::TripAttemptResult, id_pgsql, A >:
|
||||||
|
query_columns< ::models::TripAttemptResult, id_pgsql, A >
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits_impl< ::models::TripAttemptResult, id_pgsql >:
|
||||||
|
public access::object_traits< ::models::TripAttemptResult >
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
|
||||||
|
// result
|
||||||
|
//
|
||||||
|
details::buffer result_value;
|
||||||
|
std::size_t result_size;
|
||||||
|
bool result_null;
|
||||||
|
|
||||||
|
// retryReason
|
||||||
|
//
|
||||||
|
details::buffer retryReason_value;
|
||||||
|
std::size_t retryReason_size;
|
||||||
|
bool retryReason_null;
|
||||||
|
|
||||||
|
// governmentSuspensionReason
|
||||||
|
//
|
||||||
|
details::buffer governmentSuspensionReason_value;
|
||||||
|
std::size_t governmentSuspensionReason_size;
|
||||||
|
bool governmentSuspensionReason_null;
|
||||||
|
|
||||||
|
// governmentTerminationReason
|
||||||
|
//
|
||||||
|
details::buffer governmentTerminationReason_value;
|
||||||
|
std::size_t governmentTerminationReason_size;
|
||||||
|
bool governmentTerminationReason_null;
|
||||||
|
|
||||||
|
// complianceSuspensionReason
|
||||||
|
//
|
||||||
|
details::buffer complianceSuspensionReason_value;
|
||||||
|
std::size_t complianceSuspensionReason_size;
|
||||||
|
bool complianceSuspensionReason_null;
|
||||||
|
|
||||||
|
// complianceTerminationReason
|
||||||
|
//
|
||||||
|
details::buffer complianceTerminationReason_value;
|
||||||
|
std::size_t complianceTerminationReason_size;
|
||||||
|
bool complianceTerminationReason_null;
|
||||||
|
|
||||||
|
// policySuspensionReason
|
||||||
|
//
|
||||||
|
details::buffer policySuspensionReason_value;
|
||||||
|
std::size_t policySuspensionReason_size;
|
||||||
|
bool policySuspensionReason_null;
|
||||||
|
|
||||||
|
// policyTerminationReason
|
||||||
|
//
|
||||||
|
details::buffer policyTerminationReason_value;
|
||||||
|
std::size_t policyTerminationReason_size;
|
||||||
|
bool policyTerminationReason_null;
|
||||||
|
|
||||||
|
// cancelationReason
|
||||||
|
//
|
||||||
|
details::buffer cancelationReason_value;
|
||||||
|
std::size_t cancelationReason_size;
|
||||||
|
bool cancelationReason_null;
|
||||||
|
|
||||||
|
// failureReason
|
||||||
|
//
|
||||||
|
details::buffer failureReason_value;
|
||||||
|
std::size_t failureReason_size;
|
||||||
|
bool failureReason_null;
|
||||||
|
|
||||||
|
// details
|
||||||
|
//
|
||||||
|
details::buffer details_value;
|
||||||
|
std::size_t details_size;
|
||||||
|
bool details_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 = 12UL;
|
||||||
|
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 const char persist_statement_name[];
|
||||||
|
static const char find_statement_name[];
|
||||||
|
static const char update_statement_name[];
|
||||||
|
static const char erase_statement_name[];
|
||||||
|
static const char query_statement_name[];
|
||||||
|
static const char erase_query_statement_name[];
|
||||||
|
|
||||||
|
static const unsigned int persist_statement_types[];
|
||||||
|
static const unsigned int find_statement_types[];
|
||||||
|
static const unsigned int update_statement_types[];
|
||||||
|
|
||||||
|
public:
|
||||||
|
static bool
|
||||||
|
find_ (statements_type&,
|
||||||
|
const id_type*);
|
||||||
|
|
||||||
|
static void
|
||||||
|
load_ (statements_type&,
|
||||||
|
object_type&,
|
||||||
|
bool reload);
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits_impl< ::models::TripAttemptResult, id_common >:
|
||||||
|
public access::object_traits_impl< ::models::TripAttemptResult, id_pgsql >
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
// TripAttemptResult
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "TripAttemptResult-odb.ixx"
|
||||||
|
|
||||||
|
#include <odb/post.hxx>
|
||||||
|
|
||||||
|
#endif // TRIP_ATTEMPT_RESULT_ODB_HXX
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
// This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
// compiler for C++.
|
||||||
|
//
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// TripAttemptResult
|
||||||
|
//
|
||||||
|
|
||||||
|
inline
|
||||||
|
access::object_traits< ::models::TripAttemptResult >::id_type
|
||||||
|
access::object_traits< ::models::TripAttemptResult >::
|
||||||
|
id (const object_type& o)
|
||||||
|
{
|
||||||
|
return o.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
void access::object_traits< ::models::TripAttemptResult >::
|
||||||
|
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< ::models::TripAttemptResult >::
|
||||||
|
callback (database& db, const object_type& x, callback_event e)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
ODB_POTENTIALLY_UNUSED (x);
|
||||||
|
ODB_POTENTIALLY_UNUSED (e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// TripAttemptResult
|
||||||
|
//
|
||||||
|
|
||||||
|
inline
|
||||||
|
void access::object_traits_impl< ::models::TripAttemptResult, 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< ::models::TripAttemptResult, id_pgsql >::
|
||||||
|
load_ (statements_type& sts,
|
||||||
|
object_type& obj,
|
||||||
|
bool)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (sts);
|
||||||
|
ODB_POTENTIALLY_UNUSED (obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" version="1">
|
||||||
|
<model version="1">
|
||||||
|
<table name="TripAttemptResult" kind="object">
|
||||||
|
<column name="id" type="TEXT" null="false"/>
|
||||||
|
<column name="result" type="TEXT" null="false"/>
|
||||||
|
<column name="retryReason" type="TEXT" null="false"/>
|
||||||
|
<column name="governmentSuspensionReason" type="TEXT" null="false"/>
|
||||||
|
<column name="governmentTerminationReason" type="TEXT" null="false"/>
|
||||||
|
<column name="complianceSuspensionReason" type="TEXT" null="false"/>
|
||||||
|
<column name="complianceTerminationReason" type="TEXT" null="false"/>
|
||||||
|
<column name="policySuspensionReason" type="TEXT" null="false"/>
|
||||||
|
<column name="policyTerminationReason" type="TEXT" null="false"/>
|
||||||
|
<column name="cancelationReason" type="TEXT" null="false"/>
|
||||||
|
<column name="failureReason" type="TEXT" null="false"/>
|
||||||
|
<column name="details" type="TEXT" null="false"/>
|
||||||
|
<primary-key>
|
||||||
|
<column name="id"/>
|
||||||
|
</primary-key>
|
||||||
|
</table>
|
||||||
|
</model>
|
||||||
|
</changelog>
|
||||||
770
db/test-schema-v1.1/generated-odb-source/sqlite/Agent-odb.cxx
Normal file
770
db/test-schema-v1.1/generated-odb-source/sqlite/Agent-odb.cxx
Normal file
@@ -0,0 +1,770 @@
|
|||||||
|
// This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
// compiler for C++.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <odb/pre.hxx>
|
||||||
|
|
||||||
|
#include "Agent-odb.hxx"
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
#include <cstring> // std::memcpy
|
||||||
|
|
||||||
|
|
||||||
|
#include <odb/sqlite/traits.hxx>
|
||||||
|
#include <odb/sqlite/database.hxx>
|
||||||
|
#include <odb/sqlite/transaction.hxx>
|
||||||
|
#include <odb/sqlite/connection.hxx>
|
||||||
|
#include <odb/sqlite/statement.hxx>
|
||||||
|
#include <odb/sqlite/statement-cache.hxx>
|
||||||
|
#include <odb/sqlite/simple-object-statements.hxx>
|
||||||
|
#include <odb/sqlite/container-statements.hxx>
|
||||||
|
#include <odb/sqlite/exceptions.hxx>
|
||||||
|
#include <odb/sqlite/simple-object-result.hxx>
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// Agent
|
||||||
|
//
|
||||||
|
|
||||||
|
struct access::object_traits_impl< ::models::Agent, id_sqlite >::extra_statement_cache_type
|
||||||
|
{
|
||||||
|
extra_statement_cache_type (
|
||||||
|
sqlite::connection&,
|
||||||
|
image_type&,
|
||||||
|
id_image_type&,
|
||||||
|
sqlite::binding&,
|
||||||
|
sqlite::binding&)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
access::object_traits_impl< ::models::Agent, id_sqlite >::id_type
|
||||||
|
access::object_traits_impl< ::models::Agent, id_sqlite >::
|
||||||
|
id (const image_type& i)
|
||||||
|
{
|
||||||
|
sqlite::database* db (0);
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
|
||||||
|
id_type id;
|
||||||
|
{
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::set_value (
|
||||||
|
id,
|
||||||
|
i.id_value,
|
||||||
|
i.id_size,
|
||||||
|
i.id_null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool access::object_traits_impl< ::models::Agent, id_sqlite >::
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// role
|
||||||
|
//
|
||||||
|
if (t[1UL])
|
||||||
|
{
|
||||||
|
i.role_value.capacity (i.role_size);
|
||||||
|
grew = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// persistent
|
||||||
|
//
|
||||||
|
t[2UL] = false;
|
||||||
|
|
||||||
|
// displayName
|
||||||
|
//
|
||||||
|
if (t[3UL])
|
||||||
|
{
|
||||||
|
i.displayName_value.capacity (i.displayName_size);
|
||||||
|
grew = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return grew;
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::Agent, id_sqlite >::
|
||||||
|
bind (sqlite::bind* b,
|
||||||
|
image_type& i,
|
||||||
|
sqlite::statement_kind sk)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (sk);
|
||||||
|
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
std::size_t n (0);
|
||||||
|
|
||||||
|
// id
|
||||||
|
//
|
||||||
|
if (sk != statement_update)
|
||||||
|
{
|
||||||
|
b[n].type = sqlite::image_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text>::bind_value;
|
||||||
|
b[n].buffer = i.id_value.data ();
|
||||||
|
b[n].size = &i.id_size;
|
||||||
|
b[n].capacity = i.id_value.capacity ();
|
||||||
|
b[n].is_null = &i.id_null;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// role
|
||||||
|
//
|
||||||
|
b[n].type = sqlite::image_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text>::bind_value;
|
||||||
|
b[n].buffer = i.role_value.data ();
|
||||||
|
b[n].size = &i.role_size;
|
||||||
|
b[n].capacity = i.role_value.capacity ();
|
||||||
|
b[n].is_null = &i.role_null;
|
||||||
|
n++;
|
||||||
|
|
||||||
|
// persistent
|
||||||
|
//
|
||||||
|
b[n].type = sqlite::bind::integer;
|
||||||
|
b[n].buffer = &i.persistent_value;
|
||||||
|
b[n].is_null = &i.persistent_null;
|
||||||
|
n++;
|
||||||
|
|
||||||
|
// displayName
|
||||||
|
//
|
||||||
|
b[n].type = sqlite::image_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text>::bind_value;
|
||||||
|
b[n].buffer = i.displayName_value.data ();
|
||||||
|
b[n].size = &i.displayName_size;
|
||||||
|
b[n].capacity = i.displayName_value.capacity ();
|
||||||
|
b[n].is_null = &i.displayName_null;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::Agent, id_sqlite >::
|
||||||
|
bind (sqlite::bind* b, id_image_type& i)
|
||||||
|
{
|
||||||
|
std::size_t n (0);
|
||||||
|
b[n].type = sqlite::image_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text>::bind_value;
|
||||||
|
b[n].buffer = i.id_value.data ();
|
||||||
|
b[n].size = &i.id_size;
|
||||||
|
b[n].capacity = i.id_value.capacity ();
|
||||||
|
b[n].is_null = &i.id_null;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool access::object_traits_impl< ::models::Agent, id_sqlite >::
|
||||||
|
init (image_type& i,
|
||||||
|
const object_type& o,
|
||||||
|
sqlite::statement_kind sk)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (i);
|
||||||
|
ODB_POTENTIALLY_UNUSED (o);
|
||||||
|
ODB_POTENTIALLY_UNUSED (sk);
|
||||||
|
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
bool grew (false);
|
||||||
|
|
||||||
|
// id
|
||||||
|
//
|
||||||
|
if (sk == statement_insert)
|
||||||
|
{
|
||||||
|
::std::string const& v =
|
||||||
|
o.id;
|
||||||
|
|
||||||
|
bool is_null (false);
|
||||||
|
std::size_t cap (i.id_value.capacity ());
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::set_image (
|
||||||
|
i.id_value,
|
||||||
|
i.id_size,
|
||||||
|
is_null,
|
||||||
|
v);
|
||||||
|
i.id_null = is_null;
|
||||||
|
grew = grew || (cap != i.id_value.capacity ());
|
||||||
|
}
|
||||||
|
|
||||||
|
// role
|
||||||
|
//
|
||||||
|
{
|
||||||
|
::std::string const& v =
|
||||||
|
o.role;
|
||||||
|
|
||||||
|
bool is_null (false);
|
||||||
|
std::size_t cap (i.role_value.capacity ());
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::set_image (
|
||||||
|
i.role_value,
|
||||||
|
i.role_size,
|
||||||
|
is_null,
|
||||||
|
v);
|
||||||
|
i.role_null = is_null;
|
||||||
|
grew = grew || (cap != i.role_value.capacity ());
|
||||||
|
}
|
||||||
|
|
||||||
|
// persistent
|
||||||
|
//
|
||||||
|
{
|
||||||
|
bool const& v =
|
||||||
|
o.persistent;
|
||||||
|
|
||||||
|
bool is_null (false);
|
||||||
|
sqlite::value_traits<
|
||||||
|
bool,
|
||||||
|
sqlite::id_integer >::set_image (
|
||||||
|
i.persistent_value,
|
||||||
|
is_null,
|
||||||
|
v);
|
||||||
|
i.persistent_null = is_null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// displayName
|
||||||
|
//
|
||||||
|
{
|
||||||
|
::std::string const& v =
|
||||||
|
o.displayName;
|
||||||
|
|
||||||
|
bool is_null (false);
|
||||||
|
std::size_t cap (i.displayName_value.capacity ());
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::set_image (
|
||||||
|
i.displayName_value,
|
||||||
|
i.displayName_size,
|
||||||
|
is_null,
|
||||||
|
v);
|
||||||
|
i.displayName_null = is_null;
|
||||||
|
grew = grew || (cap != i.displayName_value.capacity ());
|
||||||
|
}
|
||||||
|
|
||||||
|
return grew;
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::Agent, id_sqlite >::
|
||||||
|
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;
|
||||||
|
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::set_value (
|
||||||
|
v,
|
||||||
|
i.id_value,
|
||||||
|
i.id_size,
|
||||||
|
i.id_null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// role
|
||||||
|
//
|
||||||
|
{
|
||||||
|
::std::string& v =
|
||||||
|
o.role;
|
||||||
|
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::set_value (
|
||||||
|
v,
|
||||||
|
i.role_value,
|
||||||
|
i.role_size,
|
||||||
|
i.role_null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// persistent
|
||||||
|
//
|
||||||
|
{
|
||||||
|
bool& v =
|
||||||
|
o.persistent;
|
||||||
|
|
||||||
|
sqlite::value_traits<
|
||||||
|
bool,
|
||||||
|
sqlite::id_integer >::set_value (
|
||||||
|
v,
|
||||||
|
i.persistent_value,
|
||||||
|
i.persistent_null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// displayName
|
||||||
|
//
|
||||||
|
{
|
||||||
|
::std::string& v =
|
||||||
|
o.displayName;
|
||||||
|
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::set_value (
|
||||||
|
v,
|
||||||
|
i.displayName_value,
|
||||||
|
i.displayName_size,
|
||||||
|
i.displayName_null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::Agent, id_sqlite >::
|
||||||
|
init (id_image_type& i, const id_type& id)
|
||||||
|
{
|
||||||
|
bool grew (false);
|
||||||
|
{
|
||||||
|
bool is_null (false);
|
||||||
|
std::size_t cap (i.id_value.capacity ());
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::set_image (
|
||||||
|
i.id_value,
|
||||||
|
i.id_size,
|
||||||
|
is_null,
|
||||||
|
id);
|
||||||
|
i.id_null = is_null;
|
||||||
|
grew = grew || (cap != i.id_value.capacity ());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (grew)
|
||||||
|
i.version++;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_sqlite >::persist_statement[] =
|
||||||
|
"INSERT INTO \"Agent\" "
|
||||||
|
"(\"id\", "
|
||||||
|
"\"role\", "
|
||||||
|
"\"persistent\", "
|
||||||
|
"\"displayName\") "
|
||||||
|
"VALUES "
|
||||||
|
"(?, ?, ?, ?)";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_sqlite >::find_statement[] =
|
||||||
|
"SELECT "
|
||||||
|
"\"Agent\".\"id\", "
|
||||||
|
"\"Agent\".\"role\", "
|
||||||
|
"\"Agent\".\"persistent\", "
|
||||||
|
"\"Agent\".\"displayName\" "
|
||||||
|
"FROM \"Agent\" "
|
||||||
|
"WHERE \"Agent\".\"id\"=?";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_sqlite >::update_statement[] =
|
||||||
|
"UPDATE \"Agent\" "
|
||||||
|
"SET "
|
||||||
|
"\"role\"=?, "
|
||||||
|
"\"persistent\"=?, "
|
||||||
|
"\"displayName\"=? "
|
||||||
|
"WHERE \"id\"=?";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_sqlite >::erase_statement[] =
|
||||||
|
"DELETE FROM \"Agent\" "
|
||||||
|
"WHERE \"id\"=?";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_sqlite >::query_statement[] =
|
||||||
|
"SELECT "
|
||||||
|
"\"Agent\".\"id\", "
|
||||||
|
"\"Agent\".\"role\", "
|
||||||
|
"\"Agent\".\"persistent\", "
|
||||||
|
"\"Agent\".\"displayName\" "
|
||||||
|
"FROM \"Agent\"";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_sqlite >::erase_query_statement[] =
|
||||||
|
"DELETE FROM \"Agent\"";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_sqlite >::table_name[] =
|
||||||
|
"\"Agent\"";
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::Agent, id_sqlite >::
|
||||||
|
persist (database& db, const object_type& obj)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
sqlite::connection& conn (
|
||||||
|
sqlite::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
callback (db,
|
||||||
|
obj,
|
||||||
|
callback_event::pre_persist);
|
||||||
|
|
||||||
|
image_type& im (sts.image ());
|
||||||
|
binding& imb (sts.insert_image_binding ());
|
||||||
|
|
||||||
|
if (init (im, obj, statement_insert))
|
||||||
|
im.version++;
|
||||||
|
|
||||||
|
if (im.version != sts.insert_image_version () ||
|
||||||
|
imb.version == 0)
|
||||||
|
{
|
||||||
|
bind (imb.bind, im, statement_insert);
|
||||||
|
sts.insert_image_version (im.version);
|
||||||
|
imb.version++;
|
||||||
|
}
|
||||||
|
|
||||||
|
insert_statement& st (sts.persist_statement ());
|
||||||
|
if (!st.execute ())
|
||||||
|
throw object_already_persistent ();
|
||||||
|
|
||||||
|
callback (db,
|
||||||
|
obj,
|
||||||
|
callback_event::post_persist);
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::Agent, id_sqlite >::
|
||||||
|
update (database& db, const object_type& obj)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
|
||||||
|
using namespace sqlite;
|
||||||
|
using sqlite::update_statement;
|
||||||
|
|
||||||
|
callback (db, obj, callback_event::pre_update);
|
||||||
|
|
||||||
|
sqlite::transaction& tr (sqlite::transaction::current ());
|
||||||
|
sqlite::connection& conn (tr.connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
const id_type& id (
|
||||||
|
obj.id);
|
||||||
|
id_image_type& idi (sts.id_image ());
|
||||||
|
init (idi, id);
|
||||||
|
|
||||||
|
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< ::models::Agent, id_sqlite >::
|
||||||
|
erase (database& db, const id_type& id)
|
||||||
|
{
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
|
||||||
|
sqlite::connection& conn (
|
||||||
|
sqlite::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
id_image_type& i (sts.id_image ());
|
||||||
|
init (i, id);
|
||||||
|
|
||||||
|
binding& idb (sts.id_image_binding ());
|
||||||
|
if (i.version != sts.id_image_version () || idb.version == 0)
|
||||||
|
{
|
||||||
|
bind (idb.bind, i);
|
||||||
|
sts.id_image_version (i.version);
|
||||||
|
idb.version++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sts.erase_statement ().execute () != 1)
|
||||||
|
throw object_not_persistent ();
|
||||||
|
|
||||||
|
pointer_cache_traits::erase (db, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
access::object_traits_impl< ::models::Agent, id_sqlite >::pointer_type
|
||||||
|
access::object_traits_impl< ::models::Agent, id_sqlite >::
|
||||||
|
find (database& db, const id_type& id)
|
||||||
|
{
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
{
|
||||||
|
pointer_type p (pointer_cache_traits::find (db, id));
|
||||||
|
|
||||||
|
if (!pointer_traits::null_ptr (p))
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
sqlite::connection& conn (
|
||||||
|
sqlite::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
statements_type::auto_lock l (sts);
|
||||||
|
|
||||||
|
if (l.locked ())
|
||||||
|
{
|
||||||
|
if (!find_ (sts, &id))
|
||||||
|
return pointer_type ();
|
||||||
|
}
|
||||||
|
|
||||||
|
pointer_type p (
|
||||||
|
access::object_factory<object_type, pointer_type>::create ());
|
||||||
|
pointer_traits::guard pg (p);
|
||||||
|
|
||||||
|
pointer_cache_traits::insert_guard ig (
|
||||||
|
pointer_cache_traits::insert (db, id, p));
|
||||||
|
|
||||||
|
object_type& obj (pointer_traits::get_ref (p));
|
||||||
|
|
||||||
|
if (l.locked ())
|
||||||
|
{
|
||||||
|
select_statement& st (sts.find_statement ());
|
||||||
|
ODB_POTENTIALLY_UNUSED (st);
|
||||||
|
|
||||||
|
callback (db, obj, callback_event::pre_load);
|
||||||
|
init (obj, sts.image (), &db);
|
||||||
|
load_ (sts, obj, false);
|
||||||
|
sts.load_delayed (0);
|
||||||
|
l.unlock ();
|
||||||
|
callback (db, obj, callback_event::post_load);
|
||||||
|
pointer_cache_traits::load (ig.position ());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sts.delay_load (id, obj, ig.position ());
|
||||||
|
|
||||||
|
ig.release ();
|
||||||
|
pg.release ();
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool access::object_traits_impl< ::models::Agent, id_sqlite >::
|
||||||
|
find (database& db, const id_type& id, object_type& obj)
|
||||||
|
{
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
sqlite::connection& conn (
|
||||||
|
sqlite::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
statements_type::auto_lock l (sts);
|
||||||
|
|
||||||
|
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< ::models::Agent, id_sqlite >::
|
||||||
|
reload (database& db, object_type& obj)
|
||||||
|
{
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
sqlite::connection& conn (
|
||||||
|
sqlite::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
statements_type::auto_lock l (sts);
|
||||||
|
|
||||||
|
const id_type& id (
|
||||||
|
obj.id);
|
||||||
|
|
||||||
|
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< ::models::Agent, id_sqlite >::
|
||||||
|
find_ (statements_type& sts,
|
||||||
|
const id_type* id)
|
||||||
|
{
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
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< ::models::Agent, id_sqlite >::object_type >
|
||||||
|
access::object_traits_impl< ::models::Agent, id_sqlite >::
|
||||||
|
query (database&, const query_base_type& q)
|
||||||
|
{
|
||||||
|
using namespace sqlite;
|
||||||
|
using odb::details::shared;
|
||||||
|
using odb::details::shared_ptr;
|
||||||
|
|
||||||
|
sqlite::connection& conn (
|
||||||
|
sqlite::transaction::current ().connection ());
|
||||||
|
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
image_type& im (sts.image ());
|
||||||
|
binding& imb (sts.select_image_binding ());
|
||||||
|
|
||||||
|
if (im.version != sts.select_image_version () ||
|
||||||
|
imb.version == 0)
|
||||||
|
{
|
||||||
|
bind (imb.bind, im, statement_select);
|
||||||
|
sts.select_image_version (im.version);
|
||||||
|
imb.version++;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string text (query_statement);
|
||||||
|
if (!q.empty ())
|
||||||
|
{
|
||||||
|
text += " ";
|
||||||
|
text += q.clause ();
|
||||||
|
}
|
||||||
|
|
||||||
|
q.init_parameters ();
|
||||||
|
shared_ptr<select_statement> st (
|
||||||
|
new (shared) select_statement (
|
||||||
|
conn,
|
||||||
|
text,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
q.parameters_binding (),
|
||||||
|
imb));
|
||||||
|
|
||||||
|
st->execute ();
|
||||||
|
|
||||||
|
shared_ptr< odb::object_result_impl<object_type> > r (
|
||||||
|
new (shared) sqlite::object_result_impl<object_type> (
|
||||||
|
q, st, sts, 0));
|
||||||
|
|
||||||
|
return result<object_type> (r);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned long long access::object_traits_impl< ::models::Agent, id_sqlite >::
|
||||||
|
erase_query (database&, const query_base_type& q)
|
||||||
|
{
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
sqlite::connection& conn (
|
||||||
|
sqlite::transaction::current ().connection ());
|
||||||
|
|
||||||
|
std::string text (erase_query_statement);
|
||||||
|
if (!q.empty ())
|
||||||
|
{
|
||||||
|
text += ' ';
|
||||||
|
text += q.clause ();
|
||||||
|
}
|
||||||
|
|
||||||
|
q.init_parameters ();
|
||||||
|
delete_statement st (
|
||||||
|
conn,
|
||||||
|
text,
|
||||||
|
q.parameters_binding ());
|
||||||
|
|
||||||
|
return st.execute ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#include <odb/post.hxx>
|
||||||
320
db/test-schema-v1.1/generated-odb-source/sqlite/Agent-odb.hxx
Normal file
320
db/test-schema-v1.1/generated-odb-source/sqlite/Agent-odb.hxx
Normal file
@@ -0,0 +1,320 @@
|
|||||||
|
// This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
// compiler for C++.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef AGENT_ODB_HXX
|
||||||
|
#define AGENT_ODB_HXX
|
||||||
|
|
||||||
|
#include <odb/version.hxx>
|
||||||
|
|
||||||
|
#if (ODB_VERSION != 20400UL)
|
||||||
|
#error ODB runtime version mismatch
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <odb/pre.hxx>
|
||||||
|
|
||||||
|
#include "Agent.h"
|
||||||
|
|
||||||
|
#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/simple-object-result.hxx>
|
||||||
|
|
||||||
|
#include <odb/details/unused.hxx>
|
||||||
|
#include <odb/details/shared-ptr.hxx>
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// Agent
|
||||||
|
//
|
||||||
|
template <>
|
||||||
|
struct class_traits< ::models::Agent >
|
||||||
|
{
|
||||||
|
static const class_kind kind = class_object;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits< ::models::Agent >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef ::models::Agent object_type;
|
||||||
|
typedef ::models::Agent* 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);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#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
|
||||||
|
{
|
||||||
|
// Agent
|
||||||
|
//
|
||||||
|
template <typename A>
|
||||||
|
struct query_columns< ::models::Agent, id_sqlite, A >
|
||||||
|
{
|
||||||
|
// id
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
id_type_;
|
||||||
|
|
||||||
|
static const id_type_ id;
|
||||||
|
|
||||||
|
// role
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
role_type_;
|
||||||
|
|
||||||
|
static const role_type_ role;
|
||||||
|
|
||||||
|
// persistent
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
bool,
|
||||||
|
sqlite::id_integer >::query_type,
|
||||||
|
sqlite::id_integer >
|
||||||
|
persistent_type_;
|
||||||
|
|
||||||
|
static const persistent_type_ persistent;
|
||||||
|
|
||||||
|
// displayName
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
displayName_type_;
|
||||||
|
|
||||||
|
static const displayName_type_ displayName;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::Agent, id_sqlite, A >::id_type_
|
||||||
|
query_columns< ::models::Agent, id_sqlite, A >::
|
||||||
|
id (A::table_name, "\"id\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::Agent, id_sqlite, A >::role_type_
|
||||||
|
query_columns< ::models::Agent, id_sqlite, A >::
|
||||||
|
role (A::table_name, "\"role\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::Agent, id_sqlite, A >::persistent_type_
|
||||||
|
query_columns< ::models::Agent, id_sqlite, A >::
|
||||||
|
persistent (A::table_name, "\"persistent\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::Agent, id_sqlite, A >::displayName_type_
|
||||||
|
query_columns< ::models::Agent, id_sqlite, A >::
|
||||||
|
displayName (A::table_name, "\"displayName\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
struct pointer_query_columns< ::models::Agent, id_sqlite, A >:
|
||||||
|
query_columns< ::models::Agent, id_sqlite, A >
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits_impl< ::models::Agent, id_sqlite >:
|
||||||
|
public access::object_traits< ::models::Agent >
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
|
||||||
|
// role
|
||||||
|
//
|
||||||
|
details::buffer role_value;
|
||||||
|
std::size_t role_size;
|
||||||
|
bool role_null;
|
||||||
|
|
||||||
|
// persistent
|
||||||
|
//
|
||||||
|
long long persistent_value;
|
||||||
|
bool persistent_null;
|
||||||
|
|
||||||
|
// displayName
|
||||||
|
//
|
||||||
|
details::buffer displayName_value;
|
||||||
|
std::size_t displayName_size;
|
||||||
|
bool displayName_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 (sqlite::bind*,
|
||||||
|
image_type&,
|
||||||
|
sqlite::statement_kind);
|
||||||
|
|
||||||
|
static void
|
||||||
|
bind (sqlite::bind*, id_image_type&);
|
||||||
|
|
||||||
|
static bool
|
||||||
|
init (image_type&,
|
||||||
|
const object_type&,
|
||||||
|
sqlite::statement_kind);
|
||||||
|
|
||||||
|
static void
|
||||||
|
init (object_type&,
|
||||||
|
const image_type&,
|
||||||
|
database*);
|
||||||
|
|
||||||
|
static void
|
||||||
|
init (id_image_type&, const id_type&);
|
||||||
|
|
||||||
|
typedef sqlite::object_statements<object_type> statements_type;
|
||||||
|
|
||||||
|
typedef sqlite::query_base query_base_type;
|
||||||
|
|
||||||
|
static const std::size_t column_count = 4UL;
|
||||||
|
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&);
|
||||||
|
|
||||||
|
public:
|
||||||
|
static bool
|
||||||
|
find_ (statements_type&,
|
||||||
|
const id_type*);
|
||||||
|
|
||||||
|
static void
|
||||||
|
load_ (statements_type&,
|
||||||
|
object_type&,
|
||||||
|
bool reload);
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits_impl< ::models::Agent, id_common >:
|
||||||
|
public access::object_traits_impl< ::models::Agent, id_sqlite >
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
// Agent
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "Agent-odb.ixx"
|
||||||
|
|
||||||
|
#include <odb/post.hxx>
|
||||||
|
|
||||||
|
#endif // AGENT_ODB_HXX
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
// This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
// compiler for C++.
|
||||||
|
//
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// Agent
|
||||||
|
//
|
||||||
|
|
||||||
|
inline
|
||||||
|
access::object_traits< ::models::Agent >::id_type
|
||||||
|
access::object_traits< ::models::Agent >::
|
||||||
|
id (const object_type& o)
|
||||||
|
{
|
||||||
|
return o.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
void access::object_traits< ::models::Agent >::
|
||||||
|
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< ::models::Agent >::
|
||||||
|
callback (database& db, const object_type& x, callback_event e)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
ODB_POTENTIALLY_UNUSED (x);
|
||||||
|
ODB_POTENTIALLY_UNUSED (e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// Agent
|
||||||
|
//
|
||||||
|
|
||||||
|
inline
|
||||||
|
void access::object_traits_impl< ::models::Agent, id_sqlite >::
|
||||||
|
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< ::models::Agent, id_sqlite >::
|
||||||
|
load_ (statements_type& sts,
|
||||||
|
object_type& obj,
|
||||||
|
bool)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (sts);
|
||||||
|
ODB_POTENTIALLY_UNUSED (obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
13
db/test-schema-v1.1/generated-odb-source/sqlite/Agent.xml
Normal file
13
db/test-schema-v1.1/generated-odb-source/sqlite/Agent.xml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="sqlite" version="1">
|
||||||
|
<model version="1">
|
||||||
|
<table name="Agent" kind="object">
|
||||||
|
<column name="id" type="TEXT" null="false"/>
|
||||||
|
<column name="role" type="TEXT" null="false"/>
|
||||||
|
<column name="persistent" type="INTEGER" null="false"/>
|
||||||
|
<column name="displayName" type="TEXT" null="false"/>
|
||||||
|
<primary-key>
|
||||||
|
<column name="id"/>
|
||||||
|
</primary-key>
|
||||||
|
</table>
|
||||||
|
</model>
|
||||||
|
</changelog>
|
||||||
@@ -0,0 +1,725 @@
|
|||||||
|
// This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
// compiler for C++.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <odb/pre.hxx>
|
||||||
|
|
||||||
|
#include "GovernmentAddress-odb.hxx"
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
#include <cstring> // std::memcpy
|
||||||
|
|
||||||
|
|
||||||
|
#include <odb/sqlite/traits.hxx>
|
||||||
|
#include <odb/sqlite/database.hxx>
|
||||||
|
#include <odb/sqlite/transaction.hxx>
|
||||||
|
#include <odb/sqlite/connection.hxx>
|
||||||
|
#include <odb/sqlite/statement.hxx>
|
||||||
|
#include <odb/sqlite/statement-cache.hxx>
|
||||||
|
#include <odb/sqlite/simple-object-statements.hxx>
|
||||||
|
#include <odb/sqlite/container-statements.hxx>
|
||||||
|
#include <odb/sqlite/exceptions.hxx>
|
||||||
|
#include <odb/sqlite/simple-object-result.hxx>
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// GovernmentAddress
|
||||||
|
//
|
||||||
|
|
||||||
|
struct access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::extra_statement_cache_type
|
||||||
|
{
|
||||||
|
extra_statement_cache_type (
|
||||||
|
sqlite::connection&,
|
||||||
|
image_type&,
|
||||||
|
id_image_type&,
|
||||||
|
sqlite::binding&,
|
||||||
|
sqlite::binding&)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::id_type
|
||||||
|
access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
id (const image_type& i)
|
||||||
|
{
|
||||||
|
sqlite::database* db (0);
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
|
||||||
|
id_type id;
|
||||||
|
{
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::set_value (
|
||||||
|
id,
|
||||||
|
i.id_value,
|
||||||
|
i.id_size,
|
||||||
|
i.id_null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// addressLabel
|
||||||
|
//
|
||||||
|
if (t[1UL])
|
||||||
|
{
|
||||||
|
i.addressLabel_value.capacity (i.addressLabel_size);
|
||||||
|
grew = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// regionLookupKey
|
||||||
|
//
|
||||||
|
if (t[2UL])
|
||||||
|
{
|
||||||
|
i.regionLookupKey_value.capacity (i.regionLookupKey_size);
|
||||||
|
grew = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return grew;
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
bind (sqlite::bind* b,
|
||||||
|
image_type& i,
|
||||||
|
sqlite::statement_kind sk)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (sk);
|
||||||
|
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
std::size_t n (0);
|
||||||
|
|
||||||
|
// id
|
||||||
|
//
|
||||||
|
if (sk != statement_update)
|
||||||
|
{
|
||||||
|
b[n].type = sqlite::image_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text>::bind_value;
|
||||||
|
b[n].buffer = i.id_value.data ();
|
||||||
|
b[n].size = &i.id_size;
|
||||||
|
b[n].capacity = i.id_value.capacity ();
|
||||||
|
b[n].is_null = &i.id_null;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// addressLabel
|
||||||
|
//
|
||||||
|
b[n].type = sqlite::image_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text>::bind_value;
|
||||||
|
b[n].buffer = i.addressLabel_value.data ();
|
||||||
|
b[n].size = &i.addressLabel_size;
|
||||||
|
b[n].capacity = i.addressLabel_value.capacity ();
|
||||||
|
b[n].is_null = &i.addressLabel_null;
|
||||||
|
n++;
|
||||||
|
|
||||||
|
// regionLookupKey
|
||||||
|
//
|
||||||
|
b[n].type = sqlite::image_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text>::bind_value;
|
||||||
|
b[n].buffer = i.regionLookupKey_value.data ();
|
||||||
|
b[n].size = &i.regionLookupKey_size;
|
||||||
|
b[n].capacity = i.regionLookupKey_value.capacity ();
|
||||||
|
b[n].is_null = &i.regionLookupKey_null;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
bind (sqlite::bind* b, id_image_type& i)
|
||||||
|
{
|
||||||
|
std::size_t n (0);
|
||||||
|
b[n].type = sqlite::image_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text>::bind_value;
|
||||||
|
b[n].buffer = i.id_value.data ();
|
||||||
|
b[n].size = &i.id_size;
|
||||||
|
b[n].capacity = i.id_value.capacity ();
|
||||||
|
b[n].is_null = &i.id_null;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
init (image_type& i,
|
||||||
|
const object_type& o,
|
||||||
|
sqlite::statement_kind sk)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (i);
|
||||||
|
ODB_POTENTIALLY_UNUSED (o);
|
||||||
|
ODB_POTENTIALLY_UNUSED (sk);
|
||||||
|
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
bool grew (false);
|
||||||
|
|
||||||
|
// id
|
||||||
|
//
|
||||||
|
if (sk == statement_insert)
|
||||||
|
{
|
||||||
|
::std::string const& v =
|
||||||
|
o.id;
|
||||||
|
|
||||||
|
bool is_null (false);
|
||||||
|
std::size_t cap (i.id_value.capacity ());
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::set_image (
|
||||||
|
i.id_value,
|
||||||
|
i.id_size,
|
||||||
|
is_null,
|
||||||
|
v);
|
||||||
|
i.id_null = is_null;
|
||||||
|
grew = grew || (cap != i.id_value.capacity ());
|
||||||
|
}
|
||||||
|
|
||||||
|
// addressLabel
|
||||||
|
//
|
||||||
|
{
|
||||||
|
::std::string const& v =
|
||||||
|
o.addressLabel;
|
||||||
|
|
||||||
|
bool is_null (false);
|
||||||
|
std::size_t cap (i.addressLabel_value.capacity ());
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::set_image (
|
||||||
|
i.addressLabel_value,
|
||||||
|
i.addressLabel_size,
|
||||||
|
is_null,
|
||||||
|
v);
|
||||||
|
i.addressLabel_null = is_null;
|
||||||
|
grew = grew || (cap != i.addressLabel_value.capacity ());
|
||||||
|
}
|
||||||
|
|
||||||
|
// regionLookupKey
|
||||||
|
//
|
||||||
|
{
|
||||||
|
::std::string const& v =
|
||||||
|
o.regionLookupKey;
|
||||||
|
|
||||||
|
bool is_null (false);
|
||||||
|
std::size_t cap (i.regionLookupKey_value.capacity ());
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::set_image (
|
||||||
|
i.regionLookupKey_value,
|
||||||
|
i.regionLookupKey_size,
|
||||||
|
is_null,
|
||||||
|
v);
|
||||||
|
i.regionLookupKey_null = is_null;
|
||||||
|
grew = grew || (cap != i.regionLookupKey_value.capacity ());
|
||||||
|
}
|
||||||
|
|
||||||
|
return grew;
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
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;
|
||||||
|
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::set_value (
|
||||||
|
v,
|
||||||
|
i.id_value,
|
||||||
|
i.id_size,
|
||||||
|
i.id_null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// addressLabel
|
||||||
|
//
|
||||||
|
{
|
||||||
|
::std::string& v =
|
||||||
|
o.addressLabel;
|
||||||
|
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::set_value (
|
||||||
|
v,
|
||||||
|
i.addressLabel_value,
|
||||||
|
i.addressLabel_size,
|
||||||
|
i.addressLabel_null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// regionLookupKey
|
||||||
|
//
|
||||||
|
{
|
||||||
|
::std::string& v =
|
||||||
|
o.regionLookupKey;
|
||||||
|
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::set_value (
|
||||||
|
v,
|
||||||
|
i.regionLookupKey_value,
|
||||||
|
i.regionLookupKey_size,
|
||||||
|
i.regionLookupKey_null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
init (id_image_type& i, const id_type& id)
|
||||||
|
{
|
||||||
|
bool grew (false);
|
||||||
|
{
|
||||||
|
bool is_null (false);
|
||||||
|
std::size_t cap (i.id_value.capacity ());
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::set_image (
|
||||||
|
i.id_value,
|
||||||
|
i.id_size,
|
||||||
|
is_null,
|
||||||
|
id);
|
||||||
|
i.id_null = is_null;
|
||||||
|
grew = grew || (cap != i.id_value.capacity ());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (grew)
|
||||||
|
i.version++;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::persist_statement[] =
|
||||||
|
"INSERT INTO \"GovernmentAddress\" "
|
||||||
|
"(\"id\", "
|
||||||
|
"\"addressLabel\", "
|
||||||
|
"\"regionLookupKey\") "
|
||||||
|
"VALUES "
|
||||||
|
"(?, ?, ?)";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::find_statement[] =
|
||||||
|
"SELECT "
|
||||||
|
"\"GovernmentAddress\".\"id\", "
|
||||||
|
"\"GovernmentAddress\".\"addressLabel\", "
|
||||||
|
"\"GovernmentAddress\".\"regionLookupKey\" "
|
||||||
|
"FROM \"GovernmentAddress\" "
|
||||||
|
"WHERE \"GovernmentAddress\".\"id\"=?";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::update_statement[] =
|
||||||
|
"UPDATE \"GovernmentAddress\" "
|
||||||
|
"SET "
|
||||||
|
"\"addressLabel\"=?, "
|
||||||
|
"\"regionLookupKey\"=? "
|
||||||
|
"WHERE \"id\"=?";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::erase_statement[] =
|
||||||
|
"DELETE FROM \"GovernmentAddress\" "
|
||||||
|
"WHERE \"id\"=?";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::query_statement[] =
|
||||||
|
"SELECT "
|
||||||
|
"\"GovernmentAddress\".\"id\", "
|
||||||
|
"\"GovernmentAddress\".\"addressLabel\", "
|
||||||
|
"\"GovernmentAddress\".\"regionLookupKey\" "
|
||||||
|
"FROM \"GovernmentAddress\"";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::erase_query_statement[] =
|
||||||
|
"DELETE FROM \"GovernmentAddress\"";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::table_name[] =
|
||||||
|
"\"GovernmentAddress\"";
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
persist (database& db, const object_type& obj)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
sqlite::connection& conn (
|
||||||
|
sqlite::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
callback (db,
|
||||||
|
obj,
|
||||||
|
callback_event::pre_persist);
|
||||||
|
|
||||||
|
image_type& im (sts.image ());
|
||||||
|
binding& imb (sts.insert_image_binding ());
|
||||||
|
|
||||||
|
if (init (im, obj, statement_insert))
|
||||||
|
im.version++;
|
||||||
|
|
||||||
|
if (im.version != sts.insert_image_version () ||
|
||||||
|
imb.version == 0)
|
||||||
|
{
|
||||||
|
bind (imb.bind, im, statement_insert);
|
||||||
|
sts.insert_image_version (im.version);
|
||||||
|
imb.version++;
|
||||||
|
}
|
||||||
|
|
||||||
|
insert_statement& st (sts.persist_statement ());
|
||||||
|
if (!st.execute ())
|
||||||
|
throw object_already_persistent ();
|
||||||
|
|
||||||
|
callback (db,
|
||||||
|
obj,
|
||||||
|
callback_event::post_persist);
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
update (database& db, const object_type& obj)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
|
||||||
|
using namespace sqlite;
|
||||||
|
using sqlite::update_statement;
|
||||||
|
|
||||||
|
callback (db, obj, callback_event::pre_update);
|
||||||
|
|
||||||
|
sqlite::transaction& tr (sqlite::transaction::current ());
|
||||||
|
sqlite::connection& conn (tr.connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
const id_type& id (
|
||||||
|
obj.id);
|
||||||
|
id_image_type& idi (sts.id_image ());
|
||||||
|
init (idi, id);
|
||||||
|
|
||||||
|
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< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
erase (database& db, const id_type& id)
|
||||||
|
{
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
|
||||||
|
sqlite::connection& conn (
|
||||||
|
sqlite::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
id_image_type& i (sts.id_image ());
|
||||||
|
init (i, id);
|
||||||
|
|
||||||
|
binding& idb (sts.id_image_binding ());
|
||||||
|
if (i.version != sts.id_image_version () || idb.version == 0)
|
||||||
|
{
|
||||||
|
bind (idb.bind, i);
|
||||||
|
sts.id_image_version (i.version);
|
||||||
|
idb.version++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sts.erase_statement ().execute () != 1)
|
||||||
|
throw object_not_persistent ();
|
||||||
|
|
||||||
|
pointer_cache_traits::erase (db, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::pointer_type
|
||||||
|
access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
find (database& db, const id_type& id)
|
||||||
|
{
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
{
|
||||||
|
pointer_type p (pointer_cache_traits::find (db, id));
|
||||||
|
|
||||||
|
if (!pointer_traits::null_ptr (p))
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
sqlite::connection& conn (
|
||||||
|
sqlite::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
statements_type::auto_lock l (sts);
|
||||||
|
|
||||||
|
if (l.locked ())
|
||||||
|
{
|
||||||
|
if (!find_ (sts, &id))
|
||||||
|
return pointer_type ();
|
||||||
|
}
|
||||||
|
|
||||||
|
pointer_type p (
|
||||||
|
access::object_factory<object_type, pointer_type>::create ());
|
||||||
|
pointer_traits::guard pg (p);
|
||||||
|
|
||||||
|
pointer_cache_traits::insert_guard ig (
|
||||||
|
pointer_cache_traits::insert (db, id, p));
|
||||||
|
|
||||||
|
object_type& obj (pointer_traits::get_ref (p));
|
||||||
|
|
||||||
|
if (l.locked ())
|
||||||
|
{
|
||||||
|
select_statement& st (sts.find_statement ());
|
||||||
|
ODB_POTENTIALLY_UNUSED (st);
|
||||||
|
|
||||||
|
callback (db, obj, callback_event::pre_load);
|
||||||
|
init (obj, sts.image (), &db);
|
||||||
|
load_ (sts, obj, false);
|
||||||
|
sts.load_delayed (0);
|
||||||
|
l.unlock ();
|
||||||
|
callback (db, obj, callback_event::post_load);
|
||||||
|
pointer_cache_traits::load (ig.position ());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sts.delay_load (id, obj, ig.position ());
|
||||||
|
|
||||||
|
ig.release ();
|
||||||
|
pg.release ();
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
find (database& db, const id_type& id, object_type& obj)
|
||||||
|
{
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
sqlite::connection& conn (
|
||||||
|
sqlite::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
statements_type::auto_lock l (sts);
|
||||||
|
|
||||||
|
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< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
reload (database& db, object_type& obj)
|
||||||
|
{
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
sqlite::connection& conn (
|
||||||
|
sqlite::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
statements_type::auto_lock l (sts);
|
||||||
|
|
||||||
|
const id_type& id (
|
||||||
|
obj.id);
|
||||||
|
|
||||||
|
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< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
find_ (statements_type& sts,
|
||||||
|
const id_type* id)
|
||||||
|
{
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
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< ::models::GovernmentAddress, id_sqlite >::object_type >
|
||||||
|
access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
query (database&, const query_base_type& q)
|
||||||
|
{
|
||||||
|
using namespace sqlite;
|
||||||
|
using odb::details::shared;
|
||||||
|
using odb::details::shared_ptr;
|
||||||
|
|
||||||
|
sqlite::connection& conn (
|
||||||
|
sqlite::transaction::current ().connection ());
|
||||||
|
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
image_type& im (sts.image ());
|
||||||
|
binding& imb (sts.select_image_binding ());
|
||||||
|
|
||||||
|
if (im.version != sts.select_image_version () ||
|
||||||
|
imb.version == 0)
|
||||||
|
{
|
||||||
|
bind (imb.bind, im, statement_select);
|
||||||
|
sts.select_image_version (im.version);
|
||||||
|
imb.version++;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string text (query_statement);
|
||||||
|
if (!q.empty ())
|
||||||
|
{
|
||||||
|
text += " ";
|
||||||
|
text += q.clause ();
|
||||||
|
}
|
||||||
|
|
||||||
|
q.init_parameters ();
|
||||||
|
shared_ptr<select_statement> st (
|
||||||
|
new (shared) select_statement (
|
||||||
|
conn,
|
||||||
|
text,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
q.parameters_binding (),
|
||||||
|
imb));
|
||||||
|
|
||||||
|
st->execute ();
|
||||||
|
|
||||||
|
shared_ptr< odb::object_result_impl<object_type> > r (
|
||||||
|
new (shared) sqlite::object_result_impl<object_type> (
|
||||||
|
q, st, sts, 0));
|
||||||
|
|
||||||
|
return result<object_type> (r);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned long long access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
erase_query (database&, const query_base_type& q)
|
||||||
|
{
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
sqlite::connection& conn (
|
||||||
|
sqlite::transaction::current ().connection ());
|
||||||
|
|
||||||
|
std::string text (erase_query_statement);
|
||||||
|
if (!q.empty ())
|
||||||
|
{
|
||||||
|
text += ' ';
|
||||||
|
text += q.clause ();
|
||||||
|
}
|
||||||
|
|
||||||
|
q.init_parameters ();
|
||||||
|
delete_statement st (
|
||||||
|
conn,
|
||||||
|
text,
|
||||||
|
q.parameters_binding ());
|
||||||
|
|
||||||
|
return st.execute ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#include <odb/post.hxx>
|
||||||
@@ -0,0 +1,298 @@
|
|||||||
|
// This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
// compiler for C++.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef GOVERNMENT_ADDRESS_ODB_HXX
|
||||||
|
#define GOVERNMENT_ADDRESS_ODB_HXX
|
||||||
|
|
||||||
|
#include <odb/version.hxx>
|
||||||
|
|
||||||
|
#if (ODB_VERSION != 20400UL)
|
||||||
|
#error ODB runtime version mismatch
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <odb/pre.hxx>
|
||||||
|
|
||||||
|
#include "GovernmentAddress.h"
|
||||||
|
|
||||||
|
#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/simple-object-result.hxx>
|
||||||
|
|
||||||
|
#include <odb/details/unused.hxx>
|
||||||
|
#include <odb/details/shared-ptr.hxx>
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// GovernmentAddress
|
||||||
|
//
|
||||||
|
template <>
|
||||||
|
struct class_traits< ::models::GovernmentAddress >
|
||||||
|
{
|
||||||
|
static const class_kind kind = class_object;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits< ::models::GovernmentAddress >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef ::models::GovernmentAddress object_type;
|
||||||
|
typedef ::models::GovernmentAddress* 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);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#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
|
||||||
|
{
|
||||||
|
// GovernmentAddress
|
||||||
|
//
|
||||||
|
template <typename A>
|
||||||
|
struct query_columns< ::models::GovernmentAddress, id_sqlite, A >
|
||||||
|
{
|
||||||
|
// id
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
id_type_;
|
||||||
|
|
||||||
|
static const id_type_ id;
|
||||||
|
|
||||||
|
// addressLabel
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
addressLabel_type_;
|
||||||
|
|
||||||
|
static const addressLabel_type_ addressLabel;
|
||||||
|
|
||||||
|
// regionLookupKey
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
regionLookupKey_type_;
|
||||||
|
|
||||||
|
static const regionLookupKey_type_ regionLookupKey;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::GovernmentAddress, id_sqlite, A >::id_type_
|
||||||
|
query_columns< ::models::GovernmentAddress, id_sqlite, A >::
|
||||||
|
id (A::table_name, "\"id\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::GovernmentAddress, id_sqlite, A >::addressLabel_type_
|
||||||
|
query_columns< ::models::GovernmentAddress, id_sqlite, A >::
|
||||||
|
addressLabel (A::table_name, "\"addressLabel\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::GovernmentAddress, id_sqlite, A >::regionLookupKey_type_
|
||||||
|
query_columns< ::models::GovernmentAddress, id_sqlite, A >::
|
||||||
|
regionLookupKey (A::table_name, "\"regionLookupKey\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
struct pointer_query_columns< ::models::GovernmentAddress, id_sqlite, A >:
|
||||||
|
query_columns< ::models::GovernmentAddress, id_sqlite, A >
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >:
|
||||||
|
public access::object_traits< ::models::GovernmentAddress >
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
|
||||||
|
// addressLabel
|
||||||
|
//
|
||||||
|
details::buffer addressLabel_value;
|
||||||
|
std::size_t addressLabel_size;
|
||||||
|
bool addressLabel_null;
|
||||||
|
|
||||||
|
// regionLookupKey
|
||||||
|
//
|
||||||
|
details::buffer regionLookupKey_value;
|
||||||
|
std::size_t regionLookupKey_size;
|
||||||
|
bool regionLookupKey_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 (sqlite::bind*,
|
||||||
|
image_type&,
|
||||||
|
sqlite::statement_kind);
|
||||||
|
|
||||||
|
static void
|
||||||
|
bind (sqlite::bind*, id_image_type&);
|
||||||
|
|
||||||
|
static bool
|
||||||
|
init (image_type&,
|
||||||
|
const object_type&,
|
||||||
|
sqlite::statement_kind);
|
||||||
|
|
||||||
|
static void
|
||||||
|
init (object_type&,
|
||||||
|
const image_type&,
|
||||||
|
database*);
|
||||||
|
|
||||||
|
static void
|
||||||
|
init (id_image_type&, const id_type&);
|
||||||
|
|
||||||
|
typedef sqlite::object_statements<object_type> statements_type;
|
||||||
|
|
||||||
|
typedef sqlite::query_base query_base_type;
|
||||||
|
|
||||||
|
static const std::size_t column_count = 3UL;
|
||||||
|
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&);
|
||||||
|
|
||||||
|
public:
|
||||||
|
static bool
|
||||||
|
find_ (statements_type&,
|
||||||
|
const id_type*);
|
||||||
|
|
||||||
|
static void
|
||||||
|
load_ (statements_type&,
|
||||||
|
object_type&,
|
||||||
|
bool reload);
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits_impl< ::models::GovernmentAddress, id_common >:
|
||||||
|
public access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
// GovernmentAddress
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "GovernmentAddress-odb.ixx"
|
||||||
|
|
||||||
|
#include <odb/post.hxx>
|
||||||
|
|
||||||
|
#endif // GOVERNMENT_ADDRESS_ODB_HXX
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
// This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
// compiler for C++.
|
||||||
|
//
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// GovernmentAddress
|
||||||
|
//
|
||||||
|
|
||||||
|
inline
|
||||||
|
access::object_traits< ::models::GovernmentAddress >::id_type
|
||||||
|
access::object_traits< ::models::GovernmentAddress >::
|
||||||
|
id (const object_type& o)
|
||||||
|
{
|
||||||
|
return o.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
void access::object_traits< ::models::GovernmentAddress >::
|
||||||
|
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< ::models::GovernmentAddress >::
|
||||||
|
callback (database& db, const object_type& x, callback_event e)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
ODB_POTENTIALLY_UNUSED (x);
|
||||||
|
ODB_POTENTIALLY_UNUSED (e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// GovernmentAddress
|
||||||
|
//
|
||||||
|
|
||||||
|
inline
|
||||||
|
void access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
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< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
load_ (statements_type& sts,
|
||||||
|
object_type& obj,
|
||||||
|
bool)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (sts);
|
||||||
|
ODB_POTENTIALLY_UNUSED (obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="sqlite" version="1">
|
||||||
|
<model version="1">
|
||||||
|
<table name="GovernmentAddress" kind="object">
|
||||||
|
<column name="id" type="TEXT" null="false"/>
|
||||||
|
<column name="addressLabel" type="TEXT" null="false"/>
|
||||||
|
<column name="regionLookupKey" type="TEXT" null="false"/>
|
||||||
|
<primary-key>
|
||||||
|
<column name="id"/>
|
||||||
|
</primary-key>
|
||||||
|
</table>
|
||||||
|
</model>
|
||||||
|
</changelog>
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,505 @@
|
|||||||
|
// This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
// compiler for C++.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef TRIP_ATTEMPT_RESULT_ODB_HXX
|
||||||
|
#define TRIP_ATTEMPT_RESULT_ODB_HXX
|
||||||
|
|
||||||
|
#include <odb/version.hxx>
|
||||||
|
|
||||||
|
#if (ODB_VERSION != 20400UL)
|
||||||
|
#error ODB runtime version mismatch
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <odb/pre.hxx>
|
||||||
|
|
||||||
|
#include "TripAttemptResult.h"
|
||||||
|
|
||||||
|
#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/simple-object-result.hxx>
|
||||||
|
|
||||||
|
#include <odb/details/unused.hxx>
|
||||||
|
#include <odb/details/shared-ptr.hxx>
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// TripAttemptResult
|
||||||
|
//
|
||||||
|
template <>
|
||||||
|
struct class_traits< ::models::TripAttemptResult >
|
||||||
|
{
|
||||||
|
static const class_kind kind = class_object;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits< ::models::TripAttemptResult >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef ::models::TripAttemptResult object_type;
|
||||||
|
typedef ::models::TripAttemptResult* 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);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#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
|
||||||
|
{
|
||||||
|
// TripAttemptResult
|
||||||
|
//
|
||||||
|
template <typename A>
|
||||||
|
struct query_columns< ::models::TripAttemptResult, id_sqlite, A >
|
||||||
|
{
|
||||||
|
// id
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
id_type_;
|
||||||
|
|
||||||
|
static const id_type_ id;
|
||||||
|
|
||||||
|
// result
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
result_type_;
|
||||||
|
|
||||||
|
static const result_type_ result;
|
||||||
|
|
||||||
|
// retryReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
retryReason_type_;
|
||||||
|
|
||||||
|
static const retryReason_type_ retryReason;
|
||||||
|
|
||||||
|
// governmentSuspensionReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
governmentSuspensionReason_type_;
|
||||||
|
|
||||||
|
static const governmentSuspensionReason_type_ governmentSuspensionReason;
|
||||||
|
|
||||||
|
// governmentTerminationReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
governmentTerminationReason_type_;
|
||||||
|
|
||||||
|
static const governmentTerminationReason_type_ governmentTerminationReason;
|
||||||
|
|
||||||
|
// complianceSuspensionReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
complianceSuspensionReason_type_;
|
||||||
|
|
||||||
|
static const complianceSuspensionReason_type_ complianceSuspensionReason;
|
||||||
|
|
||||||
|
// complianceTerminationReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
complianceTerminationReason_type_;
|
||||||
|
|
||||||
|
static const complianceTerminationReason_type_ complianceTerminationReason;
|
||||||
|
|
||||||
|
// policySuspensionReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
policySuspensionReason_type_;
|
||||||
|
|
||||||
|
static const policySuspensionReason_type_ policySuspensionReason;
|
||||||
|
|
||||||
|
// policyTerminationReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
policyTerminationReason_type_;
|
||||||
|
|
||||||
|
static const policyTerminationReason_type_ policyTerminationReason;
|
||||||
|
|
||||||
|
// cancelationReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
cancelationReason_type_;
|
||||||
|
|
||||||
|
static const cancelationReason_type_ cancelationReason;
|
||||||
|
|
||||||
|
// failureReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
failureReason_type_;
|
||||||
|
|
||||||
|
static const failureReason_type_ failureReason;
|
||||||
|
|
||||||
|
// details
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
details_type_;
|
||||||
|
|
||||||
|
static const details_type_ details;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_sqlite, A >::id_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_sqlite, A >::
|
||||||
|
id (A::table_name, "\"id\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_sqlite, A >::result_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_sqlite, A >::
|
||||||
|
result (A::table_name, "\"result\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_sqlite, A >::retryReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_sqlite, A >::
|
||||||
|
retryReason (A::table_name, "\"retryReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_sqlite, A >::governmentSuspensionReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_sqlite, A >::
|
||||||
|
governmentSuspensionReason (A::table_name, "\"governmentSuspensionReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_sqlite, A >::governmentTerminationReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_sqlite, A >::
|
||||||
|
governmentTerminationReason (A::table_name, "\"governmentTerminationReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_sqlite, A >::complianceSuspensionReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_sqlite, A >::
|
||||||
|
complianceSuspensionReason (A::table_name, "\"complianceSuspensionReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_sqlite, A >::complianceTerminationReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_sqlite, A >::
|
||||||
|
complianceTerminationReason (A::table_name, "\"complianceTerminationReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_sqlite, A >::policySuspensionReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_sqlite, A >::
|
||||||
|
policySuspensionReason (A::table_name, "\"policySuspensionReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_sqlite, A >::policyTerminationReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_sqlite, A >::
|
||||||
|
policyTerminationReason (A::table_name, "\"policyTerminationReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_sqlite, A >::cancelationReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_sqlite, A >::
|
||||||
|
cancelationReason (A::table_name, "\"cancelationReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_sqlite, A >::failureReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_sqlite, A >::
|
||||||
|
failureReason (A::table_name, "\"failureReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_sqlite, A >::details_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_sqlite, A >::
|
||||||
|
details (A::table_name, "\"details\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
struct pointer_query_columns< ::models::TripAttemptResult, id_sqlite, A >:
|
||||||
|
query_columns< ::models::TripAttemptResult, id_sqlite, A >
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits_impl< ::models::TripAttemptResult, id_sqlite >:
|
||||||
|
public access::object_traits< ::models::TripAttemptResult >
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
|
||||||
|
// result
|
||||||
|
//
|
||||||
|
details::buffer result_value;
|
||||||
|
std::size_t result_size;
|
||||||
|
bool result_null;
|
||||||
|
|
||||||
|
// retryReason
|
||||||
|
//
|
||||||
|
details::buffer retryReason_value;
|
||||||
|
std::size_t retryReason_size;
|
||||||
|
bool retryReason_null;
|
||||||
|
|
||||||
|
// governmentSuspensionReason
|
||||||
|
//
|
||||||
|
details::buffer governmentSuspensionReason_value;
|
||||||
|
std::size_t governmentSuspensionReason_size;
|
||||||
|
bool governmentSuspensionReason_null;
|
||||||
|
|
||||||
|
// governmentTerminationReason
|
||||||
|
//
|
||||||
|
details::buffer governmentTerminationReason_value;
|
||||||
|
std::size_t governmentTerminationReason_size;
|
||||||
|
bool governmentTerminationReason_null;
|
||||||
|
|
||||||
|
// complianceSuspensionReason
|
||||||
|
//
|
||||||
|
details::buffer complianceSuspensionReason_value;
|
||||||
|
std::size_t complianceSuspensionReason_size;
|
||||||
|
bool complianceSuspensionReason_null;
|
||||||
|
|
||||||
|
// complianceTerminationReason
|
||||||
|
//
|
||||||
|
details::buffer complianceTerminationReason_value;
|
||||||
|
std::size_t complianceTerminationReason_size;
|
||||||
|
bool complianceTerminationReason_null;
|
||||||
|
|
||||||
|
// policySuspensionReason
|
||||||
|
//
|
||||||
|
details::buffer policySuspensionReason_value;
|
||||||
|
std::size_t policySuspensionReason_size;
|
||||||
|
bool policySuspensionReason_null;
|
||||||
|
|
||||||
|
// policyTerminationReason
|
||||||
|
//
|
||||||
|
details::buffer policyTerminationReason_value;
|
||||||
|
std::size_t policyTerminationReason_size;
|
||||||
|
bool policyTerminationReason_null;
|
||||||
|
|
||||||
|
// cancelationReason
|
||||||
|
//
|
||||||
|
details::buffer cancelationReason_value;
|
||||||
|
std::size_t cancelationReason_size;
|
||||||
|
bool cancelationReason_null;
|
||||||
|
|
||||||
|
// failureReason
|
||||||
|
//
|
||||||
|
details::buffer failureReason_value;
|
||||||
|
std::size_t failureReason_size;
|
||||||
|
bool failureReason_null;
|
||||||
|
|
||||||
|
// details
|
||||||
|
//
|
||||||
|
details::buffer details_value;
|
||||||
|
std::size_t details_size;
|
||||||
|
bool details_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 (sqlite::bind*,
|
||||||
|
image_type&,
|
||||||
|
sqlite::statement_kind);
|
||||||
|
|
||||||
|
static void
|
||||||
|
bind (sqlite::bind*, id_image_type&);
|
||||||
|
|
||||||
|
static bool
|
||||||
|
init (image_type&,
|
||||||
|
const object_type&,
|
||||||
|
sqlite::statement_kind);
|
||||||
|
|
||||||
|
static void
|
||||||
|
init (object_type&,
|
||||||
|
const image_type&,
|
||||||
|
database*);
|
||||||
|
|
||||||
|
static void
|
||||||
|
init (id_image_type&, const id_type&);
|
||||||
|
|
||||||
|
typedef sqlite::object_statements<object_type> statements_type;
|
||||||
|
|
||||||
|
typedef sqlite::query_base query_base_type;
|
||||||
|
|
||||||
|
static const std::size_t column_count = 12UL;
|
||||||
|
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&);
|
||||||
|
|
||||||
|
public:
|
||||||
|
static bool
|
||||||
|
find_ (statements_type&,
|
||||||
|
const id_type*);
|
||||||
|
|
||||||
|
static void
|
||||||
|
load_ (statements_type&,
|
||||||
|
object_type&,
|
||||||
|
bool reload);
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits_impl< ::models::TripAttemptResult, id_common >:
|
||||||
|
public access::object_traits_impl< ::models::TripAttemptResult, id_sqlite >
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
// TripAttemptResult
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "TripAttemptResult-odb.ixx"
|
||||||
|
|
||||||
|
#include <odb/post.hxx>
|
||||||
|
|
||||||
|
#endif // TRIP_ATTEMPT_RESULT_ODB_HXX
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
// This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
// compiler for C++.
|
||||||
|
//
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// TripAttemptResult
|
||||||
|
//
|
||||||
|
|
||||||
|
inline
|
||||||
|
access::object_traits< ::models::TripAttemptResult >::id_type
|
||||||
|
access::object_traits< ::models::TripAttemptResult >::
|
||||||
|
id (const object_type& o)
|
||||||
|
{
|
||||||
|
return o.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
void access::object_traits< ::models::TripAttemptResult >::
|
||||||
|
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< ::models::TripAttemptResult >::
|
||||||
|
callback (database& db, const object_type& x, callback_event e)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
ODB_POTENTIALLY_UNUSED (x);
|
||||||
|
ODB_POTENTIALLY_UNUSED (e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// TripAttemptResult
|
||||||
|
//
|
||||||
|
|
||||||
|
inline
|
||||||
|
void access::object_traits_impl< ::models::TripAttemptResult, id_sqlite >::
|
||||||
|
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< ::models::TripAttemptResult, id_sqlite >::
|
||||||
|
load_ (statements_type& sts,
|
||||||
|
object_type& obj,
|
||||||
|
bool)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (sts);
|
||||||
|
ODB_POTENTIALLY_UNUSED (obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="sqlite" version="1">
|
||||||
|
<model version="1">
|
||||||
|
<table name="TripAttemptResult" kind="object">
|
||||||
|
<column name="id" type="TEXT" null="false"/>
|
||||||
|
<column name="result" type="TEXT" null="false"/>
|
||||||
|
<column name="retryReason" type="TEXT" null="false"/>
|
||||||
|
<column name="governmentSuspensionReason" type="TEXT" null="false"/>
|
||||||
|
<column name="governmentTerminationReason" type="TEXT" null="false"/>
|
||||||
|
<column name="complianceSuspensionReason" type="TEXT" null="false"/>
|
||||||
|
<column name="complianceTerminationReason" type="TEXT" null="false"/>
|
||||||
|
<column name="policySuspensionReason" type="TEXT" null="false"/>
|
||||||
|
<column name="policyTerminationReason" type="TEXT" null="false"/>
|
||||||
|
<column name="cancelationReason" type="TEXT" null="false"/>
|
||||||
|
<column name="failureReason" type="TEXT" null="false"/>
|
||||||
|
<column name="details" type="TEXT" null="false"/>
|
||||||
|
<primary-key>
|
||||||
|
<column name="id"/>
|
||||||
|
</primary-key>
|
||||||
|
</table>
|
||||||
|
</model>
|
||||||
|
</changelog>
|
||||||
819
db/test-schema-v1.1/generated-sql-ddl/postgre/Agent-odb.cxx
Normal file
819
db/test-schema-v1.1/generated-sql-ddl/postgre/Agent-odb.cxx
Normal file
@@ -0,0 +1,819 @@
|
|||||||
|
// This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
// compiler for C++.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <odb/pre.hxx>
|
||||||
|
|
||||||
|
#include "Agent-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/container-statements.hxx>
|
||||||
|
#include <odb/pgsql/exceptions.hxx>
|
||||||
|
#include <odb/pgsql/simple-object-result.hxx>
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// Agent
|
||||||
|
//
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
persist_statement_name[] = "persist_models_Agent";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
find_statement_name[] = "find_models_Agent";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
update_statement_name[] = "update_models_Agent";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
erase_statement_name[] = "erase_models_Agent";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
query_statement_name[] = "query_models_Agent";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
erase_query_statement_name[] = "erase_query_models_Agent";
|
||||||
|
|
||||||
|
const unsigned int access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
persist_statement_types[] =
|
||||||
|
{
|
||||||
|
pgsql::text_oid,
|
||||||
|
pgsql::text_oid,
|
||||||
|
pgsql::bool_oid,
|
||||||
|
pgsql::text_oid
|
||||||
|
};
|
||||||
|
|
||||||
|
const unsigned int access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
find_statement_types[] =
|
||||||
|
{
|
||||||
|
pgsql::text_oid
|
||||||
|
};
|
||||||
|
|
||||||
|
const unsigned int access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
update_statement_types[] =
|
||||||
|
{
|
||||||
|
pgsql::text_oid,
|
||||||
|
pgsql::bool_oid,
|
||||||
|
pgsql::text_oid,
|
||||||
|
pgsql::text_oid
|
||||||
|
};
|
||||||
|
|
||||||
|
struct access::object_traits_impl< ::models::Agent, 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< ::models::Agent, id_pgsql >::id_type
|
||||||
|
access::object_traits_impl< ::models::Agent, 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< ::models::Agent, 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// role
|
||||||
|
//
|
||||||
|
if (t[1UL])
|
||||||
|
{
|
||||||
|
i.role_value.capacity (i.role_size);
|
||||||
|
grew = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// persistent
|
||||||
|
//
|
||||||
|
t[2UL] = 0;
|
||||||
|
|
||||||
|
// displayName
|
||||||
|
//
|
||||||
|
if (t[3UL])
|
||||||
|
{
|
||||||
|
i.displayName_value.capacity (i.displayName_size);
|
||||||
|
grew = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return grew;
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
bind (pgsql::bind* b,
|
||||||
|
image_type& i,
|
||||||
|
pgsql::statement_kind sk)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (sk);
|
||||||
|
|
||||||
|
using namespace pgsql;
|
||||||
|
|
||||||
|
std::size_t n (0);
|
||||||
|
|
||||||
|
// id
|
||||||
|
//
|
||||||
|
if (sk != statement_update)
|
||||||
|
{
|
||||||
|
b[n].type = pgsql::bind::text;
|
||||||
|
b[n].buffer = i.id_value.data ();
|
||||||
|
b[n].capacity = i.id_value.capacity ();
|
||||||
|
b[n].size = &i.id_size;
|
||||||
|
b[n].is_null = &i.id_null;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// role
|
||||||
|
//
|
||||||
|
b[n].type = pgsql::bind::text;
|
||||||
|
b[n].buffer = i.role_value.data ();
|
||||||
|
b[n].capacity = i.role_value.capacity ();
|
||||||
|
b[n].size = &i.role_size;
|
||||||
|
b[n].is_null = &i.role_null;
|
||||||
|
n++;
|
||||||
|
|
||||||
|
// persistent
|
||||||
|
//
|
||||||
|
b[n].type = pgsql::bind::boolean_;
|
||||||
|
b[n].buffer = &i.persistent_value;
|
||||||
|
b[n].is_null = &i.persistent_null;
|
||||||
|
n++;
|
||||||
|
|
||||||
|
// displayName
|
||||||
|
//
|
||||||
|
b[n].type = pgsql::bind::text;
|
||||||
|
b[n].buffer = i.displayName_value.data ();
|
||||||
|
b[n].capacity = i.displayName_value.capacity ();
|
||||||
|
b[n].size = &i.displayName_size;
|
||||||
|
b[n].is_null = &i.displayName_null;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
bind (pgsql::bind* b, id_image_type& i)
|
||||||
|
{
|
||||||
|
std::size_t n (0);
|
||||||
|
b[n].type = pgsql::bind::text;
|
||||||
|
b[n].buffer = i.id_value.data ();
|
||||||
|
b[n].capacity = i.id_value.capacity ();
|
||||||
|
b[n].size = &i.id_size;
|
||||||
|
b[n].is_null = &i.id_null;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool access::object_traits_impl< ::models::Agent, 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 ());
|
||||||
|
}
|
||||||
|
|
||||||
|
// role
|
||||||
|
//
|
||||||
|
{
|
||||||
|
::std::string const& v =
|
||||||
|
o.role;
|
||||||
|
|
||||||
|
bool is_null (false);
|
||||||
|
std::size_t size (0);
|
||||||
|
std::size_t cap (i.role_value.capacity ());
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::set_image (
|
||||||
|
i.role_value,
|
||||||
|
size,
|
||||||
|
is_null,
|
||||||
|
v);
|
||||||
|
i.role_null = is_null;
|
||||||
|
i.role_size = size;
|
||||||
|
grew = grew || (cap != i.role_value.capacity ());
|
||||||
|
}
|
||||||
|
|
||||||
|
// persistent
|
||||||
|
//
|
||||||
|
{
|
||||||
|
bool const& v =
|
||||||
|
o.persistent;
|
||||||
|
|
||||||
|
bool is_null (false);
|
||||||
|
pgsql::value_traits<
|
||||||
|
bool,
|
||||||
|
pgsql::id_boolean >::set_image (
|
||||||
|
i.persistent_value, is_null, v);
|
||||||
|
i.persistent_null = is_null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// displayName
|
||||||
|
//
|
||||||
|
{
|
||||||
|
::std::string const& v =
|
||||||
|
o.displayName;
|
||||||
|
|
||||||
|
bool is_null (false);
|
||||||
|
std::size_t size (0);
|
||||||
|
std::size_t cap (i.displayName_value.capacity ());
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::set_image (
|
||||||
|
i.displayName_value,
|
||||||
|
size,
|
||||||
|
is_null,
|
||||||
|
v);
|
||||||
|
i.displayName_null = is_null;
|
||||||
|
i.displayName_size = size;
|
||||||
|
grew = grew || (cap != i.displayName_value.capacity ());
|
||||||
|
}
|
||||||
|
|
||||||
|
return grew;
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::Agent, 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
// role
|
||||||
|
//
|
||||||
|
{
|
||||||
|
::std::string& v =
|
||||||
|
o.role;
|
||||||
|
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::set_value (
|
||||||
|
v,
|
||||||
|
i.role_value,
|
||||||
|
i.role_size,
|
||||||
|
i.role_null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// persistent
|
||||||
|
//
|
||||||
|
{
|
||||||
|
bool& v =
|
||||||
|
o.persistent;
|
||||||
|
|
||||||
|
pgsql::value_traits<
|
||||||
|
bool,
|
||||||
|
pgsql::id_boolean >::set_value (
|
||||||
|
v,
|
||||||
|
i.persistent_value,
|
||||||
|
i.persistent_null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// displayName
|
||||||
|
//
|
||||||
|
{
|
||||||
|
::std::string& v =
|
||||||
|
o.displayName;
|
||||||
|
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::set_value (
|
||||||
|
v,
|
||||||
|
i.displayName_value,
|
||||||
|
i.displayName_size,
|
||||||
|
i.displayName_null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::Agent, 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< ::models::Agent, id_pgsql >::persist_statement[] =
|
||||||
|
"INSERT INTO \"Agent\" "
|
||||||
|
"(\"id\", "
|
||||||
|
"\"role\", "
|
||||||
|
"\"persistent\", "
|
||||||
|
"\"displayName\") "
|
||||||
|
"VALUES "
|
||||||
|
"($1, $2, $3, $4)";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_pgsql >::find_statement[] =
|
||||||
|
"SELECT "
|
||||||
|
"\"Agent\".\"id\", "
|
||||||
|
"\"Agent\".\"role\", "
|
||||||
|
"\"Agent\".\"persistent\", "
|
||||||
|
"\"Agent\".\"displayName\" "
|
||||||
|
"FROM \"Agent\" "
|
||||||
|
"WHERE \"Agent\".\"id\"=$1";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_pgsql >::update_statement[] =
|
||||||
|
"UPDATE \"Agent\" "
|
||||||
|
"SET "
|
||||||
|
"\"role\"=$1, "
|
||||||
|
"\"persistent\"=$2, "
|
||||||
|
"\"displayName\"=$3 "
|
||||||
|
"WHERE \"id\"=$4";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_pgsql >::erase_statement[] =
|
||||||
|
"DELETE FROM \"Agent\" "
|
||||||
|
"WHERE \"id\"=$1";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_pgsql >::query_statement[] =
|
||||||
|
"SELECT "
|
||||||
|
"\"Agent\".\"id\", "
|
||||||
|
"\"Agent\".\"role\", "
|
||||||
|
"\"Agent\".\"persistent\", "
|
||||||
|
"\"Agent\".\"displayName\" "
|
||||||
|
"FROM \"Agent\"";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_pgsql >::erase_query_statement[] =
|
||||||
|
"DELETE FROM \"Agent\"";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_pgsql >::table_name[] =
|
||||||
|
"\"Agent\"";
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
persist (database& db, const object_type& obj)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
|
||||||
|
using namespace pgsql;
|
||||||
|
|
||||||
|
pgsql::connection& conn (
|
||||||
|
pgsql::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
callback (db,
|
||||||
|
obj,
|
||||||
|
callback_event::pre_persist);
|
||||||
|
|
||||||
|
image_type& im (sts.image ());
|
||||||
|
binding& imb (sts.insert_image_binding ());
|
||||||
|
|
||||||
|
if (init (im, obj, statement_insert))
|
||||||
|
im.version++;
|
||||||
|
|
||||||
|
if (im.version != sts.insert_image_version () ||
|
||||||
|
imb.version == 0)
|
||||||
|
{
|
||||||
|
bind (imb.bind, im, statement_insert);
|
||||||
|
sts.insert_image_version (im.version);
|
||||||
|
imb.version++;
|
||||||
|
}
|
||||||
|
|
||||||
|
insert_statement& st (sts.persist_statement ());
|
||||||
|
if (!st.execute ())
|
||||||
|
throw object_already_persistent ();
|
||||||
|
|
||||||
|
callback (db,
|
||||||
|
obj,
|
||||||
|
callback_event::post_persist);
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
update (database& db, const object_type& obj)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
|
||||||
|
using namespace pgsql;
|
||||||
|
using pgsql::update_statement;
|
||||||
|
|
||||||
|
callback (db, obj, callback_event::pre_update);
|
||||||
|
|
||||||
|
pgsql::transaction& tr (pgsql::transaction::current ());
|
||||||
|
pgsql::connection& conn (tr.connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
const id_type& id (
|
||||||
|
obj.id);
|
||||||
|
id_image_type& idi (sts.id_image ());
|
||||||
|
init (idi, id);
|
||||||
|
|
||||||
|
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< ::models::Agent, id_pgsql >::
|
||||||
|
erase (database& db, const id_type& id)
|
||||||
|
{
|
||||||
|
using namespace pgsql;
|
||||||
|
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
|
||||||
|
pgsql::connection& conn (
|
||||||
|
pgsql::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
id_image_type& i (sts.id_image ());
|
||||||
|
init (i, id);
|
||||||
|
|
||||||
|
binding& idb (sts.id_image_binding ());
|
||||||
|
if (i.version != sts.id_image_version () || idb.version == 0)
|
||||||
|
{
|
||||||
|
bind (idb.bind, i);
|
||||||
|
sts.id_image_version (i.version);
|
||||||
|
idb.version++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sts.erase_statement ().execute () != 1)
|
||||||
|
throw object_not_persistent ();
|
||||||
|
|
||||||
|
pointer_cache_traits::erase (db, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
access::object_traits_impl< ::models::Agent, id_pgsql >::pointer_type
|
||||||
|
access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
find (database& db, const id_type& id)
|
||||||
|
{
|
||||||
|
using namespace pgsql;
|
||||||
|
|
||||||
|
{
|
||||||
|
pointer_type p (pointer_cache_traits::find (db, id));
|
||||||
|
|
||||||
|
if (!pointer_traits::null_ptr (p))
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
pgsql::connection& conn (
|
||||||
|
pgsql::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
statements_type::auto_lock l (sts);
|
||||||
|
|
||||||
|
if (l.locked ())
|
||||||
|
{
|
||||||
|
if (!find_ (sts, &id))
|
||||||
|
return pointer_type ();
|
||||||
|
}
|
||||||
|
|
||||||
|
pointer_type p (
|
||||||
|
access::object_factory<object_type, pointer_type>::create ());
|
||||||
|
pointer_traits::guard pg (p);
|
||||||
|
|
||||||
|
pointer_cache_traits::insert_guard ig (
|
||||||
|
pointer_cache_traits::insert (db, id, p));
|
||||||
|
|
||||||
|
object_type& obj (pointer_traits::get_ref (p));
|
||||||
|
|
||||||
|
if (l.locked ())
|
||||||
|
{
|
||||||
|
select_statement& st (sts.find_statement ());
|
||||||
|
ODB_POTENTIALLY_UNUSED (st);
|
||||||
|
|
||||||
|
callback (db, obj, callback_event::pre_load);
|
||||||
|
init (obj, sts.image (), &db);
|
||||||
|
load_ (sts, obj, false);
|
||||||
|
sts.load_delayed (0);
|
||||||
|
l.unlock ();
|
||||||
|
callback (db, obj, callback_event::post_load);
|
||||||
|
pointer_cache_traits::load (ig.position ());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sts.delay_load (id, obj, ig.position ());
|
||||||
|
|
||||||
|
ig.release ();
|
||||||
|
pg.release ();
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
find (database& db, const id_type& id, object_type& obj)
|
||||||
|
{
|
||||||
|
using namespace pgsql;
|
||||||
|
|
||||||
|
pgsql::connection& conn (
|
||||||
|
pgsql::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
statements_type::auto_lock l (sts);
|
||||||
|
|
||||||
|
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< ::models::Agent, id_pgsql >::
|
||||||
|
reload (database& db, object_type& obj)
|
||||||
|
{
|
||||||
|
using namespace pgsql;
|
||||||
|
|
||||||
|
pgsql::connection& conn (
|
||||||
|
pgsql::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
statements_type::auto_lock l (sts);
|
||||||
|
|
||||||
|
const id_type& id (
|
||||||
|
obj.id);
|
||||||
|
|
||||||
|
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< ::models::Agent, 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< ::models::Agent, id_pgsql >::object_type >
|
||||||
|
access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
query (database&, const query_base_type& q)
|
||||||
|
{
|
||||||
|
using namespace pgsql;
|
||||||
|
using odb::details::shared;
|
||||||
|
using odb::details::shared_ptr;
|
||||||
|
|
||||||
|
pgsql::connection& conn (
|
||||||
|
pgsql::transaction::current ().connection ());
|
||||||
|
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
image_type& im (sts.image ());
|
||||||
|
binding& imb (sts.select_image_binding ());
|
||||||
|
|
||||||
|
if (im.version != sts.select_image_version () ||
|
||||||
|
imb.version == 0)
|
||||||
|
{
|
||||||
|
bind (imb.bind, im, statement_select);
|
||||||
|
sts.select_image_version (im.version);
|
||||||
|
imb.version++;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string text (query_statement);
|
||||||
|
if (!q.empty ())
|
||||||
|
{
|
||||||
|
text += " ";
|
||||||
|
text += q.clause ();
|
||||||
|
}
|
||||||
|
|
||||||
|
q.init_parameters ();
|
||||||
|
shared_ptr<select_statement> st (
|
||||||
|
new (shared) select_statement (
|
||||||
|
sts.connection (),
|
||||||
|
query_statement_name,
|
||||||
|
text,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
q.parameter_types (),
|
||||||
|
q.parameter_count (),
|
||||||
|
q.parameters_binding (),
|
||||||
|
imb));
|
||||||
|
|
||||||
|
st->execute ();
|
||||||
|
st->deallocate ();
|
||||||
|
|
||||||
|
shared_ptr< odb::object_result_impl<object_type> > r (
|
||||||
|
new (shared) pgsql::object_result_impl<object_type> (
|
||||||
|
q, st, sts, 0));
|
||||||
|
|
||||||
|
return result<object_type> (r);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned long long access::object_traits_impl< ::models::Agent, id_pgsql >::
|
||||||
|
erase_query (database&, const query_base_type& q)
|
||||||
|
{
|
||||||
|
using namespace pgsql;
|
||||||
|
|
||||||
|
pgsql::connection& conn (
|
||||||
|
pgsql::transaction::current ().connection ());
|
||||||
|
|
||||||
|
std::string text (erase_query_statement);
|
||||||
|
if (!q.empty ())
|
||||||
|
{
|
||||||
|
text += ' ';
|
||||||
|
text += q.clause ();
|
||||||
|
}
|
||||||
|
|
||||||
|
q.init_parameters ();
|
||||||
|
delete_statement st (
|
||||||
|
conn,
|
||||||
|
erase_query_statement_name,
|
||||||
|
text,
|
||||||
|
q.parameter_types (),
|
||||||
|
q.parameter_count (),
|
||||||
|
q.parameters_binding ());
|
||||||
|
|
||||||
|
return st.execute ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#include <odb/post.hxx>
|
||||||
331
db/test-schema-v1.1/generated-sql-ddl/postgre/Agent-odb.hxx
Normal file
331
db/test-schema-v1.1/generated-sql-ddl/postgre/Agent-odb.hxx
Normal file
@@ -0,0 +1,331 @@
|
|||||||
|
// This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
// compiler for C++.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef AGENT_ODB_HXX
|
||||||
|
#define AGENT_ODB_HXX
|
||||||
|
|
||||||
|
#include <odb/version.hxx>
|
||||||
|
|
||||||
|
#if (ODB_VERSION != 20400UL)
|
||||||
|
#error ODB runtime version mismatch
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <odb/pre.hxx>
|
||||||
|
|
||||||
|
#include "Agent.h"
|
||||||
|
|
||||||
|
#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/simple-object-result.hxx>
|
||||||
|
|
||||||
|
#include <odb/details/unused.hxx>
|
||||||
|
#include <odb/details/shared-ptr.hxx>
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// Agent
|
||||||
|
//
|
||||||
|
template <>
|
||||||
|
struct class_traits< ::models::Agent >
|
||||||
|
{
|
||||||
|
static const class_kind kind = class_object;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits< ::models::Agent >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef ::models::Agent object_type;
|
||||||
|
typedef ::models::Agent* 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);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#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
|
||||||
|
{
|
||||||
|
// Agent
|
||||||
|
//
|
||||||
|
template <typename A>
|
||||||
|
struct query_columns< ::models::Agent, 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;
|
||||||
|
|
||||||
|
// role
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
pgsql::query_column<
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::query_type,
|
||||||
|
pgsql::id_string >
|
||||||
|
role_type_;
|
||||||
|
|
||||||
|
static const role_type_ role;
|
||||||
|
|
||||||
|
// persistent
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
pgsql::query_column<
|
||||||
|
pgsql::value_traits<
|
||||||
|
bool,
|
||||||
|
pgsql::id_boolean >::query_type,
|
||||||
|
pgsql::id_boolean >
|
||||||
|
persistent_type_;
|
||||||
|
|
||||||
|
static const persistent_type_ persistent;
|
||||||
|
|
||||||
|
// displayName
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
pgsql::query_column<
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::query_type,
|
||||||
|
pgsql::id_string >
|
||||||
|
displayName_type_;
|
||||||
|
|
||||||
|
static const displayName_type_ displayName;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::Agent, id_pgsql, A >::id_type_
|
||||||
|
query_columns< ::models::Agent, id_pgsql, A >::
|
||||||
|
id (A::table_name, "\"id\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::Agent, id_pgsql, A >::role_type_
|
||||||
|
query_columns< ::models::Agent, id_pgsql, A >::
|
||||||
|
role (A::table_name, "\"role\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::Agent, id_pgsql, A >::persistent_type_
|
||||||
|
query_columns< ::models::Agent, id_pgsql, A >::
|
||||||
|
persistent (A::table_name, "\"persistent\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::Agent, id_pgsql, A >::displayName_type_
|
||||||
|
query_columns< ::models::Agent, id_pgsql, A >::
|
||||||
|
displayName (A::table_name, "\"displayName\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
struct pointer_query_columns< ::models::Agent, id_pgsql, A >:
|
||||||
|
query_columns< ::models::Agent, id_pgsql, A >
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits_impl< ::models::Agent, id_pgsql >:
|
||||||
|
public access::object_traits< ::models::Agent >
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
|
||||||
|
// role
|
||||||
|
//
|
||||||
|
details::buffer role_value;
|
||||||
|
std::size_t role_size;
|
||||||
|
bool role_null;
|
||||||
|
|
||||||
|
// persistent
|
||||||
|
//
|
||||||
|
bool persistent_value;
|
||||||
|
bool persistent_null;
|
||||||
|
|
||||||
|
// displayName
|
||||||
|
//
|
||||||
|
details::buffer displayName_value;
|
||||||
|
std::size_t displayName_size;
|
||||||
|
bool displayName_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 = 4UL;
|
||||||
|
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 const char persist_statement_name[];
|
||||||
|
static const char find_statement_name[];
|
||||||
|
static const char update_statement_name[];
|
||||||
|
static const char erase_statement_name[];
|
||||||
|
static const char query_statement_name[];
|
||||||
|
static const char erase_query_statement_name[];
|
||||||
|
|
||||||
|
static const unsigned int persist_statement_types[];
|
||||||
|
static const unsigned int find_statement_types[];
|
||||||
|
static const unsigned int update_statement_types[];
|
||||||
|
|
||||||
|
public:
|
||||||
|
static bool
|
||||||
|
find_ (statements_type&,
|
||||||
|
const id_type*);
|
||||||
|
|
||||||
|
static void
|
||||||
|
load_ (statements_type&,
|
||||||
|
object_type&,
|
||||||
|
bool reload);
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits_impl< ::models::Agent, id_common >:
|
||||||
|
public access::object_traits_impl< ::models::Agent, id_pgsql >
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
// Agent
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "Agent-odb.ixx"
|
||||||
|
|
||||||
|
#include <odb/post.hxx>
|
||||||
|
|
||||||
|
#endif // AGENT_ODB_HXX
|
||||||
61
db/test-schema-v1.1/generated-sql-ddl/postgre/Agent-odb.ixx
Normal file
61
db/test-schema-v1.1/generated-sql-ddl/postgre/Agent-odb.ixx
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
// This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
// compiler for C++.
|
||||||
|
//
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// Agent
|
||||||
|
//
|
||||||
|
|
||||||
|
inline
|
||||||
|
access::object_traits< ::models::Agent >::id_type
|
||||||
|
access::object_traits< ::models::Agent >::
|
||||||
|
id (const object_type& o)
|
||||||
|
{
|
||||||
|
return o.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
void access::object_traits< ::models::Agent >::
|
||||||
|
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< ::models::Agent >::
|
||||||
|
callback (database& db, const object_type& x, callback_event e)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
ODB_POTENTIALLY_UNUSED (x);
|
||||||
|
ODB_POTENTIALLY_UNUSED (e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// Agent
|
||||||
|
//
|
||||||
|
|
||||||
|
inline
|
||||||
|
void access::object_traits_impl< ::models::Agent, 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< ::models::Agent, id_pgsql >::
|
||||||
|
load_ (statements_type& sts,
|
||||||
|
object_type& obj,
|
||||||
|
bool)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (sts);
|
||||||
|
ODB_POTENTIALLY_UNUSED (obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
23
db/test-schema-v1.1/generated-sql-ddl/postgre/Agent.sql
Normal file
23
db/test-schema-v1.1/generated-sql-ddl/postgre/Agent.sql
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/* This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
* compiler for C++.
|
||||||
|
*/
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS "Agent" CASCADE;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS "schema_version";
|
||||||
|
|
||||||
|
CREATE TABLE "Agent" (
|
||||||
|
"id" TEXT NOT NULL PRIMARY KEY,
|
||||||
|
"role" TEXT NOT NULL,
|
||||||
|
"persistent" BOOLEAN NOT NULL,
|
||||||
|
"displayName" TEXT NOT NULL);
|
||||||
|
|
||||||
|
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 ('', 1, FALSE);
|
||||||
|
|
||||||
@@ -0,0 +1,774 @@
|
|||||||
|
// This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
// compiler for C++.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <odb/pre.hxx>
|
||||||
|
|
||||||
|
#include "GovernmentAddress-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/container-statements.hxx>
|
||||||
|
#include <odb/pgsql/exceptions.hxx>
|
||||||
|
#include <odb/pgsql/simple-object-result.hxx>
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// GovernmentAddress
|
||||||
|
//
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
persist_statement_name[] = "persist_models_GovernmentAddress";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
find_statement_name[] = "find_models_GovernmentAddress";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
update_statement_name[] = "update_models_GovernmentAddress";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
erase_statement_name[] = "erase_models_GovernmentAddress";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
query_statement_name[] = "query_models_GovernmentAddress";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
erase_query_statement_name[] = "erase_query_models_GovernmentAddress";
|
||||||
|
|
||||||
|
const unsigned int access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
persist_statement_types[] =
|
||||||
|
{
|
||||||
|
pgsql::text_oid,
|
||||||
|
pgsql::text_oid,
|
||||||
|
pgsql::text_oid
|
||||||
|
};
|
||||||
|
|
||||||
|
const unsigned int access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
find_statement_types[] =
|
||||||
|
{
|
||||||
|
pgsql::text_oid
|
||||||
|
};
|
||||||
|
|
||||||
|
const unsigned int access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
update_statement_types[] =
|
||||||
|
{
|
||||||
|
pgsql::text_oid,
|
||||||
|
pgsql::text_oid,
|
||||||
|
pgsql::text_oid
|
||||||
|
};
|
||||||
|
|
||||||
|
struct access::object_traits_impl< ::models::GovernmentAddress, 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< ::models::GovernmentAddress, id_pgsql >::id_type
|
||||||
|
access::object_traits_impl< ::models::GovernmentAddress, 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< ::models::GovernmentAddress, 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// addressLabel
|
||||||
|
//
|
||||||
|
if (t[1UL])
|
||||||
|
{
|
||||||
|
i.addressLabel_value.capacity (i.addressLabel_size);
|
||||||
|
grew = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// regionLookupKey
|
||||||
|
//
|
||||||
|
if (t[2UL])
|
||||||
|
{
|
||||||
|
i.regionLookupKey_value.capacity (i.regionLookupKey_size);
|
||||||
|
grew = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return grew;
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
bind (pgsql::bind* b,
|
||||||
|
image_type& i,
|
||||||
|
pgsql::statement_kind sk)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (sk);
|
||||||
|
|
||||||
|
using namespace pgsql;
|
||||||
|
|
||||||
|
std::size_t n (0);
|
||||||
|
|
||||||
|
// id
|
||||||
|
//
|
||||||
|
if (sk != statement_update)
|
||||||
|
{
|
||||||
|
b[n].type = pgsql::bind::text;
|
||||||
|
b[n].buffer = i.id_value.data ();
|
||||||
|
b[n].capacity = i.id_value.capacity ();
|
||||||
|
b[n].size = &i.id_size;
|
||||||
|
b[n].is_null = &i.id_null;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// addressLabel
|
||||||
|
//
|
||||||
|
b[n].type = pgsql::bind::text;
|
||||||
|
b[n].buffer = i.addressLabel_value.data ();
|
||||||
|
b[n].capacity = i.addressLabel_value.capacity ();
|
||||||
|
b[n].size = &i.addressLabel_size;
|
||||||
|
b[n].is_null = &i.addressLabel_null;
|
||||||
|
n++;
|
||||||
|
|
||||||
|
// regionLookupKey
|
||||||
|
//
|
||||||
|
b[n].type = pgsql::bind::text;
|
||||||
|
b[n].buffer = i.regionLookupKey_value.data ();
|
||||||
|
b[n].capacity = i.regionLookupKey_value.capacity ();
|
||||||
|
b[n].size = &i.regionLookupKey_size;
|
||||||
|
b[n].is_null = &i.regionLookupKey_null;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
bind (pgsql::bind* b, id_image_type& i)
|
||||||
|
{
|
||||||
|
std::size_t n (0);
|
||||||
|
b[n].type = pgsql::bind::text;
|
||||||
|
b[n].buffer = i.id_value.data ();
|
||||||
|
b[n].capacity = i.id_value.capacity ();
|
||||||
|
b[n].size = &i.id_size;
|
||||||
|
b[n].is_null = &i.id_null;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool access::object_traits_impl< ::models::GovernmentAddress, 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 ());
|
||||||
|
}
|
||||||
|
|
||||||
|
// addressLabel
|
||||||
|
//
|
||||||
|
{
|
||||||
|
::std::string const& v =
|
||||||
|
o.addressLabel;
|
||||||
|
|
||||||
|
bool is_null (false);
|
||||||
|
std::size_t size (0);
|
||||||
|
std::size_t cap (i.addressLabel_value.capacity ());
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::set_image (
|
||||||
|
i.addressLabel_value,
|
||||||
|
size,
|
||||||
|
is_null,
|
||||||
|
v);
|
||||||
|
i.addressLabel_null = is_null;
|
||||||
|
i.addressLabel_size = size;
|
||||||
|
grew = grew || (cap != i.addressLabel_value.capacity ());
|
||||||
|
}
|
||||||
|
|
||||||
|
// regionLookupKey
|
||||||
|
//
|
||||||
|
{
|
||||||
|
::std::string const& v =
|
||||||
|
o.regionLookupKey;
|
||||||
|
|
||||||
|
bool is_null (false);
|
||||||
|
std::size_t size (0);
|
||||||
|
std::size_t cap (i.regionLookupKey_value.capacity ());
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::set_image (
|
||||||
|
i.regionLookupKey_value,
|
||||||
|
size,
|
||||||
|
is_null,
|
||||||
|
v);
|
||||||
|
i.regionLookupKey_null = is_null;
|
||||||
|
i.regionLookupKey_size = size;
|
||||||
|
grew = grew || (cap != i.regionLookupKey_value.capacity ());
|
||||||
|
}
|
||||||
|
|
||||||
|
return grew;
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::GovernmentAddress, 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
// addressLabel
|
||||||
|
//
|
||||||
|
{
|
||||||
|
::std::string& v =
|
||||||
|
o.addressLabel;
|
||||||
|
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::set_value (
|
||||||
|
v,
|
||||||
|
i.addressLabel_value,
|
||||||
|
i.addressLabel_size,
|
||||||
|
i.addressLabel_null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// regionLookupKey
|
||||||
|
//
|
||||||
|
{
|
||||||
|
::std::string& v =
|
||||||
|
o.regionLookupKey;
|
||||||
|
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::set_value (
|
||||||
|
v,
|
||||||
|
i.regionLookupKey_value,
|
||||||
|
i.regionLookupKey_size,
|
||||||
|
i.regionLookupKey_null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::GovernmentAddress, 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< ::models::GovernmentAddress, id_pgsql >::persist_statement[] =
|
||||||
|
"INSERT INTO \"GovernmentAddress\" "
|
||||||
|
"(\"id\", "
|
||||||
|
"\"addressLabel\", "
|
||||||
|
"\"regionLookupKey\") "
|
||||||
|
"VALUES "
|
||||||
|
"($1, $2, $3)";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::find_statement[] =
|
||||||
|
"SELECT "
|
||||||
|
"\"GovernmentAddress\".\"id\", "
|
||||||
|
"\"GovernmentAddress\".\"addressLabel\", "
|
||||||
|
"\"GovernmentAddress\".\"regionLookupKey\" "
|
||||||
|
"FROM \"GovernmentAddress\" "
|
||||||
|
"WHERE \"GovernmentAddress\".\"id\"=$1";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::update_statement[] =
|
||||||
|
"UPDATE \"GovernmentAddress\" "
|
||||||
|
"SET "
|
||||||
|
"\"addressLabel\"=$1, "
|
||||||
|
"\"regionLookupKey\"=$2 "
|
||||||
|
"WHERE \"id\"=$3";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::erase_statement[] =
|
||||||
|
"DELETE FROM \"GovernmentAddress\" "
|
||||||
|
"WHERE \"id\"=$1";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::query_statement[] =
|
||||||
|
"SELECT "
|
||||||
|
"\"GovernmentAddress\".\"id\", "
|
||||||
|
"\"GovernmentAddress\".\"addressLabel\", "
|
||||||
|
"\"GovernmentAddress\".\"regionLookupKey\" "
|
||||||
|
"FROM \"GovernmentAddress\"";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::erase_query_statement[] =
|
||||||
|
"DELETE FROM \"GovernmentAddress\"";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::table_name[] =
|
||||||
|
"\"GovernmentAddress\"";
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
persist (database& db, const object_type& obj)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
|
||||||
|
using namespace pgsql;
|
||||||
|
|
||||||
|
pgsql::connection& conn (
|
||||||
|
pgsql::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
callback (db,
|
||||||
|
obj,
|
||||||
|
callback_event::pre_persist);
|
||||||
|
|
||||||
|
image_type& im (sts.image ());
|
||||||
|
binding& imb (sts.insert_image_binding ());
|
||||||
|
|
||||||
|
if (init (im, obj, statement_insert))
|
||||||
|
im.version++;
|
||||||
|
|
||||||
|
if (im.version != sts.insert_image_version () ||
|
||||||
|
imb.version == 0)
|
||||||
|
{
|
||||||
|
bind (imb.bind, im, statement_insert);
|
||||||
|
sts.insert_image_version (im.version);
|
||||||
|
imb.version++;
|
||||||
|
}
|
||||||
|
|
||||||
|
insert_statement& st (sts.persist_statement ());
|
||||||
|
if (!st.execute ())
|
||||||
|
throw object_already_persistent ();
|
||||||
|
|
||||||
|
callback (db,
|
||||||
|
obj,
|
||||||
|
callback_event::post_persist);
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
update (database& db, const object_type& obj)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
|
||||||
|
using namespace pgsql;
|
||||||
|
using pgsql::update_statement;
|
||||||
|
|
||||||
|
callback (db, obj, callback_event::pre_update);
|
||||||
|
|
||||||
|
pgsql::transaction& tr (pgsql::transaction::current ());
|
||||||
|
pgsql::connection& conn (tr.connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
const id_type& id (
|
||||||
|
obj.id);
|
||||||
|
id_image_type& idi (sts.id_image ());
|
||||||
|
init (idi, id);
|
||||||
|
|
||||||
|
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< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
erase (database& db, const id_type& id)
|
||||||
|
{
|
||||||
|
using namespace pgsql;
|
||||||
|
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
|
||||||
|
pgsql::connection& conn (
|
||||||
|
pgsql::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
id_image_type& i (sts.id_image ());
|
||||||
|
init (i, id);
|
||||||
|
|
||||||
|
binding& idb (sts.id_image_binding ());
|
||||||
|
if (i.version != sts.id_image_version () || idb.version == 0)
|
||||||
|
{
|
||||||
|
bind (idb.bind, i);
|
||||||
|
sts.id_image_version (i.version);
|
||||||
|
idb.version++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sts.erase_statement ().execute () != 1)
|
||||||
|
throw object_not_persistent ();
|
||||||
|
|
||||||
|
pointer_cache_traits::erase (db, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::pointer_type
|
||||||
|
access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
find (database& db, const id_type& id)
|
||||||
|
{
|
||||||
|
using namespace pgsql;
|
||||||
|
|
||||||
|
{
|
||||||
|
pointer_type p (pointer_cache_traits::find (db, id));
|
||||||
|
|
||||||
|
if (!pointer_traits::null_ptr (p))
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
pgsql::connection& conn (
|
||||||
|
pgsql::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
statements_type::auto_lock l (sts);
|
||||||
|
|
||||||
|
if (l.locked ())
|
||||||
|
{
|
||||||
|
if (!find_ (sts, &id))
|
||||||
|
return pointer_type ();
|
||||||
|
}
|
||||||
|
|
||||||
|
pointer_type p (
|
||||||
|
access::object_factory<object_type, pointer_type>::create ());
|
||||||
|
pointer_traits::guard pg (p);
|
||||||
|
|
||||||
|
pointer_cache_traits::insert_guard ig (
|
||||||
|
pointer_cache_traits::insert (db, id, p));
|
||||||
|
|
||||||
|
object_type& obj (pointer_traits::get_ref (p));
|
||||||
|
|
||||||
|
if (l.locked ())
|
||||||
|
{
|
||||||
|
select_statement& st (sts.find_statement ());
|
||||||
|
ODB_POTENTIALLY_UNUSED (st);
|
||||||
|
|
||||||
|
callback (db, obj, callback_event::pre_load);
|
||||||
|
init (obj, sts.image (), &db);
|
||||||
|
load_ (sts, obj, false);
|
||||||
|
sts.load_delayed (0);
|
||||||
|
l.unlock ();
|
||||||
|
callback (db, obj, callback_event::post_load);
|
||||||
|
pointer_cache_traits::load (ig.position ());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sts.delay_load (id, obj, ig.position ());
|
||||||
|
|
||||||
|
ig.release ();
|
||||||
|
pg.release ();
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
find (database& db, const id_type& id, object_type& obj)
|
||||||
|
{
|
||||||
|
using namespace pgsql;
|
||||||
|
|
||||||
|
pgsql::connection& conn (
|
||||||
|
pgsql::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
statements_type::auto_lock l (sts);
|
||||||
|
|
||||||
|
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< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
reload (database& db, object_type& obj)
|
||||||
|
{
|
||||||
|
using namespace pgsql;
|
||||||
|
|
||||||
|
pgsql::connection& conn (
|
||||||
|
pgsql::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
statements_type::auto_lock l (sts);
|
||||||
|
|
||||||
|
const id_type& id (
|
||||||
|
obj.id);
|
||||||
|
|
||||||
|
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< ::models::GovernmentAddress, 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< ::models::GovernmentAddress, id_pgsql >::object_type >
|
||||||
|
access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
query (database&, const query_base_type& q)
|
||||||
|
{
|
||||||
|
using namespace pgsql;
|
||||||
|
using odb::details::shared;
|
||||||
|
using odb::details::shared_ptr;
|
||||||
|
|
||||||
|
pgsql::connection& conn (
|
||||||
|
pgsql::transaction::current ().connection ());
|
||||||
|
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
image_type& im (sts.image ());
|
||||||
|
binding& imb (sts.select_image_binding ());
|
||||||
|
|
||||||
|
if (im.version != sts.select_image_version () ||
|
||||||
|
imb.version == 0)
|
||||||
|
{
|
||||||
|
bind (imb.bind, im, statement_select);
|
||||||
|
sts.select_image_version (im.version);
|
||||||
|
imb.version++;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string text (query_statement);
|
||||||
|
if (!q.empty ())
|
||||||
|
{
|
||||||
|
text += " ";
|
||||||
|
text += q.clause ();
|
||||||
|
}
|
||||||
|
|
||||||
|
q.init_parameters ();
|
||||||
|
shared_ptr<select_statement> st (
|
||||||
|
new (shared) select_statement (
|
||||||
|
sts.connection (),
|
||||||
|
query_statement_name,
|
||||||
|
text,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
q.parameter_types (),
|
||||||
|
q.parameter_count (),
|
||||||
|
q.parameters_binding (),
|
||||||
|
imb));
|
||||||
|
|
||||||
|
st->execute ();
|
||||||
|
st->deallocate ();
|
||||||
|
|
||||||
|
shared_ptr< odb::object_result_impl<object_type> > r (
|
||||||
|
new (shared) pgsql::object_result_impl<object_type> (
|
||||||
|
q, st, sts, 0));
|
||||||
|
|
||||||
|
return result<object_type> (r);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned long long access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
erase_query (database&, const query_base_type& q)
|
||||||
|
{
|
||||||
|
using namespace pgsql;
|
||||||
|
|
||||||
|
pgsql::connection& conn (
|
||||||
|
pgsql::transaction::current ().connection ());
|
||||||
|
|
||||||
|
std::string text (erase_query_statement);
|
||||||
|
if (!q.empty ())
|
||||||
|
{
|
||||||
|
text += ' ';
|
||||||
|
text += q.clause ();
|
||||||
|
}
|
||||||
|
|
||||||
|
q.init_parameters ();
|
||||||
|
delete_statement st (
|
||||||
|
conn,
|
||||||
|
erase_query_statement_name,
|
||||||
|
text,
|
||||||
|
q.parameter_types (),
|
||||||
|
q.parameter_count (),
|
||||||
|
q.parameters_binding ());
|
||||||
|
|
||||||
|
return st.execute ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#include <odb/post.hxx>
|
||||||
@@ -0,0 +1,309 @@
|
|||||||
|
// This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
// compiler for C++.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef GOVERNMENT_ADDRESS_ODB_HXX
|
||||||
|
#define GOVERNMENT_ADDRESS_ODB_HXX
|
||||||
|
|
||||||
|
#include <odb/version.hxx>
|
||||||
|
|
||||||
|
#if (ODB_VERSION != 20400UL)
|
||||||
|
#error ODB runtime version mismatch
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <odb/pre.hxx>
|
||||||
|
|
||||||
|
#include "GovernmentAddress.h"
|
||||||
|
|
||||||
|
#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/simple-object-result.hxx>
|
||||||
|
|
||||||
|
#include <odb/details/unused.hxx>
|
||||||
|
#include <odb/details/shared-ptr.hxx>
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// GovernmentAddress
|
||||||
|
//
|
||||||
|
template <>
|
||||||
|
struct class_traits< ::models::GovernmentAddress >
|
||||||
|
{
|
||||||
|
static const class_kind kind = class_object;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits< ::models::GovernmentAddress >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef ::models::GovernmentAddress object_type;
|
||||||
|
typedef ::models::GovernmentAddress* 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);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#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
|
||||||
|
{
|
||||||
|
// GovernmentAddress
|
||||||
|
//
|
||||||
|
template <typename A>
|
||||||
|
struct query_columns< ::models::GovernmentAddress, 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;
|
||||||
|
|
||||||
|
// addressLabel
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
pgsql::query_column<
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::query_type,
|
||||||
|
pgsql::id_string >
|
||||||
|
addressLabel_type_;
|
||||||
|
|
||||||
|
static const addressLabel_type_ addressLabel;
|
||||||
|
|
||||||
|
// regionLookupKey
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
pgsql::query_column<
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::query_type,
|
||||||
|
pgsql::id_string >
|
||||||
|
regionLookupKey_type_;
|
||||||
|
|
||||||
|
static const regionLookupKey_type_ regionLookupKey;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::GovernmentAddress, id_pgsql, A >::id_type_
|
||||||
|
query_columns< ::models::GovernmentAddress, id_pgsql, A >::
|
||||||
|
id (A::table_name, "\"id\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::GovernmentAddress, id_pgsql, A >::addressLabel_type_
|
||||||
|
query_columns< ::models::GovernmentAddress, id_pgsql, A >::
|
||||||
|
addressLabel (A::table_name, "\"addressLabel\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::GovernmentAddress, id_pgsql, A >::regionLookupKey_type_
|
||||||
|
query_columns< ::models::GovernmentAddress, id_pgsql, A >::
|
||||||
|
regionLookupKey (A::table_name, "\"regionLookupKey\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
struct pointer_query_columns< ::models::GovernmentAddress, id_pgsql, A >:
|
||||||
|
query_columns< ::models::GovernmentAddress, id_pgsql, A >
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >:
|
||||||
|
public access::object_traits< ::models::GovernmentAddress >
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
|
||||||
|
// addressLabel
|
||||||
|
//
|
||||||
|
details::buffer addressLabel_value;
|
||||||
|
std::size_t addressLabel_size;
|
||||||
|
bool addressLabel_null;
|
||||||
|
|
||||||
|
// regionLookupKey
|
||||||
|
//
|
||||||
|
details::buffer regionLookupKey_value;
|
||||||
|
std::size_t regionLookupKey_size;
|
||||||
|
bool regionLookupKey_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 = 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 const char persist_statement_name[];
|
||||||
|
static const char find_statement_name[];
|
||||||
|
static const char update_statement_name[];
|
||||||
|
static const char erase_statement_name[];
|
||||||
|
static const char query_statement_name[];
|
||||||
|
static const char erase_query_statement_name[];
|
||||||
|
|
||||||
|
static const unsigned int persist_statement_types[];
|
||||||
|
static const unsigned int find_statement_types[];
|
||||||
|
static const unsigned int update_statement_types[];
|
||||||
|
|
||||||
|
public:
|
||||||
|
static bool
|
||||||
|
find_ (statements_type&,
|
||||||
|
const id_type*);
|
||||||
|
|
||||||
|
static void
|
||||||
|
load_ (statements_type&,
|
||||||
|
object_type&,
|
||||||
|
bool reload);
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits_impl< ::models::GovernmentAddress, id_common >:
|
||||||
|
public access::object_traits_impl< ::models::GovernmentAddress, id_pgsql >
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
// GovernmentAddress
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "GovernmentAddress-odb.ixx"
|
||||||
|
|
||||||
|
#include <odb/post.hxx>
|
||||||
|
|
||||||
|
#endif // GOVERNMENT_ADDRESS_ODB_HXX
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
// This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
// compiler for C++.
|
||||||
|
//
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// GovernmentAddress
|
||||||
|
//
|
||||||
|
|
||||||
|
inline
|
||||||
|
access::object_traits< ::models::GovernmentAddress >::id_type
|
||||||
|
access::object_traits< ::models::GovernmentAddress >::
|
||||||
|
id (const object_type& o)
|
||||||
|
{
|
||||||
|
return o.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
void access::object_traits< ::models::GovernmentAddress >::
|
||||||
|
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< ::models::GovernmentAddress >::
|
||||||
|
callback (database& db, const object_type& x, callback_event e)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
ODB_POTENTIALLY_UNUSED (x);
|
||||||
|
ODB_POTENTIALLY_UNUSED (e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// GovernmentAddress
|
||||||
|
//
|
||||||
|
|
||||||
|
inline
|
||||||
|
void access::object_traits_impl< ::models::GovernmentAddress, 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< ::models::GovernmentAddress, id_pgsql >::
|
||||||
|
load_ (statements_type& sts,
|
||||||
|
object_type& obj,
|
||||||
|
bool)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (sts);
|
||||||
|
ODB_POTENTIALLY_UNUSED (obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/* This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
* compiler for C++.
|
||||||
|
*/
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS "GovernmentAddress" CASCADE;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS "schema_version";
|
||||||
|
|
||||||
|
CREATE TABLE "GovernmentAddress" (
|
||||||
|
"id" TEXT NOT NULL PRIMARY KEY,
|
||||||
|
"addressLabel" TEXT NOT NULL,
|
||||||
|
"regionLookupKey" TEXT NOT NULL);
|
||||||
|
|
||||||
|
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 ('', 1, FALSE);
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,516 @@
|
|||||||
|
// This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
// compiler for C++.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef TRIP_ATTEMPT_RESULT_ODB_HXX
|
||||||
|
#define TRIP_ATTEMPT_RESULT_ODB_HXX
|
||||||
|
|
||||||
|
#include <odb/version.hxx>
|
||||||
|
|
||||||
|
#if (ODB_VERSION != 20400UL)
|
||||||
|
#error ODB runtime version mismatch
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <odb/pre.hxx>
|
||||||
|
|
||||||
|
#include "TripAttemptResult.h"
|
||||||
|
|
||||||
|
#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/simple-object-result.hxx>
|
||||||
|
|
||||||
|
#include <odb/details/unused.hxx>
|
||||||
|
#include <odb/details/shared-ptr.hxx>
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// TripAttemptResult
|
||||||
|
//
|
||||||
|
template <>
|
||||||
|
struct class_traits< ::models::TripAttemptResult >
|
||||||
|
{
|
||||||
|
static const class_kind kind = class_object;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits< ::models::TripAttemptResult >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef ::models::TripAttemptResult object_type;
|
||||||
|
typedef ::models::TripAttemptResult* 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);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#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
|
||||||
|
{
|
||||||
|
// TripAttemptResult
|
||||||
|
//
|
||||||
|
template <typename A>
|
||||||
|
struct query_columns< ::models::TripAttemptResult, 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;
|
||||||
|
|
||||||
|
// result
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
pgsql::query_column<
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::query_type,
|
||||||
|
pgsql::id_string >
|
||||||
|
result_type_;
|
||||||
|
|
||||||
|
static const result_type_ result;
|
||||||
|
|
||||||
|
// retryReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
pgsql::query_column<
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::query_type,
|
||||||
|
pgsql::id_string >
|
||||||
|
retryReason_type_;
|
||||||
|
|
||||||
|
static const retryReason_type_ retryReason;
|
||||||
|
|
||||||
|
// governmentSuspensionReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
pgsql::query_column<
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::query_type,
|
||||||
|
pgsql::id_string >
|
||||||
|
governmentSuspensionReason_type_;
|
||||||
|
|
||||||
|
static const governmentSuspensionReason_type_ governmentSuspensionReason;
|
||||||
|
|
||||||
|
// governmentTerminationReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
pgsql::query_column<
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::query_type,
|
||||||
|
pgsql::id_string >
|
||||||
|
governmentTerminationReason_type_;
|
||||||
|
|
||||||
|
static const governmentTerminationReason_type_ governmentTerminationReason;
|
||||||
|
|
||||||
|
// complianceSuspensionReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
pgsql::query_column<
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::query_type,
|
||||||
|
pgsql::id_string >
|
||||||
|
complianceSuspensionReason_type_;
|
||||||
|
|
||||||
|
static const complianceSuspensionReason_type_ complianceSuspensionReason;
|
||||||
|
|
||||||
|
// complianceTerminationReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
pgsql::query_column<
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::query_type,
|
||||||
|
pgsql::id_string >
|
||||||
|
complianceTerminationReason_type_;
|
||||||
|
|
||||||
|
static const complianceTerminationReason_type_ complianceTerminationReason;
|
||||||
|
|
||||||
|
// policySuspensionReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
pgsql::query_column<
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::query_type,
|
||||||
|
pgsql::id_string >
|
||||||
|
policySuspensionReason_type_;
|
||||||
|
|
||||||
|
static const policySuspensionReason_type_ policySuspensionReason;
|
||||||
|
|
||||||
|
// policyTerminationReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
pgsql::query_column<
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::query_type,
|
||||||
|
pgsql::id_string >
|
||||||
|
policyTerminationReason_type_;
|
||||||
|
|
||||||
|
static const policyTerminationReason_type_ policyTerminationReason;
|
||||||
|
|
||||||
|
// cancelationReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
pgsql::query_column<
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::query_type,
|
||||||
|
pgsql::id_string >
|
||||||
|
cancelationReason_type_;
|
||||||
|
|
||||||
|
static const cancelationReason_type_ cancelationReason;
|
||||||
|
|
||||||
|
// failureReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
pgsql::query_column<
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::query_type,
|
||||||
|
pgsql::id_string >
|
||||||
|
failureReason_type_;
|
||||||
|
|
||||||
|
static const failureReason_type_ failureReason;
|
||||||
|
|
||||||
|
// details
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
pgsql::query_column<
|
||||||
|
pgsql::value_traits<
|
||||||
|
::std::string,
|
||||||
|
pgsql::id_string >::query_type,
|
||||||
|
pgsql::id_string >
|
||||||
|
details_type_;
|
||||||
|
|
||||||
|
static const details_type_ details;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_pgsql, A >::id_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_pgsql, A >::
|
||||||
|
id (A::table_name, "\"id\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_pgsql, A >::result_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_pgsql, A >::
|
||||||
|
result (A::table_name, "\"result\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_pgsql, A >::retryReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_pgsql, A >::
|
||||||
|
retryReason (A::table_name, "\"retryReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_pgsql, A >::governmentSuspensionReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_pgsql, A >::
|
||||||
|
governmentSuspensionReason (A::table_name, "\"governmentSuspensionReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_pgsql, A >::governmentTerminationReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_pgsql, A >::
|
||||||
|
governmentTerminationReason (A::table_name, "\"governmentTerminationReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_pgsql, A >::complianceSuspensionReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_pgsql, A >::
|
||||||
|
complianceSuspensionReason (A::table_name, "\"complianceSuspensionReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_pgsql, A >::complianceTerminationReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_pgsql, A >::
|
||||||
|
complianceTerminationReason (A::table_name, "\"complianceTerminationReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_pgsql, A >::policySuspensionReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_pgsql, A >::
|
||||||
|
policySuspensionReason (A::table_name, "\"policySuspensionReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_pgsql, A >::policyTerminationReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_pgsql, A >::
|
||||||
|
policyTerminationReason (A::table_name, "\"policyTerminationReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_pgsql, A >::cancelationReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_pgsql, A >::
|
||||||
|
cancelationReason (A::table_name, "\"cancelationReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_pgsql, A >::failureReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_pgsql, A >::
|
||||||
|
failureReason (A::table_name, "\"failureReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_pgsql, A >::details_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_pgsql, A >::
|
||||||
|
details (A::table_name, "\"details\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
struct pointer_query_columns< ::models::TripAttemptResult, id_pgsql, A >:
|
||||||
|
query_columns< ::models::TripAttemptResult, id_pgsql, A >
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits_impl< ::models::TripAttemptResult, id_pgsql >:
|
||||||
|
public access::object_traits< ::models::TripAttemptResult >
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
|
||||||
|
// result
|
||||||
|
//
|
||||||
|
details::buffer result_value;
|
||||||
|
std::size_t result_size;
|
||||||
|
bool result_null;
|
||||||
|
|
||||||
|
// retryReason
|
||||||
|
//
|
||||||
|
details::buffer retryReason_value;
|
||||||
|
std::size_t retryReason_size;
|
||||||
|
bool retryReason_null;
|
||||||
|
|
||||||
|
// governmentSuspensionReason
|
||||||
|
//
|
||||||
|
details::buffer governmentSuspensionReason_value;
|
||||||
|
std::size_t governmentSuspensionReason_size;
|
||||||
|
bool governmentSuspensionReason_null;
|
||||||
|
|
||||||
|
// governmentTerminationReason
|
||||||
|
//
|
||||||
|
details::buffer governmentTerminationReason_value;
|
||||||
|
std::size_t governmentTerminationReason_size;
|
||||||
|
bool governmentTerminationReason_null;
|
||||||
|
|
||||||
|
// complianceSuspensionReason
|
||||||
|
//
|
||||||
|
details::buffer complianceSuspensionReason_value;
|
||||||
|
std::size_t complianceSuspensionReason_size;
|
||||||
|
bool complianceSuspensionReason_null;
|
||||||
|
|
||||||
|
// complianceTerminationReason
|
||||||
|
//
|
||||||
|
details::buffer complianceTerminationReason_value;
|
||||||
|
std::size_t complianceTerminationReason_size;
|
||||||
|
bool complianceTerminationReason_null;
|
||||||
|
|
||||||
|
// policySuspensionReason
|
||||||
|
//
|
||||||
|
details::buffer policySuspensionReason_value;
|
||||||
|
std::size_t policySuspensionReason_size;
|
||||||
|
bool policySuspensionReason_null;
|
||||||
|
|
||||||
|
// policyTerminationReason
|
||||||
|
//
|
||||||
|
details::buffer policyTerminationReason_value;
|
||||||
|
std::size_t policyTerminationReason_size;
|
||||||
|
bool policyTerminationReason_null;
|
||||||
|
|
||||||
|
// cancelationReason
|
||||||
|
//
|
||||||
|
details::buffer cancelationReason_value;
|
||||||
|
std::size_t cancelationReason_size;
|
||||||
|
bool cancelationReason_null;
|
||||||
|
|
||||||
|
// failureReason
|
||||||
|
//
|
||||||
|
details::buffer failureReason_value;
|
||||||
|
std::size_t failureReason_size;
|
||||||
|
bool failureReason_null;
|
||||||
|
|
||||||
|
// details
|
||||||
|
//
|
||||||
|
details::buffer details_value;
|
||||||
|
std::size_t details_size;
|
||||||
|
bool details_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 = 12UL;
|
||||||
|
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 const char persist_statement_name[];
|
||||||
|
static const char find_statement_name[];
|
||||||
|
static const char update_statement_name[];
|
||||||
|
static const char erase_statement_name[];
|
||||||
|
static const char query_statement_name[];
|
||||||
|
static const char erase_query_statement_name[];
|
||||||
|
|
||||||
|
static const unsigned int persist_statement_types[];
|
||||||
|
static const unsigned int find_statement_types[];
|
||||||
|
static const unsigned int update_statement_types[];
|
||||||
|
|
||||||
|
public:
|
||||||
|
static bool
|
||||||
|
find_ (statements_type&,
|
||||||
|
const id_type*);
|
||||||
|
|
||||||
|
static void
|
||||||
|
load_ (statements_type&,
|
||||||
|
object_type&,
|
||||||
|
bool reload);
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits_impl< ::models::TripAttemptResult, id_common >:
|
||||||
|
public access::object_traits_impl< ::models::TripAttemptResult, id_pgsql >
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
// TripAttemptResult
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "TripAttemptResult-odb.ixx"
|
||||||
|
|
||||||
|
#include <odb/post.hxx>
|
||||||
|
|
||||||
|
#endif // TRIP_ATTEMPT_RESULT_ODB_HXX
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
// This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
// compiler for C++.
|
||||||
|
//
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// TripAttemptResult
|
||||||
|
//
|
||||||
|
|
||||||
|
inline
|
||||||
|
access::object_traits< ::models::TripAttemptResult >::id_type
|
||||||
|
access::object_traits< ::models::TripAttemptResult >::
|
||||||
|
id (const object_type& o)
|
||||||
|
{
|
||||||
|
return o.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
void access::object_traits< ::models::TripAttemptResult >::
|
||||||
|
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< ::models::TripAttemptResult >::
|
||||||
|
callback (database& db, const object_type& x, callback_event e)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
ODB_POTENTIALLY_UNUSED (x);
|
||||||
|
ODB_POTENTIALLY_UNUSED (e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// TripAttemptResult
|
||||||
|
//
|
||||||
|
|
||||||
|
inline
|
||||||
|
void access::object_traits_impl< ::models::TripAttemptResult, 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< ::models::TripAttemptResult, id_pgsql >::
|
||||||
|
load_ (statements_type& sts,
|
||||||
|
object_type& obj,
|
||||||
|
bool)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (sts);
|
||||||
|
ODB_POTENTIALLY_UNUSED (obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/* This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
* compiler for C++.
|
||||||
|
*/
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS "TripAttemptResult" CASCADE;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS "schema_version";
|
||||||
|
|
||||||
|
CREATE TABLE "TripAttemptResult" (
|
||||||
|
"id" TEXT NOT NULL PRIMARY KEY,
|
||||||
|
"result" TEXT NOT NULL,
|
||||||
|
"retryReason" TEXT NOT NULL,
|
||||||
|
"governmentSuspensionReason" TEXT NOT NULL,
|
||||||
|
"governmentTerminationReason" TEXT NOT NULL,
|
||||||
|
"complianceSuspensionReason" TEXT NOT NULL,
|
||||||
|
"complianceTerminationReason" TEXT NOT NULL,
|
||||||
|
"policySuspensionReason" TEXT NOT NULL,
|
||||||
|
"policyTerminationReason" TEXT NOT NULL,
|
||||||
|
"cancelationReason" TEXT NOT NULL,
|
||||||
|
"failureReason" TEXT NOT NULL,
|
||||||
|
"details" TEXT NOT NULL);
|
||||||
|
|
||||||
|
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 ('', 1, FALSE);
|
||||||
|
|
||||||
770
db/test-schema-v1.1/generated-sql-ddl/sqlite/Agent-odb.cxx
Normal file
770
db/test-schema-v1.1/generated-sql-ddl/sqlite/Agent-odb.cxx
Normal file
@@ -0,0 +1,770 @@
|
|||||||
|
// This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
// compiler for C++.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <odb/pre.hxx>
|
||||||
|
|
||||||
|
#include "Agent-odb.hxx"
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
#include <cstring> // std::memcpy
|
||||||
|
|
||||||
|
|
||||||
|
#include <odb/sqlite/traits.hxx>
|
||||||
|
#include <odb/sqlite/database.hxx>
|
||||||
|
#include <odb/sqlite/transaction.hxx>
|
||||||
|
#include <odb/sqlite/connection.hxx>
|
||||||
|
#include <odb/sqlite/statement.hxx>
|
||||||
|
#include <odb/sqlite/statement-cache.hxx>
|
||||||
|
#include <odb/sqlite/simple-object-statements.hxx>
|
||||||
|
#include <odb/sqlite/container-statements.hxx>
|
||||||
|
#include <odb/sqlite/exceptions.hxx>
|
||||||
|
#include <odb/sqlite/simple-object-result.hxx>
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// Agent
|
||||||
|
//
|
||||||
|
|
||||||
|
struct access::object_traits_impl< ::models::Agent, id_sqlite >::extra_statement_cache_type
|
||||||
|
{
|
||||||
|
extra_statement_cache_type (
|
||||||
|
sqlite::connection&,
|
||||||
|
image_type&,
|
||||||
|
id_image_type&,
|
||||||
|
sqlite::binding&,
|
||||||
|
sqlite::binding&)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
access::object_traits_impl< ::models::Agent, id_sqlite >::id_type
|
||||||
|
access::object_traits_impl< ::models::Agent, id_sqlite >::
|
||||||
|
id (const image_type& i)
|
||||||
|
{
|
||||||
|
sqlite::database* db (0);
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
|
||||||
|
id_type id;
|
||||||
|
{
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::set_value (
|
||||||
|
id,
|
||||||
|
i.id_value,
|
||||||
|
i.id_size,
|
||||||
|
i.id_null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool access::object_traits_impl< ::models::Agent, id_sqlite >::
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// role
|
||||||
|
//
|
||||||
|
if (t[1UL])
|
||||||
|
{
|
||||||
|
i.role_value.capacity (i.role_size);
|
||||||
|
grew = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// persistent
|
||||||
|
//
|
||||||
|
t[2UL] = false;
|
||||||
|
|
||||||
|
// displayName
|
||||||
|
//
|
||||||
|
if (t[3UL])
|
||||||
|
{
|
||||||
|
i.displayName_value.capacity (i.displayName_size);
|
||||||
|
grew = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return grew;
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::Agent, id_sqlite >::
|
||||||
|
bind (sqlite::bind* b,
|
||||||
|
image_type& i,
|
||||||
|
sqlite::statement_kind sk)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (sk);
|
||||||
|
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
std::size_t n (0);
|
||||||
|
|
||||||
|
// id
|
||||||
|
//
|
||||||
|
if (sk != statement_update)
|
||||||
|
{
|
||||||
|
b[n].type = sqlite::image_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text>::bind_value;
|
||||||
|
b[n].buffer = i.id_value.data ();
|
||||||
|
b[n].size = &i.id_size;
|
||||||
|
b[n].capacity = i.id_value.capacity ();
|
||||||
|
b[n].is_null = &i.id_null;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// role
|
||||||
|
//
|
||||||
|
b[n].type = sqlite::image_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text>::bind_value;
|
||||||
|
b[n].buffer = i.role_value.data ();
|
||||||
|
b[n].size = &i.role_size;
|
||||||
|
b[n].capacity = i.role_value.capacity ();
|
||||||
|
b[n].is_null = &i.role_null;
|
||||||
|
n++;
|
||||||
|
|
||||||
|
// persistent
|
||||||
|
//
|
||||||
|
b[n].type = sqlite::bind::integer;
|
||||||
|
b[n].buffer = &i.persistent_value;
|
||||||
|
b[n].is_null = &i.persistent_null;
|
||||||
|
n++;
|
||||||
|
|
||||||
|
// displayName
|
||||||
|
//
|
||||||
|
b[n].type = sqlite::image_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text>::bind_value;
|
||||||
|
b[n].buffer = i.displayName_value.data ();
|
||||||
|
b[n].size = &i.displayName_size;
|
||||||
|
b[n].capacity = i.displayName_value.capacity ();
|
||||||
|
b[n].is_null = &i.displayName_null;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::Agent, id_sqlite >::
|
||||||
|
bind (sqlite::bind* b, id_image_type& i)
|
||||||
|
{
|
||||||
|
std::size_t n (0);
|
||||||
|
b[n].type = sqlite::image_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text>::bind_value;
|
||||||
|
b[n].buffer = i.id_value.data ();
|
||||||
|
b[n].size = &i.id_size;
|
||||||
|
b[n].capacity = i.id_value.capacity ();
|
||||||
|
b[n].is_null = &i.id_null;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool access::object_traits_impl< ::models::Agent, id_sqlite >::
|
||||||
|
init (image_type& i,
|
||||||
|
const object_type& o,
|
||||||
|
sqlite::statement_kind sk)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (i);
|
||||||
|
ODB_POTENTIALLY_UNUSED (o);
|
||||||
|
ODB_POTENTIALLY_UNUSED (sk);
|
||||||
|
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
bool grew (false);
|
||||||
|
|
||||||
|
// id
|
||||||
|
//
|
||||||
|
if (sk == statement_insert)
|
||||||
|
{
|
||||||
|
::std::string const& v =
|
||||||
|
o.id;
|
||||||
|
|
||||||
|
bool is_null (false);
|
||||||
|
std::size_t cap (i.id_value.capacity ());
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::set_image (
|
||||||
|
i.id_value,
|
||||||
|
i.id_size,
|
||||||
|
is_null,
|
||||||
|
v);
|
||||||
|
i.id_null = is_null;
|
||||||
|
grew = grew || (cap != i.id_value.capacity ());
|
||||||
|
}
|
||||||
|
|
||||||
|
// role
|
||||||
|
//
|
||||||
|
{
|
||||||
|
::std::string const& v =
|
||||||
|
o.role;
|
||||||
|
|
||||||
|
bool is_null (false);
|
||||||
|
std::size_t cap (i.role_value.capacity ());
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::set_image (
|
||||||
|
i.role_value,
|
||||||
|
i.role_size,
|
||||||
|
is_null,
|
||||||
|
v);
|
||||||
|
i.role_null = is_null;
|
||||||
|
grew = grew || (cap != i.role_value.capacity ());
|
||||||
|
}
|
||||||
|
|
||||||
|
// persistent
|
||||||
|
//
|
||||||
|
{
|
||||||
|
bool const& v =
|
||||||
|
o.persistent;
|
||||||
|
|
||||||
|
bool is_null (false);
|
||||||
|
sqlite::value_traits<
|
||||||
|
bool,
|
||||||
|
sqlite::id_integer >::set_image (
|
||||||
|
i.persistent_value,
|
||||||
|
is_null,
|
||||||
|
v);
|
||||||
|
i.persistent_null = is_null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// displayName
|
||||||
|
//
|
||||||
|
{
|
||||||
|
::std::string const& v =
|
||||||
|
o.displayName;
|
||||||
|
|
||||||
|
bool is_null (false);
|
||||||
|
std::size_t cap (i.displayName_value.capacity ());
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::set_image (
|
||||||
|
i.displayName_value,
|
||||||
|
i.displayName_size,
|
||||||
|
is_null,
|
||||||
|
v);
|
||||||
|
i.displayName_null = is_null;
|
||||||
|
grew = grew || (cap != i.displayName_value.capacity ());
|
||||||
|
}
|
||||||
|
|
||||||
|
return grew;
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::Agent, id_sqlite >::
|
||||||
|
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;
|
||||||
|
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::set_value (
|
||||||
|
v,
|
||||||
|
i.id_value,
|
||||||
|
i.id_size,
|
||||||
|
i.id_null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// role
|
||||||
|
//
|
||||||
|
{
|
||||||
|
::std::string& v =
|
||||||
|
o.role;
|
||||||
|
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::set_value (
|
||||||
|
v,
|
||||||
|
i.role_value,
|
||||||
|
i.role_size,
|
||||||
|
i.role_null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// persistent
|
||||||
|
//
|
||||||
|
{
|
||||||
|
bool& v =
|
||||||
|
o.persistent;
|
||||||
|
|
||||||
|
sqlite::value_traits<
|
||||||
|
bool,
|
||||||
|
sqlite::id_integer >::set_value (
|
||||||
|
v,
|
||||||
|
i.persistent_value,
|
||||||
|
i.persistent_null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// displayName
|
||||||
|
//
|
||||||
|
{
|
||||||
|
::std::string& v =
|
||||||
|
o.displayName;
|
||||||
|
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::set_value (
|
||||||
|
v,
|
||||||
|
i.displayName_value,
|
||||||
|
i.displayName_size,
|
||||||
|
i.displayName_null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::Agent, id_sqlite >::
|
||||||
|
init (id_image_type& i, const id_type& id)
|
||||||
|
{
|
||||||
|
bool grew (false);
|
||||||
|
{
|
||||||
|
bool is_null (false);
|
||||||
|
std::size_t cap (i.id_value.capacity ());
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::set_image (
|
||||||
|
i.id_value,
|
||||||
|
i.id_size,
|
||||||
|
is_null,
|
||||||
|
id);
|
||||||
|
i.id_null = is_null;
|
||||||
|
grew = grew || (cap != i.id_value.capacity ());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (grew)
|
||||||
|
i.version++;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_sqlite >::persist_statement[] =
|
||||||
|
"INSERT INTO \"Agent\" "
|
||||||
|
"(\"id\", "
|
||||||
|
"\"role\", "
|
||||||
|
"\"persistent\", "
|
||||||
|
"\"displayName\") "
|
||||||
|
"VALUES "
|
||||||
|
"(?, ?, ?, ?)";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_sqlite >::find_statement[] =
|
||||||
|
"SELECT "
|
||||||
|
"\"Agent\".\"id\", "
|
||||||
|
"\"Agent\".\"role\", "
|
||||||
|
"\"Agent\".\"persistent\", "
|
||||||
|
"\"Agent\".\"displayName\" "
|
||||||
|
"FROM \"Agent\" "
|
||||||
|
"WHERE \"Agent\".\"id\"=?";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_sqlite >::update_statement[] =
|
||||||
|
"UPDATE \"Agent\" "
|
||||||
|
"SET "
|
||||||
|
"\"role\"=?, "
|
||||||
|
"\"persistent\"=?, "
|
||||||
|
"\"displayName\"=? "
|
||||||
|
"WHERE \"id\"=?";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_sqlite >::erase_statement[] =
|
||||||
|
"DELETE FROM \"Agent\" "
|
||||||
|
"WHERE \"id\"=?";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_sqlite >::query_statement[] =
|
||||||
|
"SELECT "
|
||||||
|
"\"Agent\".\"id\", "
|
||||||
|
"\"Agent\".\"role\", "
|
||||||
|
"\"Agent\".\"persistent\", "
|
||||||
|
"\"Agent\".\"displayName\" "
|
||||||
|
"FROM \"Agent\"";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_sqlite >::erase_query_statement[] =
|
||||||
|
"DELETE FROM \"Agent\"";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::Agent, id_sqlite >::table_name[] =
|
||||||
|
"\"Agent\"";
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::Agent, id_sqlite >::
|
||||||
|
persist (database& db, const object_type& obj)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
sqlite::connection& conn (
|
||||||
|
sqlite::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
callback (db,
|
||||||
|
obj,
|
||||||
|
callback_event::pre_persist);
|
||||||
|
|
||||||
|
image_type& im (sts.image ());
|
||||||
|
binding& imb (sts.insert_image_binding ());
|
||||||
|
|
||||||
|
if (init (im, obj, statement_insert))
|
||||||
|
im.version++;
|
||||||
|
|
||||||
|
if (im.version != sts.insert_image_version () ||
|
||||||
|
imb.version == 0)
|
||||||
|
{
|
||||||
|
bind (imb.bind, im, statement_insert);
|
||||||
|
sts.insert_image_version (im.version);
|
||||||
|
imb.version++;
|
||||||
|
}
|
||||||
|
|
||||||
|
insert_statement& st (sts.persist_statement ());
|
||||||
|
if (!st.execute ())
|
||||||
|
throw object_already_persistent ();
|
||||||
|
|
||||||
|
callback (db,
|
||||||
|
obj,
|
||||||
|
callback_event::post_persist);
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::Agent, id_sqlite >::
|
||||||
|
update (database& db, const object_type& obj)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
|
||||||
|
using namespace sqlite;
|
||||||
|
using sqlite::update_statement;
|
||||||
|
|
||||||
|
callback (db, obj, callback_event::pre_update);
|
||||||
|
|
||||||
|
sqlite::transaction& tr (sqlite::transaction::current ());
|
||||||
|
sqlite::connection& conn (tr.connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
const id_type& id (
|
||||||
|
obj.id);
|
||||||
|
id_image_type& idi (sts.id_image ());
|
||||||
|
init (idi, id);
|
||||||
|
|
||||||
|
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< ::models::Agent, id_sqlite >::
|
||||||
|
erase (database& db, const id_type& id)
|
||||||
|
{
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
|
||||||
|
sqlite::connection& conn (
|
||||||
|
sqlite::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
id_image_type& i (sts.id_image ());
|
||||||
|
init (i, id);
|
||||||
|
|
||||||
|
binding& idb (sts.id_image_binding ());
|
||||||
|
if (i.version != sts.id_image_version () || idb.version == 0)
|
||||||
|
{
|
||||||
|
bind (idb.bind, i);
|
||||||
|
sts.id_image_version (i.version);
|
||||||
|
idb.version++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sts.erase_statement ().execute () != 1)
|
||||||
|
throw object_not_persistent ();
|
||||||
|
|
||||||
|
pointer_cache_traits::erase (db, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
access::object_traits_impl< ::models::Agent, id_sqlite >::pointer_type
|
||||||
|
access::object_traits_impl< ::models::Agent, id_sqlite >::
|
||||||
|
find (database& db, const id_type& id)
|
||||||
|
{
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
{
|
||||||
|
pointer_type p (pointer_cache_traits::find (db, id));
|
||||||
|
|
||||||
|
if (!pointer_traits::null_ptr (p))
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
sqlite::connection& conn (
|
||||||
|
sqlite::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
statements_type::auto_lock l (sts);
|
||||||
|
|
||||||
|
if (l.locked ())
|
||||||
|
{
|
||||||
|
if (!find_ (sts, &id))
|
||||||
|
return pointer_type ();
|
||||||
|
}
|
||||||
|
|
||||||
|
pointer_type p (
|
||||||
|
access::object_factory<object_type, pointer_type>::create ());
|
||||||
|
pointer_traits::guard pg (p);
|
||||||
|
|
||||||
|
pointer_cache_traits::insert_guard ig (
|
||||||
|
pointer_cache_traits::insert (db, id, p));
|
||||||
|
|
||||||
|
object_type& obj (pointer_traits::get_ref (p));
|
||||||
|
|
||||||
|
if (l.locked ())
|
||||||
|
{
|
||||||
|
select_statement& st (sts.find_statement ());
|
||||||
|
ODB_POTENTIALLY_UNUSED (st);
|
||||||
|
|
||||||
|
callback (db, obj, callback_event::pre_load);
|
||||||
|
init (obj, sts.image (), &db);
|
||||||
|
load_ (sts, obj, false);
|
||||||
|
sts.load_delayed (0);
|
||||||
|
l.unlock ();
|
||||||
|
callback (db, obj, callback_event::post_load);
|
||||||
|
pointer_cache_traits::load (ig.position ());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sts.delay_load (id, obj, ig.position ());
|
||||||
|
|
||||||
|
ig.release ();
|
||||||
|
pg.release ();
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool access::object_traits_impl< ::models::Agent, id_sqlite >::
|
||||||
|
find (database& db, const id_type& id, object_type& obj)
|
||||||
|
{
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
sqlite::connection& conn (
|
||||||
|
sqlite::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
statements_type::auto_lock l (sts);
|
||||||
|
|
||||||
|
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< ::models::Agent, id_sqlite >::
|
||||||
|
reload (database& db, object_type& obj)
|
||||||
|
{
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
sqlite::connection& conn (
|
||||||
|
sqlite::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
statements_type::auto_lock l (sts);
|
||||||
|
|
||||||
|
const id_type& id (
|
||||||
|
obj.id);
|
||||||
|
|
||||||
|
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< ::models::Agent, id_sqlite >::
|
||||||
|
find_ (statements_type& sts,
|
||||||
|
const id_type* id)
|
||||||
|
{
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
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< ::models::Agent, id_sqlite >::object_type >
|
||||||
|
access::object_traits_impl< ::models::Agent, id_sqlite >::
|
||||||
|
query (database&, const query_base_type& q)
|
||||||
|
{
|
||||||
|
using namespace sqlite;
|
||||||
|
using odb::details::shared;
|
||||||
|
using odb::details::shared_ptr;
|
||||||
|
|
||||||
|
sqlite::connection& conn (
|
||||||
|
sqlite::transaction::current ().connection ());
|
||||||
|
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
image_type& im (sts.image ());
|
||||||
|
binding& imb (sts.select_image_binding ());
|
||||||
|
|
||||||
|
if (im.version != sts.select_image_version () ||
|
||||||
|
imb.version == 0)
|
||||||
|
{
|
||||||
|
bind (imb.bind, im, statement_select);
|
||||||
|
sts.select_image_version (im.version);
|
||||||
|
imb.version++;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string text (query_statement);
|
||||||
|
if (!q.empty ())
|
||||||
|
{
|
||||||
|
text += " ";
|
||||||
|
text += q.clause ();
|
||||||
|
}
|
||||||
|
|
||||||
|
q.init_parameters ();
|
||||||
|
shared_ptr<select_statement> st (
|
||||||
|
new (shared) select_statement (
|
||||||
|
conn,
|
||||||
|
text,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
q.parameters_binding (),
|
||||||
|
imb));
|
||||||
|
|
||||||
|
st->execute ();
|
||||||
|
|
||||||
|
shared_ptr< odb::object_result_impl<object_type> > r (
|
||||||
|
new (shared) sqlite::object_result_impl<object_type> (
|
||||||
|
q, st, sts, 0));
|
||||||
|
|
||||||
|
return result<object_type> (r);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned long long access::object_traits_impl< ::models::Agent, id_sqlite >::
|
||||||
|
erase_query (database&, const query_base_type& q)
|
||||||
|
{
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
sqlite::connection& conn (
|
||||||
|
sqlite::transaction::current ().connection ());
|
||||||
|
|
||||||
|
std::string text (erase_query_statement);
|
||||||
|
if (!q.empty ())
|
||||||
|
{
|
||||||
|
text += ' ';
|
||||||
|
text += q.clause ();
|
||||||
|
}
|
||||||
|
|
||||||
|
q.init_parameters ();
|
||||||
|
delete_statement st (
|
||||||
|
conn,
|
||||||
|
text,
|
||||||
|
q.parameters_binding ());
|
||||||
|
|
||||||
|
return st.execute ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#include <odb/post.hxx>
|
||||||
320
db/test-schema-v1.1/generated-sql-ddl/sqlite/Agent-odb.hxx
Normal file
320
db/test-schema-v1.1/generated-sql-ddl/sqlite/Agent-odb.hxx
Normal file
@@ -0,0 +1,320 @@
|
|||||||
|
// This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
// compiler for C++.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef AGENT_ODB_HXX
|
||||||
|
#define AGENT_ODB_HXX
|
||||||
|
|
||||||
|
#include <odb/version.hxx>
|
||||||
|
|
||||||
|
#if (ODB_VERSION != 20400UL)
|
||||||
|
#error ODB runtime version mismatch
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <odb/pre.hxx>
|
||||||
|
|
||||||
|
#include "Agent.h"
|
||||||
|
|
||||||
|
#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/simple-object-result.hxx>
|
||||||
|
|
||||||
|
#include <odb/details/unused.hxx>
|
||||||
|
#include <odb/details/shared-ptr.hxx>
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// Agent
|
||||||
|
//
|
||||||
|
template <>
|
||||||
|
struct class_traits< ::models::Agent >
|
||||||
|
{
|
||||||
|
static const class_kind kind = class_object;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits< ::models::Agent >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef ::models::Agent object_type;
|
||||||
|
typedef ::models::Agent* 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);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#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
|
||||||
|
{
|
||||||
|
// Agent
|
||||||
|
//
|
||||||
|
template <typename A>
|
||||||
|
struct query_columns< ::models::Agent, id_sqlite, A >
|
||||||
|
{
|
||||||
|
// id
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
id_type_;
|
||||||
|
|
||||||
|
static const id_type_ id;
|
||||||
|
|
||||||
|
// role
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
role_type_;
|
||||||
|
|
||||||
|
static const role_type_ role;
|
||||||
|
|
||||||
|
// persistent
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
bool,
|
||||||
|
sqlite::id_integer >::query_type,
|
||||||
|
sqlite::id_integer >
|
||||||
|
persistent_type_;
|
||||||
|
|
||||||
|
static const persistent_type_ persistent;
|
||||||
|
|
||||||
|
// displayName
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
displayName_type_;
|
||||||
|
|
||||||
|
static const displayName_type_ displayName;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::Agent, id_sqlite, A >::id_type_
|
||||||
|
query_columns< ::models::Agent, id_sqlite, A >::
|
||||||
|
id (A::table_name, "\"id\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::Agent, id_sqlite, A >::role_type_
|
||||||
|
query_columns< ::models::Agent, id_sqlite, A >::
|
||||||
|
role (A::table_name, "\"role\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::Agent, id_sqlite, A >::persistent_type_
|
||||||
|
query_columns< ::models::Agent, id_sqlite, A >::
|
||||||
|
persistent (A::table_name, "\"persistent\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::Agent, id_sqlite, A >::displayName_type_
|
||||||
|
query_columns< ::models::Agent, id_sqlite, A >::
|
||||||
|
displayName (A::table_name, "\"displayName\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
struct pointer_query_columns< ::models::Agent, id_sqlite, A >:
|
||||||
|
query_columns< ::models::Agent, id_sqlite, A >
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits_impl< ::models::Agent, id_sqlite >:
|
||||||
|
public access::object_traits< ::models::Agent >
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
|
||||||
|
// role
|
||||||
|
//
|
||||||
|
details::buffer role_value;
|
||||||
|
std::size_t role_size;
|
||||||
|
bool role_null;
|
||||||
|
|
||||||
|
// persistent
|
||||||
|
//
|
||||||
|
long long persistent_value;
|
||||||
|
bool persistent_null;
|
||||||
|
|
||||||
|
// displayName
|
||||||
|
//
|
||||||
|
details::buffer displayName_value;
|
||||||
|
std::size_t displayName_size;
|
||||||
|
bool displayName_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 (sqlite::bind*,
|
||||||
|
image_type&,
|
||||||
|
sqlite::statement_kind);
|
||||||
|
|
||||||
|
static void
|
||||||
|
bind (sqlite::bind*, id_image_type&);
|
||||||
|
|
||||||
|
static bool
|
||||||
|
init (image_type&,
|
||||||
|
const object_type&,
|
||||||
|
sqlite::statement_kind);
|
||||||
|
|
||||||
|
static void
|
||||||
|
init (object_type&,
|
||||||
|
const image_type&,
|
||||||
|
database*);
|
||||||
|
|
||||||
|
static void
|
||||||
|
init (id_image_type&, const id_type&);
|
||||||
|
|
||||||
|
typedef sqlite::object_statements<object_type> statements_type;
|
||||||
|
|
||||||
|
typedef sqlite::query_base query_base_type;
|
||||||
|
|
||||||
|
static const std::size_t column_count = 4UL;
|
||||||
|
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&);
|
||||||
|
|
||||||
|
public:
|
||||||
|
static bool
|
||||||
|
find_ (statements_type&,
|
||||||
|
const id_type*);
|
||||||
|
|
||||||
|
static void
|
||||||
|
load_ (statements_type&,
|
||||||
|
object_type&,
|
||||||
|
bool reload);
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits_impl< ::models::Agent, id_common >:
|
||||||
|
public access::object_traits_impl< ::models::Agent, id_sqlite >
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
// Agent
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "Agent-odb.ixx"
|
||||||
|
|
||||||
|
#include <odb/post.hxx>
|
||||||
|
|
||||||
|
#endif // AGENT_ODB_HXX
|
||||||
61
db/test-schema-v1.1/generated-sql-ddl/sqlite/Agent-odb.ixx
Normal file
61
db/test-schema-v1.1/generated-sql-ddl/sqlite/Agent-odb.ixx
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
// This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
// compiler for C++.
|
||||||
|
//
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// Agent
|
||||||
|
//
|
||||||
|
|
||||||
|
inline
|
||||||
|
access::object_traits< ::models::Agent >::id_type
|
||||||
|
access::object_traits< ::models::Agent >::
|
||||||
|
id (const object_type& o)
|
||||||
|
{
|
||||||
|
return o.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
void access::object_traits< ::models::Agent >::
|
||||||
|
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< ::models::Agent >::
|
||||||
|
callback (database& db, const object_type& x, callback_event e)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
ODB_POTENTIALLY_UNUSED (x);
|
||||||
|
ODB_POTENTIALLY_UNUSED (e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// Agent
|
||||||
|
//
|
||||||
|
|
||||||
|
inline
|
||||||
|
void access::object_traits_impl< ::models::Agent, id_sqlite >::
|
||||||
|
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< ::models::Agent, id_sqlite >::
|
||||||
|
load_ (statements_type& sts,
|
||||||
|
object_type& obj,
|
||||||
|
bool)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (sts);
|
||||||
|
ODB_POTENTIALLY_UNUSED (obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
24
db/test-schema-v1.1/generated-sql-ddl/sqlite/Agent.sql
Normal file
24
db/test-schema-v1.1/generated-sql-ddl/sqlite/Agent.sql
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
/* This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
* compiler for C++.
|
||||||
|
*/
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS "Agent";
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS "schema_version" (
|
||||||
|
"name" TEXT NOT NULL PRIMARY KEY,
|
||||||
|
"version" INTEGER NOT NULL,
|
||||||
|
"migration" INTEGER NOT NULL);
|
||||||
|
|
||||||
|
DELETE FROM "schema_version"
|
||||||
|
WHERE "name" = '';
|
||||||
|
|
||||||
|
CREATE TABLE "Agent" (
|
||||||
|
"id" TEXT NOT NULL PRIMARY KEY,
|
||||||
|
"role" TEXT NOT NULL,
|
||||||
|
"persistent" INTEGER NOT NULL,
|
||||||
|
"displayName" TEXT NOT NULL);
|
||||||
|
|
||||||
|
INSERT OR IGNORE INTO "schema_version" (
|
||||||
|
"name", "version", "migration")
|
||||||
|
VALUES ('', 1, 0);
|
||||||
|
|
||||||
@@ -0,0 +1,725 @@
|
|||||||
|
// This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
// compiler for C++.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <odb/pre.hxx>
|
||||||
|
|
||||||
|
#include "GovernmentAddress-odb.hxx"
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
#include <cstring> // std::memcpy
|
||||||
|
|
||||||
|
|
||||||
|
#include <odb/sqlite/traits.hxx>
|
||||||
|
#include <odb/sqlite/database.hxx>
|
||||||
|
#include <odb/sqlite/transaction.hxx>
|
||||||
|
#include <odb/sqlite/connection.hxx>
|
||||||
|
#include <odb/sqlite/statement.hxx>
|
||||||
|
#include <odb/sqlite/statement-cache.hxx>
|
||||||
|
#include <odb/sqlite/simple-object-statements.hxx>
|
||||||
|
#include <odb/sqlite/container-statements.hxx>
|
||||||
|
#include <odb/sqlite/exceptions.hxx>
|
||||||
|
#include <odb/sqlite/simple-object-result.hxx>
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// GovernmentAddress
|
||||||
|
//
|
||||||
|
|
||||||
|
struct access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::extra_statement_cache_type
|
||||||
|
{
|
||||||
|
extra_statement_cache_type (
|
||||||
|
sqlite::connection&,
|
||||||
|
image_type&,
|
||||||
|
id_image_type&,
|
||||||
|
sqlite::binding&,
|
||||||
|
sqlite::binding&)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::id_type
|
||||||
|
access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
id (const image_type& i)
|
||||||
|
{
|
||||||
|
sqlite::database* db (0);
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
|
||||||
|
id_type id;
|
||||||
|
{
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::set_value (
|
||||||
|
id,
|
||||||
|
i.id_value,
|
||||||
|
i.id_size,
|
||||||
|
i.id_null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// addressLabel
|
||||||
|
//
|
||||||
|
if (t[1UL])
|
||||||
|
{
|
||||||
|
i.addressLabel_value.capacity (i.addressLabel_size);
|
||||||
|
grew = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// regionLookupKey
|
||||||
|
//
|
||||||
|
if (t[2UL])
|
||||||
|
{
|
||||||
|
i.regionLookupKey_value.capacity (i.regionLookupKey_size);
|
||||||
|
grew = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return grew;
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
bind (sqlite::bind* b,
|
||||||
|
image_type& i,
|
||||||
|
sqlite::statement_kind sk)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (sk);
|
||||||
|
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
std::size_t n (0);
|
||||||
|
|
||||||
|
// id
|
||||||
|
//
|
||||||
|
if (sk != statement_update)
|
||||||
|
{
|
||||||
|
b[n].type = sqlite::image_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text>::bind_value;
|
||||||
|
b[n].buffer = i.id_value.data ();
|
||||||
|
b[n].size = &i.id_size;
|
||||||
|
b[n].capacity = i.id_value.capacity ();
|
||||||
|
b[n].is_null = &i.id_null;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// addressLabel
|
||||||
|
//
|
||||||
|
b[n].type = sqlite::image_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text>::bind_value;
|
||||||
|
b[n].buffer = i.addressLabel_value.data ();
|
||||||
|
b[n].size = &i.addressLabel_size;
|
||||||
|
b[n].capacity = i.addressLabel_value.capacity ();
|
||||||
|
b[n].is_null = &i.addressLabel_null;
|
||||||
|
n++;
|
||||||
|
|
||||||
|
// regionLookupKey
|
||||||
|
//
|
||||||
|
b[n].type = sqlite::image_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text>::bind_value;
|
||||||
|
b[n].buffer = i.regionLookupKey_value.data ();
|
||||||
|
b[n].size = &i.regionLookupKey_size;
|
||||||
|
b[n].capacity = i.regionLookupKey_value.capacity ();
|
||||||
|
b[n].is_null = &i.regionLookupKey_null;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
bind (sqlite::bind* b, id_image_type& i)
|
||||||
|
{
|
||||||
|
std::size_t n (0);
|
||||||
|
b[n].type = sqlite::image_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text>::bind_value;
|
||||||
|
b[n].buffer = i.id_value.data ();
|
||||||
|
b[n].size = &i.id_size;
|
||||||
|
b[n].capacity = i.id_value.capacity ();
|
||||||
|
b[n].is_null = &i.id_null;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
init (image_type& i,
|
||||||
|
const object_type& o,
|
||||||
|
sqlite::statement_kind sk)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (i);
|
||||||
|
ODB_POTENTIALLY_UNUSED (o);
|
||||||
|
ODB_POTENTIALLY_UNUSED (sk);
|
||||||
|
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
bool grew (false);
|
||||||
|
|
||||||
|
// id
|
||||||
|
//
|
||||||
|
if (sk == statement_insert)
|
||||||
|
{
|
||||||
|
::std::string const& v =
|
||||||
|
o.id;
|
||||||
|
|
||||||
|
bool is_null (false);
|
||||||
|
std::size_t cap (i.id_value.capacity ());
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::set_image (
|
||||||
|
i.id_value,
|
||||||
|
i.id_size,
|
||||||
|
is_null,
|
||||||
|
v);
|
||||||
|
i.id_null = is_null;
|
||||||
|
grew = grew || (cap != i.id_value.capacity ());
|
||||||
|
}
|
||||||
|
|
||||||
|
// addressLabel
|
||||||
|
//
|
||||||
|
{
|
||||||
|
::std::string const& v =
|
||||||
|
o.addressLabel;
|
||||||
|
|
||||||
|
bool is_null (false);
|
||||||
|
std::size_t cap (i.addressLabel_value.capacity ());
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::set_image (
|
||||||
|
i.addressLabel_value,
|
||||||
|
i.addressLabel_size,
|
||||||
|
is_null,
|
||||||
|
v);
|
||||||
|
i.addressLabel_null = is_null;
|
||||||
|
grew = grew || (cap != i.addressLabel_value.capacity ());
|
||||||
|
}
|
||||||
|
|
||||||
|
// regionLookupKey
|
||||||
|
//
|
||||||
|
{
|
||||||
|
::std::string const& v =
|
||||||
|
o.regionLookupKey;
|
||||||
|
|
||||||
|
bool is_null (false);
|
||||||
|
std::size_t cap (i.regionLookupKey_value.capacity ());
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::set_image (
|
||||||
|
i.regionLookupKey_value,
|
||||||
|
i.regionLookupKey_size,
|
||||||
|
is_null,
|
||||||
|
v);
|
||||||
|
i.regionLookupKey_null = is_null;
|
||||||
|
grew = grew || (cap != i.regionLookupKey_value.capacity ());
|
||||||
|
}
|
||||||
|
|
||||||
|
return grew;
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
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;
|
||||||
|
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::set_value (
|
||||||
|
v,
|
||||||
|
i.id_value,
|
||||||
|
i.id_size,
|
||||||
|
i.id_null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// addressLabel
|
||||||
|
//
|
||||||
|
{
|
||||||
|
::std::string& v =
|
||||||
|
o.addressLabel;
|
||||||
|
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::set_value (
|
||||||
|
v,
|
||||||
|
i.addressLabel_value,
|
||||||
|
i.addressLabel_size,
|
||||||
|
i.addressLabel_null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// regionLookupKey
|
||||||
|
//
|
||||||
|
{
|
||||||
|
::std::string& v =
|
||||||
|
o.regionLookupKey;
|
||||||
|
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::set_value (
|
||||||
|
v,
|
||||||
|
i.regionLookupKey_value,
|
||||||
|
i.regionLookupKey_size,
|
||||||
|
i.regionLookupKey_null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
init (id_image_type& i, const id_type& id)
|
||||||
|
{
|
||||||
|
bool grew (false);
|
||||||
|
{
|
||||||
|
bool is_null (false);
|
||||||
|
std::size_t cap (i.id_value.capacity ());
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::set_image (
|
||||||
|
i.id_value,
|
||||||
|
i.id_size,
|
||||||
|
is_null,
|
||||||
|
id);
|
||||||
|
i.id_null = is_null;
|
||||||
|
grew = grew || (cap != i.id_value.capacity ());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (grew)
|
||||||
|
i.version++;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::persist_statement[] =
|
||||||
|
"INSERT INTO \"GovernmentAddress\" "
|
||||||
|
"(\"id\", "
|
||||||
|
"\"addressLabel\", "
|
||||||
|
"\"regionLookupKey\") "
|
||||||
|
"VALUES "
|
||||||
|
"(?, ?, ?)";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::find_statement[] =
|
||||||
|
"SELECT "
|
||||||
|
"\"GovernmentAddress\".\"id\", "
|
||||||
|
"\"GovernmentAddress\".\"addressLabel\", "
|
||||||
|
"\"GovernmentAddress\".\"regionLookupKey\" "
|
||||||
|
"FROM \"GovernmentAddress\" "
|
||||||
|
"WHERE \"GovernmentAddress\".\"id\"=?";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::update_statement[] =
|
||||||
|
"UPDATE \"GovernmentAddress\" "
|
||||||
|
"SET "
|
||||||
|
"\"addressLabel\"=?, "
|
||||||
|
"\"regionLookupKey\"=? "
|
||||||
|
"WHERE \"id\"=?";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::erase_statement[] =
|
||||||
|
"DELETE FROM \"GovernmentAddress\" "
|
||||||
|
"WHERE \"id\"=?";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::query_statement[] =
|
||||||
|
"SELECT "
|
||||||
|
"\"GovernmentAddress\".\"id\", "
|
||||||
|
"\"GovernmentAddress\".\"addressLabel\", "
|
||||||
|
"\"GovernmentAddress\".\"regionLookupKey\" "
|
||||||
|
"FROM \"GovernmentAddress\"";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::erase_query_statement[] =
|
||||||
|
"DELETE FROM \"GovernmentAddress\"";
|
||||||
|
|
||||||
|
const char access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::table_name[] =
|
||||||
|
"\"GovernmentAddress\"";
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
persist (database& db, const object_type& obj)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
sqlite::connection& conn (
|
||||||
|
sqlite::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
callback (db,
|
||||||
|
obj,
|
||||||
|
callback_event::pre_persist);
|
||||||
|
|
||||||
|
image_type& im (sts.image ());
|
||||||
|
binding& imb (sts.insert_image_binding ());
|
||||||
|
|
||||||
|
if (init (im, obj, statement_insert))
|
||||||
|
im.version++;
|
||||||
|
|
||||||
|
if (im.version != sts.insert_image_version () ||
|
||||||
|
imb.version == 0)
|
||||||
|
{
|
||||||
|
bind (imb.bind, im, statement_insert);
|
||||||
|
sts.insert_image_version (im.version);
|
||||||
|
imb.version++;
|
||||||
|
}
|
||||||
|
|
||||||
|
insert_statement& st (sts.persist_statement ());
|
||||||
|
if (!st.execute ())
|
||||||
|
throw object_already_persistent ();
|
||||||
|
|
||||||
|
callback (db,
|
||||||
|
obj,
|
||||||
|
callback_event::post_persist);
|
||||||
|
}
|
||||||
|
|
||||||
|
void access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
update (database& db, const object_type& obj)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
|
||||||
|
using namespace sqlite;
|
||||||
|
using sqlite::update_statement;
|
||||||
|
|
||||||
|
callback (db, obj, callback_event::pre_update);
|
||||||
|
|
||||||
|
sqlite::transaction& tr (sqlite::transaction::current ());
|
||||||
|
sqlite::connection& conn (tr.connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
const id_type& id (
|
||||||
|
obj.id);
|
||||||
|
id_image_type& idi (sts.id_image ());
|
||||||
|
init (idi, id);
|
||||||
|
|
||||||
|
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< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
erase (database& db, const id_type& id)
|
||||||
|
{
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
|
||||||
|
sqlite::connection& conn (
|
||||||
|
sqlite::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
id_image_type& i (sts.id_image ());
|
||||||
|
init (i, id);
|
||||||
|
|
||||||
|
binding& idb (sts.id_image_binding ());
|
||||||
|
if (i.version != sts.id_image_version () || idb.version == 0)
|
||||||
|
{
|
||||||
|
bind (idb.bind, i);
|
||||||
|
sts.id_image_version (i.version);
|
||||||
|
idb.version++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sts.erase_statement ().execute () != 1)
|
||||||
|
throw object_not_persistent ();
|
||||||
|
|
||||||
|
pointer_cache_traits::erase (db, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::pointer_type
|
||||||
|
access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
find (database& db, const id_type& id)
|
||||||
|
{
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
{
|
||||||
|
pointer_type p (pointer_cache_traits::find (db, id));
|
||||||
|
|
||||||
|
if (!pointer_traits::null_ptr (p))
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
sqlite::connection& conn (
|
||||||
|
sqlite::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
statements_type::auto_lock l (sts);
|
||||||
|
|
||||||
|
if (l.locked ())
|
||||||
|
{
|
||||||
|
if (!find_ (sts, &id))
|
||||||
|
return pointer_type ();
|
||||||
|
}
|
||||||
|
|
||||||
|
pointer_type p (
|
||||||
|
access::object_factory<object_type, pointer_type>::create ());
|
||||||
|
pointer_traits::guard pg (p);
|
||||||
|
|
||||||
|
pointer_cache_traits::insert_guard ig (
|
||||||
|
pointer_cache_traits::insert (db, id, p));
|
||||||
|
|
||||||
|
object_type& obj (pointer_traits::get_ref (p));
|
||||||
|
|
||||||
|
if (l.locked ())
|
||||||
|
{
|
||||||
|
select_statement& st (sts.find_statement ());
|
||||||
|
ODB_POTENTIALLY_UNUSED (st);
|
||||||
|
|
||||||
|
callback (db, obj, callback_event::pre_load);
|
||||||
|
init (obj, sts.image (), &db);
|
||||||
|
load_ (sts, obj, false);
|
||||||
|
sts.load_delayed (0);
|
||||||
|
l.unlock ();
|
||||||
|
callback (db, obj, callback_event::post_load);
|
||||||
|
pointer_cache_traits::load (ig.position ());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sts.delay_load (id, obj, ig.position ());
|
||||||
|
|
||||||
|
ig.release ();
|
||||||
|
pg.release ();
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
find (database& db, const id_type& id, object_type& obj)
|
||||||
|
{
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
sqlite::connection& conn (
|
||||||
|
sqlite::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
statements_type::auto_lock l (sts);
|
||||||
|
|
||||||
|
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< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
reload (database& db, object_type& obj)
|
||||||
|
{
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
sqlite::connection& conn (
|
||||||
|
sqlite::transaction::current ().connection ());
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
statements_type::auto_lock l (sts);
|
||||||
|
|
||||||
|
const id_type& id (
|
||||||
|
obj.id);
|
||||||
|
|
||||||
|
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< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
find_ (statements_type& sts,
|
||||||
|
const id_type* id)
|
||||||
|
{
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
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< ::models::GovernmentAddress, id_sqlite >::object_type >
|
||||||
|
access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
query (database&, const query_base_type& q)
|
||||||
|
{
|
||||||
|
using namespace sqlite;
|
||||||
|
using odb::details::shared;
|
||||||
|
using odb::details::shared_ptr;
|
||||||
|
|
||||||
|
sqlite::connection& conn (
|
||||||
|
sqlite::transaction::current ().connection ());
|
||||||
|
|
||||||
|
statements_type& sts (
|
||||||
|
conn.statement_cache ().find_object<object_type> ());
|
||||||
|
|
||||||
|
image_type& im (sts.image ());
|
||||||
|
binding& imb (sts.select_image_binding ());
|
||||||
|
|
||||||
|
if (im.version != sts.select_image_version () ||
|
||||||
|
imb.version == 0)
|
||||||
|
{
|
||||||
|
bind (imb.bind, im, statement_select);
|
||||||
|
sts.select_image_version (im.version);
|
||||||
|
imb.version++;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string text (query_statement);
|
||||||
|
if (!q.empty ())
|
||||||
|
{
|
||||||
|
text += " ";
|
||||||
|
text += q.clause ();
|
||||||
|
}
|
||||||
|
|
||||||
|
q.init_parameters ();
|
||||||
|
shared_ptr<select_statement> st (
|
||||||
|
new (shared) select_statement (
|
||||||
|
conn,
|
||||||
|
text,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
q.parameters_binding (),
|
||||||
|
imb));
|
||||||
|
|
||||||
|
st->execute ();
|
||||||
|
|
||||||
|
shared_ptr< odb::object_result_impl<object_type> > r (
|
||||||
|
new (shared) sqlite::object_result_impl<object_type> (
|
||||||
|
q, st, sts, 0));
|
||||||
|
|
||||||
|
return result<object_type> (r);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned long long access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
erase_query (database&, const query_base_type& q)
|
||||||
|
{
|
||||||
|
using namespace sqlite;
|
||||||
|
|
||||||
|
sqlite::connection& conn (
|
||||||
|
sqlite::transaction::current ().connection ());
|
||||||
|
|
||||||
|
std::string text (erase_query_statement);
|
||||||
|
if (!q.empty ())
|
||||||
|
{
|
||||||
|
text += ' ';
|
||||||
|
text += q.clause ();
|
||||||
|
}
|
||||||
|
|
||||||
|
q.init_parameters ();
|
||||||
|
delete_statement st (
|
||||||
|
conn,
|
||||||
|
text,
|
||||||
|
q.parameters_binding ());
|
||||||
|
|
||||||
|
return st.execute ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#include <odb/post.hxx>
|
||||||
@@ -0,0 +1,298 @@
|
|||||||
|
// This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
// compiler for C++.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef GOVERNMENT_ADDRESS_ODB_HXX
|
||||||
|
#define GOVERNMENT_ADDRESS_ODB_HXX
|
||||||
|
|
||||||
|
#include <odb/version.hxx>
|
||||||
|
|
||||||
|
#if (ODB_VERSION != 20400UL)
|
||||||
|
#error ODB runtime version mismatch
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <odb/pre.hxx>
|
||||||
|
|
||||||
|
#include "GovernmentAddress.h"
|
||||||
|
|
||||||
|
#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/simple-object-result.hxx>
|
||||||
|
|
||||||
|
#include <odb/details/unused.hxx>
|
||||||
|
#include <odb/details/shared-ptr.hxx>
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// GovernmentAddress
|
||||||
|
//
|
||||||
|
template <>
|
||||||
|
struct class_traits< ::models::GovernmentAddress >
|
||||||
|
{
|
||||||
|
static const class_kind kind = class_object;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits< ::models::GovernmentAddress >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef ::models::GovernmentAddress object_type;
|
||||||
|
typedef ::models::GovernmentAddress* 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);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#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
|
||||||
|
{
|
||||||
|
// GovernmentAddress
|
||||||
|
//
|
||||||
|
template <typename A>
|
||||||
|
struct query_columns< ::models::GovernmentAddress, id_sqlite, A >
|
||||||
|
{
|
||||||
|
// id
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
id_type_;
|
||||||
|
|
||||||
|
static const id_type_ id;
|
||||||
|
|
||||||
|
// addressLabel
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
addressLabel_type_;
|
||||||
|
|
||||||
|
static const addressLabel_type_ addressLabel;
|
||||||
|
|
||||||
|
// regionLookupKey
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
regionLookupKey_type_;
|
||||||
|
|
||||||
|
static const regionLookupKey_type_ regionLookupKey;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::GovernmentAddress, id_sqlite, A >::id_type_
|
||||||
|
query_columns< ::models::GovernmentAddress, id_sqlite, A >::
|
||||||
|
id (A::table_name, "\"id\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::GovernmentAddress, id_sqlite, A >::addressLabel_type_
|
||||||
|
query_columns< ::models::GovernmentAddress, id_sqlite, A >::
|
||||||
|
addressLabel (A::table_name, "\"addressLabel\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::GovernmentAddress, id_sqlite, A >::regionLookupKey_type_
|
||||||
|
query_columns< ::models::GovernmentAddress, id_sqlite, A >::
|
||||||
|
regionLookupKey (A::table_name, "\"regionLookupKey\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
struct pointer_query_columns< ::models::GovernmentAddress, id_sqlite, A >:
|
||||||
|
query_columns< ::models::GovernmentAddress, id_sqlite, A >
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >:
|
||||||
|
public access::object_traits< ::models::GovernmentAddress >
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
|
||||||
|
// addressLabel
|
||||||
|
//
|
||||||
|
details::buffer addressLabel_value;
|
||||||
|
std::size_t addressLabel_size;
|
||||||
|
bool addressLabel_null;
|
||||||
|
|
||||||
|
// regionLookupKey
|
||||||
|
//
|
||||||
|
details::buffer regionLookupKey_value;
|
||||||
|
std::size_t regionLookupKey_size;
|
||||||
|
bool regionLookupKey_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 (sqlite::bind*,
|
||||||
|
image_type&,
|
||||||
|
sqlite::statement_kind);
|
||||||
|
|
||||||
|
static void
|
||||||
|
bind (sqlite::bind*, id_image_type&);
|
||||||
|
|
||||||
|
static bool
|
||||||
|
init (image_type&,
|
||||||
|
const object_type&,
|
||||||
|
sqlite::statement_kind);
|
||||||
|
|
||||||
|
static void
|
||||||
|
init (object_type&,
|
||||||
|
const image_type&,
|
||||||
|
database*);
|
||||||
|
|
||||||
|
static void
|
||||||
|
init (id_image_type&, const id_type&);
|
||||||
|
|
||||||
|
typedef sqlite::object_statements<object_type> statements_type;
|
||||||
|
|
||||||
|
typedef sqlite::query_base query_base_type;
|
||||||
|
|
||||||
|
static const std::size_t column_count = 3UL;
|
||||||
|
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&);
|
||||||
|
|
||||||
|
public:
|
||||||
|
static bool
|
||||||
|
find_ (statements_type&,
|
||||||
|
const id_type*);
|
||||||
|
|
||||||
|
static void
|
||||||
|
load_ (statements_type&,
|
||||||
|
object_type&,
|
||||||
|
bool reload);
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits_impl< ::models::GovernmentAddress, id_common >:
|
||||||
|
public access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
// GovernmentAddress
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "GovernmentAddress-odb.ixx"
|
||||||
|
|
||||||
|
#include <odb/post.hxx>
|
||||||
|
|
||||||
|
#endif // GOVERNMENT_ADDRESS_ODB_HXX
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
// This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
// compiler for C++.
|
||||||
|
//
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// GovernmentAddress
|
||||||
|
//
|
||||||
|
|
||||||
|
inline
|
||||||
|
access::object_traits< ::models::GovernmentAddress >::id_type
|
||||||
|
access::object_traits< ::models::GovernmentAddress >::
|
||||||
|
id (const object_type& o)
|
||||||
|
{
|
||||||
|
return o.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
void access::object_traits< ::models::GovernmentAddress >::
|
||||||
|
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< ::models::GovernmentAddress >::
|
||||||
|
callback (database& db, const object_type& x, callback_event e)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
ODB_POTENTIALLY_UNUSED (x);
|
||||||
|
ODB_POTENTIALLY_UNUSED (e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// GovernmentAddress
|
||||||
|
//
|
||||||
|
|
||||||
|
inline
|
||||||
|
void access::object_traits_impl< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
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< ::models::GovernmentAddress, id_sqlite >::
|
||||||
|
load_ (statements_type& sts,
|
||||||
|
object_type& obj,
|
||||||
|
bool)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (sts);
|
||||||
|
ODB_POTENTIALLY_UNUSED (obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/* This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
* compiler for C++.
|
||||||
|
*/
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS "GovernmentAddress";
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS "schema_version" (
|
||||||
|
"name" TEXT NOT NULL PRIMARY KEY,
|
||||||
|
"version" INTEGER NOT NULL,
|
||||||
|
"migration" INTEGER NOT NULL);
|
||||||
|
|
||||||
|
DELETE FROM "schema_version"
|
||||||
|
WHERE "name" = '';
|
||||||
|
|
||||||
|
CREATE TABLE "GovernmentAddress" (
|
||||||
|
"id" TEXT NOT NULL PRIMARY KEY,
|
||||||
|
"addressLabel" TEXT NOT NULL,
|
||||||
|
"regionLookupKey" TEXT NOT NULL);
|
||||||
|
|
||||||
|
INSERT OR IGNORE INTO "schema_version" (
|
||||||
|
"name", "version", "migration")
|
||||||
|
VALUES ('', 1, 0);
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,505 @@
|
|||||||
|
// This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
// compiler for C++.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef TRIP_ATTEMPT_RESULT_ODB_HXX
|
||||||
|
#define TRIP_ATTEMPT_RESULT_ODB_HXX
|
||||||
|
|
||||||
|
#include <odb/version.hxx>
|
||||||
|
|
||||||
|
#if (ODB_VERSION != 20400UL)
|
||||||
|
#error ODB runtime version mismatch
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <odb/pre.hxx>
|
||||||
|
|
||||||
|
#include "TripAttemptResult.h"
|
||||||
|
|
||||||
|
#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/simple-object-result.hxx>
|
||||||
|
|
||||||
|
#include <odb/details/unused.hxx>
|
||||||
|
#include <odb/details/shared-ptr.hxx>
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// TripAttemptResult
|
||||||
|
//
|
||||||
|
template <>
|
||||||
|
struct class_traits< ::models::TripAttemptResult >
|
||||||
|
{
|
||||||
|
static const class_kind kind = class_object;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits< ::models::TripAttemptResult >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef ::models::TripAttemptResult object_type;
|
||||||
|
typedef ::models::TripAttemptResult* 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);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#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
|
||||||
|
{
|
||||||
|
// TripAttemptResult
|
||||||
|
//
|
||||||
|
template <typename A>
|
||||||
|
struct query_columns< ::models::TripAttemptResult, id_sqlite, A >
|
||||||
|
{
|
||||||
|
// id
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
id_type_;
|
||||||
|
|
||||||
|
static const id_type_ id;
|
||||||
|
|
||||||
|
// result
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
result_type_;
|
||||||
|
|
||||||
|
static const result_type_ result;
|
||||||
|
|
||||||
|
// retryReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
retryReason_type_;
|
||||||
|
|
||||||
|
static const retryReason_type_ retryReason;
|
||||||
|
|
||||||
|
// governmentSuspensionReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
governmentSuspensionReason_type_;
|
||||||
|
|
||||||
|
static const governmentSuspensionReason_type_ governmentSuspensionReason;
|
||||||
|
|
||||||
|
// governmentTerminationReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
governmentTerminationReason_type_;
|
||||||
|
|
||||||
|
static const governmentTerminationReason_type_ governmentTerminationReason;
|
||||||
|
|
||||||
|
// complianceSuspensionReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
complianceSuspensionReason_type_;
|
||||||
|
|
||||||
|
static const complianceSuspensionReason_type_ complianceSuspensionReason;
|
||||||
|
|
||||||
|
// complianceTerminationReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
complianceTerminationReason_type_;
|
||||||
|
|
||||||
|
static const complianceTerminationReason_type_ complianceTerminationReason;
|
||||||
|
|
||||||
|
// policySuspensionReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
policySuspensionReason_type_;
|
||||||
|
|
||||||
|
static const policySuspensionReason_type_ policySuspensionReason;
|
||||||
|
|
||||||
|
// policyTerminationReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
policyTerminationReason_type_;
|
||||||
|
|
||||||
|
static const policyTerminationReason_type_ policyTerminationReason;
|
||||||
|
|
||||||
|
// cancelationReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
cancelationReason_type_;
|
||||||
|
|
||||||
|
static const cancelationReason_type_ cancelationReason;
|
||||||
|
|
||||||
|
// failureReason
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
failureReason_type_;
|
||||||
|
|
||||||
|
static const failureReason_type_ failureReason;
|
||||||
|
|
||||||
|
// details
|
||||||
|
//
|
||||||
|
typedef
|
||||||
|
sqlite::query_column<
|
||||||
|
sqlite::value_traits<
|
||||||
|
::std::string,
|
||||||
|
sqlite::id_text >::query_type,
|
||||||
|
sqlite::id_text >
|
||||||
|
details_type_;
|
||||||
|
|
||||||
|
static const details_type_ details;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_sqlite, A >::id_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_sqlite, A >::
|
||||||
|
id (A::table_name, "\"id\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_sqlite, A >::result_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_sqlite, A >::
|
||||||
|
result (A::table_name, "\"result\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_sqlite, A >::retryReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_sqlite, A >::
|
||||||
|
retryReason (A::table_name, "\"retryReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_sqlite, A >::governmentSuspensionReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_sqlite, A >::
|
||||||
|
governmentSuspensionReason (A::table_name, "\"governmentSuspensionReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_sqlite, A >::governmentTerminationReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_sqlite, A >::
|
||||||
|
governmentTerminationReason (A::table_name, "\"governmentTerminationReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_sqlite, A >::complianceSuspensionReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_sqlite, A >::
|
||||||
|
complianceSuspensionReason (A::table_name, "\"complianceSuspensionReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_sqlite, A >::complianceTerminationReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_sqlite, A >::
|
||||||
|
complianceTerminationReason (A::table_name, "\"complianceTerminationReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_sqlite, A >::policySuspensionReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_sqlite, A >::
|
||||||
|
policySuspensionReason (A::table_name, "\"policySuspensionReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_sqlite, A >::policyTerminationReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_sqlite, A >::
|
||||||
|
policyTerminationReason (A::table_name, "\"policyTerminationReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_sqlite, A >::cancelationReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_sqlite, A >::
|
||||||
|
cancelationReason (A::table_name, "\"cancelationReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_sqlite, A >::failureReason_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_sqlite, A >::
|
||||||
|
failureReason (A::table_name, "\"failureReason\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
const typename query_columns< ::models::TripAttemptResult, id_sqlite, A >::details_type_
|
||||||
|
query_columns< ::models::TripAttemptResult, id_sqlite, A >::
|
||||||
|
details (A::table_name, "\"details\"", 0);
|
||||||
|
|
||||||
|
template <typename A>
|
||||||
|
struct pointer_query_columns< ::models::TripAttemptResult, id_sqlite, A >:
|
||||||
|
query_columns< ::models::TripAttemptResult, id_sqlite, A >
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits_impl< ::models::TripAttemptResult, id_sqlite >:
|
||||||
|
public access::object_traits< ::models::TripAttemptResult >
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
|
||||||
|
// result
|
||||||
|
//
|
||||||
|
details::buffer result_value;
|
||||||
|
std::size_t result_size;
|
||||||
|
bool result_null;
|
||||||
|
|
||||||
|
// retryReason
|
||||||
|
//
|
||||||
|
details::buffer retryReason_value;
|
||||||
|
std::size_t retryReason_size;
|
||||||
|
bool retryReason_null;
|
||||||
|
|
||||||
|
// governmentSuspensionReason
|
||||||
|
//
|
||||||
|
details::buffer governmentSuspensionReason_value;
|
||||||
|
std::size_t governmentSuspensionReason_size;
|
||||||
|
bool governmentSuspensionReason_null;
|
||||||
|
|
||||||
|
// governmentTerminationReason
|
||||||
|
//
|
||||||
|
details::buffer governmentTerminationReason_value;
|
||||||
|
std::size_t governmentTerminationReason_size;
|
||||||
|
bool governmentTerminationReason_null;
|
||||||
|
|
||||||
|
// complianceSuspensionReason
|
||||||
|
//
|
||||||
|
details::buffer complianceSuspensionReason_value;
|
||||||
|
std::size_t complianceSuspensionReason_size;
|
||||||
|
bool complianceSuspensionReason_null;
|
||||||
|
|
||||||
|
// complianceTerminationReason
|
||||||
|
//
|
||||||
|
details::buffer complianceTerminationReason_value;
|
||||||
|
std::size_t complianceTerminationReason_size;
|
||||||
|
bool complianceTerminationReason_null;
|
||||||
|
|
||||||
|
// policySuspensionReason
|
||||||
|
//
|
||||||
|
details::buffer policySuspensionReason_value;
|
||||||
|
std::size_t policySuspensionReason_size;
|
||||||
|
bool policySuspensionReason_null;
|
||||||
|
|
||||||
|
// policyTerminationReason
|
||||||
|
//
|
||||||
|
details::buffer policyTerminationReason_value;
|
||||||
|
std::size_t policyTerminationReason_size;
|
||||||
|
bool policyTerminationReason_null;
|
||||||
|
|
||||||
|
// cancelationReason
|
||||||
|
//
|
||||||
|
details::buffer cancelationReason_value;
|
||||||
|
std::size_t cancelationReason_size;
|
||||||
|
bool cancelationReason_null;
|
||||||
|
|
||||||
|
// failureReason
|
||||||
|
//
|
||||||
|
details::buffer failureReason_value;
|
||||||
|
std::size_t failureReason_size;
|
||||||
|
bool failureReason_null;
|
||||||
|
|
||||||
|
// details
|
||||||
|
//
|
||||||
|
details::buffer details_value;
|
||||||
|
std::size_t details_size;
|
||||||
|
bool details_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 (sqlite::bind*,
|
||||||
|
image_type&,
|
||||||
|
sqlite::statement_kind);
|
||||||
|
|
||||||
|
static void
|
||||||
|
bind (sqlite::bind*, id_image_type&);
|
||||||
|
|
||||||
|
static bool
|
||||||
|
init (image_type&,
|
||||||
|
const object_type&,
|
||||||
|
sqlite::statement_kind);
|
||||||
|
|
||||||
|
static void
|
||||||
|
init (object_type&,
|
||||||
|
const image_type&,
|
||||||
|
database*);
|
||||||
|
|
||||||
|
static void
|
||||||
|
init (id_image_type&, const id_type&);
|
||||||
|
|
||||||
|
typedef sqlite::object_statements<object_type> statements_type;
|
||||||
|
|
||||||
|
typedef sqlite::query_base query_base_type;
|
||||||
|
|
||||||
|
static const std::size_t column_count = 12UL;
|
||||||
|
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&);
|
||||||
|
|
||||||
|
public:
|
||||||
|
static bool
|
||||||
|
find_ (statements_type&,
|
||||||
|
const id_type*);
|
||||||
|
|
||||||
|
static void
|
||||||
|
load_ (statements_type&,
|
||||||
|
object_type&,
|
||||||
|
bool reload);
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class access::object_traits_impl< ::models::TripAttemptResult, id_common >:
|
||||||
|
public access::object_traits_impl< ::models::TripAttemptResult, id_sqlite >
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
// TripAttemptResult
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "TripAttemptResult-odb.ixx"
|
||||||
|
|
||||||
|
#include <odb/post.hxx>
|
||||||
|
|
||||||
|
#endif // TRIP_ATTEMPT_RESULT_ODB_HXX
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
// This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
// compiler for C++.
|
||||||
|
//
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// TripAttemptResult
|
||||||
|
//
|
||||||
|
|
||||||
|
inline
|
||||||
|
access::object_traits< ::models::TripAttemptResult >::id_type
|
||||||
|
access::object_traits< ::models::TripAttemptResult >::
|
||||||
|
id (const object_type& o)
|
||||||
|
{
|
||||||
|
return o.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
void access::object_traits< ::models::TripAttemptResult >::
|
||||||
|
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< ::models::TripAttemptResult >::
|
||||||
|
callback (database& db, const object_type& x, callback_event e)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (db);
|
||||||
|
ODB_POTENTIALLY_UNUSED (x);
|
||||||
|
ODB_POTENTIALLY_UNUSED (e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace odb
|
||||||
|
{
|
||||||
|
// TripAttemptResult
|
||||||
|
//
|
||||||
|
|
||||||
|
inline
|
||||||
|
void access::object_traits_impl< ::models::TripAttemptResult, id_sqlite >::
|
||||||
|
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< ::models::TripAttemptResult, id_sqlite >::
|
||||||
|
load_ (statements_type& sts,
|
||||||
|
object_type& obj,
|
||||||
|
bool)
|
||||||
|
{
|
||||||
|
ODB_POTENTIALLY_UNUSED (sts);
|
||||||
|
ODB_POTENTIALLY_UNUSED (obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
/* This file was generated by ODB, object-relational mapping (ORM)
|
||||||
|
* compiler for C++.
|
||||||
|
*/
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS "TripAttemptResult";
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS "schema_version" (
|
||||||
|
"name" TEXT NOT NULL PRIMARY KEY,
|
||||||
|
"version" INTEGER NOT NULL,
|
||||||
|
"migration" INTEGER NOT NULL);
|
||||||
|
|
||||||
|
DELETE FROM "schema_version"
|
||||||
|
WHERE "name" = '';
|
||||||
|
|
||||||
|
CREATE TABLE "TripAttemptResult" (
|
||||||
|
"id" TEXT NOT NULL PRIMARY KEY,
|
||||||
|
"result" TEXT NOT NULL,
|
||||||
|
"retryReason" TEXT NOT NULL,
|
||||||
|
"governmentSuspensionReason" TEXT NOT NULL,
|
||||||
|
"governmentTerminationReason" TEXT NOT NULL,
|
||||||
|
"complianceSuspensionReason" TEXT NOT NULL,
|
||||||
|
"complianceTerminationReason" TEXT NOT NULL,
|
||||||
|
"policySuspensionReason" TEXT NOT NULL,
|
||||||
|
"policyTerminationReason" TEXT NOT NULL,
|
||||||
|
"cancelationReason" TEXT NOT NULL,
|
||||||
|
"failureReason" TEXT NOT NULL,
|
||||||
|
"details" TEXT NOT NULL);
|
||||||
|
|
||||||
|
INSERT OR IGNORE INTO "schema_version" (
|
||||||
|
"name", "version", "migration")
|
||||||
|
VALUES ('', 1, 0);
|
||||||
|
|
||||||
Reference in New Issue
Block a user