|
- #pragma once
-
-
-
- namespace cpphibernate {
- namespace mariadb {
-
- /**
- * @brief Field that represents a foreign table.
- */
- template<typename T_field>
- struct field_foreign_table_t
- : public field_simple_t<T_field>
- {
- private:
- using base_type = field_simple_t<T_field>;
-
- public:
- /**
- * @brief Value constructor. Creates a mariadb field from the cpphibernate field.
- *
- * @param[in] p_owner Owner of the field.
- * @param[in] p_schema Cpphibernate schema the mariadb field belongs to.
- * @param[in] p_table Cpphibernate table the mariadb field belongs to.
- * @param[in] p_field Cpphibernate field to create mariadb field for.
- */
- template<
- typename T_schema,
- typename T_table>
- inline field_foreign_table_t(
- const table_t& p_owner,
- const T_schema& p_schema,
- const T_table& p_table,
- const T_field& p_field);
-
- public:
- /**
- * @brief Execute a create/update operation on the foreign table this field represents (if it is a foreign field)
- *
- * @param[in] context Create/Update context with the needed data for the operation.
- *
- * @return Key of the created/updated foreign dataset.
- */
- inline value_t foreign_create_update(const create_update_context& context) const override;
-
- /**
- * @brief Create a read context for the foreign key field.
- *
- * @param[in] context Read context to inherit new context from.
- * @param[in] create_fake Create a fake context (not data will be written).
- *
- * @return The created read context.
- */
- inline read_context_ptr_u foreign_read(const read_context& context, bool create_fake) const override;
- };
-
- } }
|