Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions +dj/Relvar.m
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,14 @@ function insert(self, tuples, command)
assert(header.attributes(attr_idx).isnullable, ...
'DataJoint:DataType:NotNullable', ...
'attribute `%s` is not nullable.', ...
header.attributes(attr_idx).name)
header.attributes(attr_idx).name);
placeholder = 'NULL';
value = [];
elseif header.attributes(attr_idx).isString
assert(dj.lib.isString(value), ...
'DataJoint:DataType:Mismatch', ...
'The field %s must be a character string', ...
header.attributes(attr_idx).name)
'The field `%s` must be a character string', ...
header.attributes(attr_idx).name);
placeholder = '"{S}"';
value = char(value);
elseif header.attributes(attr_idx).isUuid
Expand All @@ -240,6 +240,10 @@ function insert(self, tuples, command)
placeholder = '"{B}"';
value = uint8(decMtx);
elseif header.attributes(attr_idx).isBlob
assert(~issparse(value), ...
'DataJoint:DataType:Mismatch', ...
'Sparse matrix in blob field `%s` is currently not supported', ...
header.attributes(attr_idx).name);
if ~header.attributes(attr_idx).isExternal
placeholder = '"{M}"';
else
Expand All @@ -256,8 +260,8 @@ function insert(self, tuples, command)
assert((isnumeric(value) || islogical(value)) && (isscalar( ...
value) || isempty(value)),...
'DataJoint:DataType:Mismatch', ...
'The field %s must be a numeric scalar value', ...
header.attributes(attr_idx).name)
'The field `%s` must be a numeric scalar value', ...
header.attributes(attr_idx).name);
% empty numeric values and nans are passed as nulls
if isinf(value)
error 'Infinite values are not allowed in numeric fields'
Expand Down Expand Up @@ -417,6 +421,10 @@ function update(self, attrname, value)
valueStr = '"{S}"';
value = {char(value)};
case header.attributes(ix).isBlob
assert(~issparse(value), ...
'DataJoint:DataType:Mismatch', ...
'Sparse matrix in blob field `%s` is currently not supported', ...
attrname);
if isempty(value) && header.attributes(ix).isnullable
valueStr = 'NULL';
value = {};
Expand Down