From 76d62bbc5758041f412ec9b81176cc4e2aefe589 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 --- src/object-store/object_store.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/object-store/object_store.cpp b/src/object-store/object_store.cpp index af05f47c..0bc585d9 100644 --- a/src/object-store/object_store.cpp +++ b/src/object-store/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) { @@ -516,6 +522,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."; @@ -526,6 +535,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) :