Skip to content

Commit

Permalink
Merge pull request #2602 from realm/tg-0.96.0
Browse files Browse the repository at this point in the history
0.96.0
  • Loading branch information
tgoyne committed Oct 14, 2015
2 parents ef46eb8 + 737fb54 commit 6f74b3a
Show file tree
Hide file tree
Showing 57 changed files with 3,082 additions and 686 deletions.
25 changes: 23 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
x.x.x Release notes (yyyy-MM-dd)
0.96.0 Release notes (2015-10-14)
=============================================================

* No functional changes since beta2.

0.96.0-beta2 Release notes (2015-10-08)
=============================================================

### Bugfixes

* Add RLMOptionalBase.h to the podspec.

0.96.0-beta Release notes (2015-10-07)
=============================================================

### API breaking changes
Expand All @@ -20,10 +32,19 @@ x.x.x Release notes (yyyy-MM-dd)
the disk is out of space.
* Added `isEmpty` property on `RLMRealm`/`Realm` to indicate if it contains any
objects.
* The `@count`, `@min`, `@max`, `@sum` and `@avg` collection operators are now
supported in queries

### Bugfixes

* None.
* Fix assertion failure when inserting NSData between 8MB and 16MB in size.
* Fix assertion failure when rolling back a migration which removed an object
link or `RLMArray`/`List` property.
* Add the path of the file being opened to file open errors.
* Fix a crash that could be triggered by rapidly opening and closing a Realm
many times on multiple threads at once.
* Fix several places where exception messages included the name of the wrong
function which failed.

