FbConnection.GetSchema("Columns") has wrong values concerning not-null columns.
-------------------------------------------------------------------------------
Key: DNET-151
URL: http://tracker.firebirdsql.org/browse/DNET-151
Project: .NET Data provider
Issue Type: Bug
Components: ADO.NET Provider
Affects Versions: 2.1.0
Environment: Windows XP SP2
Reporter: Juergen Thomas
Assignee: Carlos Guzman Alvarez
Priority: Trivial
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".
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Firebird-net-provider mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider