From f79dec9033aa7dcc87d66cab2039683bdf692261 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Thu, 3 Sep 2015 14:54:41 -0700 Subject: [PATCH] Allow more nullable property types when supported --- object_store.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/object_store.cpp b/object_store.cpp index 813b78b9..1493353f 100644 --- a/object_store.cpp +++ b/object_store.cpp @@ -198,6 +198,11 @@ std::vector ObjectStore::verify_object_schema(O } // check nullablity +#if REALM_NULL_STRINGS == 1 + if (current_prop.type == PropertyTypeArray && current_prop.is_nullable) { + exceptions.emplace_back(InvalidNullabilityException(table_schema.name, current_prop)); + } +#else if (current_prop.type == PropertyTypeObject) { if (!current_prop.is_nullable) { exceptions.emplace_back(InvalidNullabilityException(table_schema.name, current_prop)); @@ -208,6 +213,7 @@ std::vector ObjectStore::verify_object_schema(O exceptions.emplace_back(InvalidNullabilityException(table_schema.name, current_prop)); } } +#endif // check primary keys if (current_prop.is_primary) { @@ -515,6 +521,9 @@ MissingPropertyException::MissingPropertyException(std::string object_type, Prop InvalidNullabilityException::InvalidNullabilityException(std::string object_type, Property const& property) : ObjectSchemaPropertyException(object_type, property) { +#if REALM_NULL_STRINGS == 1 + m_what = "'Array' property '" + property.name + "' cannot be nullable"; +#else if (property.type == PropertyTypeObject) { if (!property.is_nullable) { m_what = "'Object' property '" + property.name + "' must be nullable."; @@ -525,6 +534,7 @@ InvalidNullabilityException::InvalidNullabilityException(std::string object_type m_what = "Only 'Object' property types are nullable"; } } +#endif } MissingObjectTypeException::MissingObjectTypeException(std::string object_type, Property const& property) :