support null for basic propety types

This commit is contained in:
Ari Lazier 2015-10-27 10:04:56 -07:00
parent dca7e7d791
commit faa1297d3b
1 changed files with 9 additions and 0 deletions

View File

@ -156,6 +156,11 @@ namespace realm {
} }
size_t column = property.table_column; size_t column = property.table_column;
if (property.is_nullable && Accessor::is_null(ctx, value)) {
m_row.set_null(column);
return;
}
switch (property.type) { switch (property.type) {
case PropertyTypeBool: case PropertyTypeBool:
m_row.set_bool(column, Accessor::to_bool(ctx, value)); m_row.set_bool(column, Accessor::to_bool(ctx, value));
@ -209,6 +214,10 @@ namespace realm {
using Accessor = NativeAccessor<ValueType, ContextType>; using Accessor = NativeAccessor<ValueType, ContextType>;
size_t column = property.table_column; size_t column = property.table_column;
if (property.is_nullable && m_row.is_null(column)) {
return Accessor::null_value(ctx);
}
switch (property.type) { switch (property.type) {
case PropertyTypeBool: case PropertyTypeBool:
return Accessor::from_bool(ctx, m_row.get_bool(column)); return Accessor::from_bool(ctx, m_row.get_bool(column));