0.95.3 Release notes (2015-10-05)
=============================================================
Expand Down
1 change: 1 addition & 0 deletions Realm.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Pod::Spec.new do |s|
'include/Realm/RLMObject.h',
'include/Realm/RLMObjectBase.h',
'include/Realm/RLMObjectSchema.h',
'include/Realm/RLMOptionalBase.h',
'include/Realm/RLMPlatform.h',
'include/Realm/RLMProperty.h',
'include/Realm/RLMRealm.h',
Expand Down
20 changes: 20 additions & 0 deletions Realm.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,14 @@
A05AEB711B6A9B0E00072027 /* RLMObjectBase_Dynamic.h in Headers */ = {isa = PBXBuildFile; fileRef = A05FA61E1B62C3900000C9B2 /* RLMObjectBase_Dynamic.h */; settings = {ATTRIBUTES = (Public, ); }; };
A05AEB721B6A9B0F00072027 /* RLMObjectBase_Dynamic.h in Headers */ = {isa = PBXBuildFile; fileRef = A05FA61E1B62C3900000C9B2 /* RLMObjectBase_Dynamic.h */; settings = {ATTRIBUTES = (Public, ); }; };
A0CCA0BF1B7C0B4A000B6B0F /* RLMObjectBase_Dynamic.h in Headers */ = {isa = PBXBuildFile; fileRef = A05FA61E1B62C3900000C9B2 /* RLMObjectBase_Dynamic.h */; settings = {ATTRIBUTES = (Public, ); }; };
C0004BED1B8E4FCF00304BF3 /* RLMOptionalBase.h in Headers */ = {isa = PBXBuildFile; fileRef = C0004BEB1B8E4FCF00304BF3 /* RLMOptionalBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
C0004BEE1B8E4FCF00304BF3 /* RLMOptionalBase.h in Headers */ = {isa = PBXBuildFile; fileRef = C0004BEB1B8E4FCF00304BF3 /* RLMOptionalBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
C0004BEF1B8E4FCF00304BF3 /* RLMOptionalBase.h in Headers */ = {isa = PBXBuildFile; fileRef = C0004BEB1B8E4FCF00304BF3 /* RLMOptionalBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
C0004BF01B8E4FCF00304BF3 /* RLMOptionalBase.h in Headers */ = {isa = PBXBuildFile; fileRef = C0004BEB1B8E4FCF00304BF3 /* RLMOptionalBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
C0004BF11B8E4FCF00304BF3 /* RLMOptionalBase.mm in Sources */ = {isa = PBXBuildFile; fileRef = C0004BEC1B8E4FCF00304BF3 /* RLMOptionalBase.mm */; };
C0004BF21B8E4FCF00304BF3 /* RLMOptionalBase.mm in Sources */ = {isa = PBXBuildFile; fileRef = C0004BEC1B8E4FCF00304BF3 /* RLMOptionalBase.mm */; };
C0004BF31B8E4FCF00304BF3 /* RLMOptionalBase.mm in Sources */ = {isa = PBXBuildFile; fileRef = C0004BEC1B8E4FCF00304BF3 /* RLMOptionalBase.mm */; };
C0004BF41B8E4FCF00304BF3 /* RLMOptionalBase.mm in Sources */ = {isa = PBXBuildFile; fileRef = C0004BEC1B8E4FCF00304BF3 /* RLMOptionalBase.mm */; };
C02E53E11B7A7E2B002586E8 /* RLMRealmConfiguration.mm in Sources */ = {isa = PBXBuildFile; fileRef = C0D2DD061B6BDEA1004E8919 /* RLMRealmConfiguration.mm */; };
C02E53E21B7A7E2B002586E8 /* RLMRealmConfiguration.mm in Sources */ = {isa = PBXBuildFile; fileRef = C0D2DD061B6BDEA1004E8919 /* RLMRealmConfiguration.mm */; };
C02E53E31B7A7E2C002586E8 /* RLMRealmConfiguration.mm in Sources */ = {isa = PBXBuildFile; fileRef = C0D2DD061B6BDEA1004E8919 /* RLMRealmConfiguration.mm */; };
Expand Down Expand Up @@ -643,6 +651,8 @@
3FEC4A3D1BBB188B00F009C3 /* SwiftSchemaTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SwiftSchemaTests.swift; path = SwiftSchemaTests.swift; sourceTree = "<group>"; };
5D30B74A1B42039F00D90C5A /* RLMDefines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RLMDefines.h; sourceTree = "<group>"; };
A05FA61E1B62C3900000C9B2 /* RLMObjectBase_Dynamic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RLMObjectBase_Dynamic.h; sourceTree = "<group>"; };
C0004BEB1B8E4FCF00304BF3 /* RLMOptionalBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMOptionalBase.h; sourceTree = "<group>"; };
C0004BEC1B8E4FCF00304BF3 /* RLMOptionalBase.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RLMOptionalBase.mm; sourceTree = "<group>"; };
C042A48C1B7522A900771ED2 /* RealmConfigurationTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RealmConfigurationTests.mm; sourceTree = "<group>"; };
C073E1201AE9B705002C0A30 /* RLMObject_Private.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = RLMObject_Private.hpp; sourceTree = "<group>"; };
C0D2DD051B6BDEA1004E8919 /* RLMRealmConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RLMRealmConfiguration.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -939,6 +949,8 @@
E81A1F741955FC9300FDED82 /* RLMObjectStore.mm */,
3F0F02AC1B6FFF3D0046A4D5 /* RLMObservation.hpp */,
3F0F02AD1B6FFF3D0046A4D5 /* RLMObservation.mm */,
C0004BEB1B8E4FCF00304BF3 /* RLMOptionalBase.h */,
C0004BEC1B8E4FCF00304BF3 /* RLMOptionalBase.mm */,
3F68BFCD1B558CA800D50FBD /* RLMPrefix.h */,
E81A1F761955FC9300FDED82 /* RLMProperty.h */,
E81A1F771955FC9300FDED82 /* RLMProperty.mm */,
Expand Down Expand Up @@ -1034,6 +1046,7 @@
144C2F741B3D3539005C8F81 /* RLMObjectSchema_Private.hpp in Headers */,
144C2F6C1B3D3529005C8F81 /* RLMObjectStore.h in Headers */,
C06C74031B797EF10027FF85 /* RLMObservation.hpp in Headers */,
C0004BF01B8E4FCF00304BF3 /* RLMOptionalBase.h in Headers */,
144C2F5A1B3D3516005C8F81 /* RLMPlatform.h in Headers */,
144C2F631B3D3517005C8F81 /* RLMProperty.h in Headers */,
144C2F6D1B3D3529005C8F81 /* RLMProperty_Private.h in Headers */,
Expand Down Expand Up @@ -1082,6 +1095,7 @@
29E3C7261A71C1C700B62C1D /* RLMObjectSchema_Private.hpp in Headers */,
29EDB8DA1A7703C500458D80 /* RLMObjectStore.h in Headers */,
3F0F02B01B6FFF3D0046A4D5 /* RLMObservation.hpp in Headers */,
C0004BEF1B8E4FCF00304BF3 /* RLMOptionalBase.h in Headers */,
29E3C7271A71C1C700B62C1D /* RLMPlatform.h in Headers */,
29E3C72E1A71C1C700B62C1D /* RLMProperty.h in Headers */,
29E3C72F1A71C1C700B62C1D /* RLMProperty_Private.h in Headers */,
Expand Down Expand Up @@ -1130,6 +1144,7 @@
E856D1FF1956154C00FB2FCF /* RLMObjectSchema_Private.hpp in Headers */,
29EDB8D91A7703C500458D80 /* RLMObjectStore.h in Headers */,
3F0F02AF1B6FFF3D0046A4D5 /* RLMObservation.hpp in Headers */,
C0004BEE1B8E4FCF00304BF3 /* RLMOptionalBase.h in Headers */,
024E6094198B2D51002FA042 /* RLMPlatform.h in Headers */,
E856D2051956154C00FB2FCF /* RLMProperty.h in Headers */,
E856D2041956154C00FB2FCF /* RLMProperty_Private.h in Headers */,
Expand Down Expand Up @@ -1178,6 +1193,7 @@
E81A1F991955FC9300FDED82 /* RLMObjectSchema_Private.hpp in Headers */,
29EDB8D81A7703C500458D80 /* RLMObjectStore.h in Headers */,
3F0F02AE1B6FFF3D0046A4D5 /* RLMObservation.hpp in Headers */,
C0004BED1B8E4FCF00304BF3 /* RLMOptionalBase.h in Headers */,
024E6097198B2D59002FA042 /* RLMPlatform.h in Headers */,
E81A1FA11955FC9300FDED82 /* RLMProperty.h in Headers */,
E81A1FA01955FC9300FDED82 /* RLMProperty_Private.h in Headers */,
Expand Down Expand Up @@ -1655,6 +1671,7 @@
144C2F4E1B3D34A2005C8F81 /* RLMObjectSchema.mm in Sources */,
144C2F4F1B3D34A2005C8F81 /* RLMObjectStore.mm in Sources */,
C06C74021B797EEF0027FF85 /* RLMObservation.mm in Sources */,
C0004BF41B8E4FCF00304BF3 /* RLMOptionalBase.mm in Sources */,
144C2F501B3D34A2005C8F81 /* RLMProperty.mm in Sources */,
144C2F511B3D34A2005C8F81 /* RLMQueryUtil.mm in Sources */,
144C2F521B3D34A2005C8F81 /* RLMRealm.mm in Sources */,
Expand Down Expand Up @@ -1687,6 +1704,7 @@
29E3C70E1A71C1C700B62C1D /* RLMObjectSchema.mm in Sources */,
29E3C70F1A71C1C700B62C1D /* RLMObjectStore.mm in Sources */,
3F0F02B31B6FFF3D0046A4D5 /* RLMObservation.mm in Sources */,
C0004BF31B8E4FCF00304BF3 /* RLMOptionalBase.mm in Sources */,
29E3C7101A71C1C700B62C1D /* RLMProperty.mm in Sources */,
29E3C7111A71C1C700B62C1D /* RLMQueryUtil.mm in Sources */,
29E3C7121A71C1C700B62C1D /* RLMRealm.mm in Sources */,
Expand Down Expand Up @@ -1760,6 +1778,7 @@
E856D2011956154C00FB2FCF /* RLMObjectSchema.mm in Sources */,
E856D2031956154C00FB2FCF /* RLMObjectStore.mm in Sources */,
3F0F02B21B6FFF3D0046A4D5 /* RLMObservation.mm in Sources */,
C0004BF21B8E4FCF00304BF3 /* RLMOptionalBase.mm in Sources */,
E856D2061956154C00FB2FCF /* RLMProperty.mm in Sources */,
E856D2081956154C00FB2FCF /* RLMQueryUtil.mm in Sources */,
E856D20B1956154C00FB2FCF /* RLMRealm.mm in Sources */,
Expand Down Expand Up @@ -1835,6 +1854,7 @@
E81A1F9B1955FC9300FDED82 /* RLMObjectSchema.mm in Sources */,
E81A1F9E1955FC9300FDED82 /* RLMObjectStore.mm in Sources */,
3F0F02B11B6FFF3D0046A4D5 /* RLMObservation.mm in Sources */,
C0004BF11B8E4FCF00304BF3 /* RLMOptionalBase.mm in Sources */,
E81A1FA21955FC9300FDED82 /* RLMProperty.mm in Sources */,
E81A1FA51955FC9300FDED82 /* RLMQueryUtil.mm in Sources */,
E81A1FA91955FC9300FDED82 /* RLMRealm.mm in Sources */,
Expand Down
4 changes: 0 additions & 4 deletions Realm/ObjectStore/object_schema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,7 @@ ObjectSchema::ObjectSchema(Group *group, const std::string &name) : name(name) {
property.type = (PropertyType)table->get_column_type(col);
property.is_indexed = table->has_search_index(col);
property.is_primary = false;
#ifdef REALM_ENABLE_NULL
property.is_nullable = table->is_nullable(col) || property.type == PropertyTypeObject;
#else
property.is_nullable = property.type == PropertyTypeObject;
#endif
property.table_column = col;
if (property.type == PropertyTypeObject || property.type == PropertyTypeArray) {
// set link type for objects and arrays
Expand Down
62 changes: 23 additions & 39 deletions Realm/ObjectStore/object_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,6 @@
using namespace realm;
using namespace std;

template <typename T>
static inline
T get_value(TableRef table, size_t row, size_t column);

template <>
StringData get_value(TableRef table, size_t row, size_t column) {
return table->get_string(column, row);
}

static inline
void set_value(TableRef table, size_t row, size_t column, StringData value) {
table->set_string(column, row, value);
}

template <>
BinaryData get_value(TableRef table, size_t row, size_t column) {
return table->get_binary(column, row);
}

static inline
void set_value(TableRef table, size_t row, size_t column, BinaryData value) {
table->set_binary(column, row, value);
}

const char * const c_metadataTableName = "metadata";
const char * const c_versionColumnName = "version";
const size_t c_versionColumnIndex = 0;
Expand All @@ -70,10 +46,6 @@ const size_t c_object_table_prefix_length = c_object_table_prefix.length();

const uint64_t ObjectStore::NotVersioned = numeric_limits<uint64_t>::max();

bool ObjectStore::has_metadata_tables(Group *group) {
return group->get_table(c_primaryKeyTableName) && group->get_table(c_metadataTableName);
}

bool ObjectStore::create_metadata_tables(Group *group) {
bool changed = false;
TableRef table = group->get_or_add_table(c_primaryKeyTableName);
Expand Down Expand Up @@ -240,12 +212,13 @@ static bool property_can_be_migrated_to_nullable(Property &old_property, Propert
}

template <typename T>
static void copy_property_to_property(Property &old_property, Property &new_property, TableRef table) {
static void copy_property_values(Property const& old_property, Property const& new_property, Table& table,
T (Table::*getter)(std::size_t, std::size_t) const noexcept,
void (Table::*setter)(std::size_t, std::size_t, T)) {
size_t old_column = old_property.table_column, new_column = new_property.table_column;
size_t count = table->size();
size_t count = table.size();
for (size_t i = 0; i < count; i++) {
T old_value = get_value<T>(table, i, old_column);
set_value(table, i, new_column, old_value);
(table.*setter)(new_column, i, (table.*getter)(old_column, i));
}
}

Expand Down Expand Up @@ -289,24 +262,35 @@ bool ObjectStore::create_tables(Group *group, ObjectStore::Schema &target_schema
break;
}
default:
#ifdef REALM_ENABLE_NULL
target_prop.table_column = table->add_column(DataType(target_prop.type), target_prop.name, target_prop.is_nullable);
#else
target_prop.table_column = table->add_column(DataType(target_prop.type), target_prop.name);
#endif
break;
}

if (current_prop && property_can_be_migrated_to_nullable(*current_prop, target_prop)) {
switch (target_prop.type) {
case PropertyTypeString:
copy_property_to_property<StringData>(*current_prop, target_prop, table);
copy_property_values(*current_prop, target_prop, *table, &Table::get_string, &Table::set_string);
break;
case PropertyTypeData:
copy_property_to_property<BinaryData>(*current_prop, target_prop, table);
copy_property_values(*current_prop, target_prop, *table, &Table::get_binary, &Table::set_binary);
break;
case PropertyTypeBool:
copy_property_values(*current_prop, target_prop, *table, &Table::get_bool, &Table::set_bool);
break;
case PropertyTypeInt:
copy_property_values(*current_prop, target_prop, *table, &Table::get_int, &Table::set_int);
break;
case PropertyTypeFloat:
copy_property_values(*current_prop, target_prop, *table, &Table::get_float, &Table::set_float);
break;
case PropertyTypeDouble:
copy_property_values(*current_prop, target_prop, *table, &Table::get_double, &Table::set_double);
break;
case PropertyTypeDate:
copy_property_values(*current_prop, target_prop, *table, &Table::get_datetime, &Table::set_datetime);
break;
default:
REALM_UNREACHABLE();
break;
}
}

Expand Down
3 changes: 0 additions & 3 deletions Realm/ObjectStore/object_store.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ namespace realm {
// set a new schema version
static void set_schema_version(Group *group, uint64_t version);

// check if the realm already has all metadata tables
static bool has_metadata_tables(Group *group);

// create any metadata tables that don't already exist
// must be in write transaction to set
// returns true if it actually did anything
Expand Down
2 changes: 1 addition & 1 deletion Realm/RLMAccessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ FOUNDATION_EXTERN RLMProperty *RLMValidatedGetProperty(RLMObjectBase *obj, NSStr
FOUNDATION_EXTERN id __nullable RLMDynamicGet(RLMObjectBase *obj, RLMProperty *prop);

// by property/column
void RLMDynamicSet(RLMObjectBase *obj, RLMProperty *prop, id val, RLMCreationOptions options);
FOUNDATION_EXTERN void RLMDynamicSet(RLMObjectBase *obj, RLMProperty *prop, id val, RLMCreationOptions options);

//
// Class modification
Expand Down
Loading

0 comments on commit 6f74b3a

Please sign in to comment.