Database Toolbox | ![]() ![]() |
Sets preferences for database actions for handling NULL
values
Syntax
setdbprefs setdbprefs('property
') setdbprefs('property
', 'value
') setdbprefs({'property1
'; ... ;'propertyn
'},
{'value1
'; ... ;
'
valuen
'}
)
Description
setdbprefs
returns the current values for database action preferences.
setdbprefs('
returns the current preference value for the specified property
')
property
.
setdbprefs('
sets the preference to property
', 'value
')
value
for the specified property
.
setdbprefs({'
sets the preference values to property1
'; ... ;'propertyn
'},
{'value1
'; ... ;
'valuen
'}
)
value1
through valuen
for the properties property1
through propertyn
.
Allowable properties are listed in the following table.
Example 1 - setdbprefs
Type setdbprefs and MATLAB returns
NullNumberRead: 'NaN' NullNumberWrite: 'NaN' NullStringRead: 'null' NullStringWrite: 'null'
NULL
number in the database is read into MATLAB as NaN
NaN
number in MATLAB is exported to the database as a NULL
numberNULL
string in the database is read into MATLAB as 'null'
'null'
string in MATLAB is exported to the database as a NULL
stringExample 2 - setdbprefs(property)
Type setdbprefs ('NullNumberRead') and MATLAB returns
NullNumberRead: '0'
which means any NULL
number in the database is read into MATLAB as 0
.
Example 3 - setdbprefs(property, value)
Type setdbprefs ('NullStringWrite','NaN')
which means that any 'NaN'
string in MATLAB is exported to the database as a NULL
string.
Example 4 - setdbprefs({'property1'; ... ;'propertyn'}, ... {'value1';'valuen'})
setdbprefs({'NullStringRead';'NullStringWrite';...
'NullNumberRead';'NullNumberWrite'},{'null';'null';'NaN';'NaN'})
NULL
string in the database is read into MATLAB as 'null'
'null'
string in MATLAB is exported to the database as a NULL
stringNULL
number in the database is read into MATLAB as NaN
NaN
number in MATLAB is exported to the database as a NULL
number![]() | set | sql2native | ![]() |