You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The result DataTable of the FbConnection.GetSchema("Columns") method sets the column "is_nullable" as follows:
If the database column itself is set to "not null" or if this column is part of the primary key, it returns is_nullable as correct value "1" resp. "true". If the database column is defined via domain and the domain is set to "not null", the column value "is_nullable" nevertheless returns incorrectly "1" resp. "true", but not the expected correct value "0" resp. "false".
Workaround: ..\source\FirebirdSql\Data\Schema\FbColumns.cs line 59
Use a clause like the following statement instead of line 59
(Sorry, I'm not fit with complex statements, you may find out a better one):
CASE
WHEN (rfr.rdb$field_source IS NULL) THEN rfr.rdb$null_flag
WHEN (rfr.rdb$field_source = '') THEN rfr.rdb$null_flag
WHEN (rfr.rdb$field_source STARTS With 'RDB$') THEN rfr.rdb$null_flag
WHEN (rfr.rdb$null_flag = '1') THEN rfr.rdb$null_flag
ELSE (SELECT flds.rdb$null_flag FROM rdb$fields flds WHERE rfr.rdb$field_source = flds.rdb$field_name)
END AS COLUMN_NULLABLE,
Test case:
create domain dom_int as int check(value > 0) not null
create domain dom_char as varchar(35)
create TABLE nullable_test (
id dom_int,
counter INT,
setting int not NULL,
content_1 Dom_char,
content_2 dom_char not null,
firstname varchar(35),
lastname varchar(35) not null
);
Columns 0, 2, 4, 6 must be "not null", 1, 3, 5 must "nullable".
Submitted by: Juergen Thomas (juetho)
The result DataTable of the FbConnection.GetSchema("Columns") method sets the column "is_nullable" as follows:
If the database column itself is set to "not null" or if this column is part of the primary key, it returns is_nullable as correct value "1" resp. "true". If the database column is defined via domain and the domain is set to "not null", the column value "is_nullable" nevertheless returns incorrectly "1" resp. "true", but not the expected correct value "0" resp. "false".
Workaround: ..\source\FirebirdSql\Data\Schema\FbColumns.cs line 59
Use a clause like the following statement instead of line 59
(Sorry, I'm not fit with complex statements, you may find out a better one):
CASE
WHEN (rfr.rdb$field_source IS NULL) THEN rfr.rdb$null_flag
WHEN (rfr.rdb$field_source = '') THEN rfr.rdb$null_flag
WHEN (rfr.rdb$field_source STARTS With 'RDB$') THEN rfr.rdb$null_flag
WHEN (rfr.rdb$null_flag = '1') THEN rfr.rdb$null_flag
ELSE (SELECT flds.rdb$null_flag FROM rdb$fields flds WHERE rfr.rdb$field_source = flds.rdb$field_name)
END AS COLUMN_NULLABLE,
Test case:
create domain dom_int as int check(value > 0) not null
create domain dom_char as varchar(35)
create TABLE nullable_test (
id dom_int,
counter INT,
setting int not NULL,
content_1 Dom_char,
content_2 dom_char not null,
firstname varchar(35),
lastname varchar(35) not null
);
Columns 0, 2, 4, 6 must be "not null", 1, 3, 5 must "nullable".
Commits: 4588b3d cec562f
The text was updated successfully, but these errors were encountered: