Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FbConnection.GetSchema("Columns") has wrong values concerning not-null columns. [DNET151] #164

Closed
firebird-automations opened this issue Jan 10, 2008 · 8 comments

Comments

@firebird-automations
Copy link

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

@firebird-automations
Copy link
Author

Modified by: @cincuranet

assignee: Carlos Guzman Alvarez [ carlosga_fb ] => Jiri Cincura [ cincura_net ]

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: Open [ 1 ] => In Progress [ 3 ]

@firebird-automations
Copy link
Author

Commented by: Juergen Thomas (juetho)

Sorry, I was disturbed by "not null" and "nullable". My workaround fails; but I'm sure you will create the right way.

Juergen

@firebird-automations
Copy link
Author

Commented by: @cincuranet

rev.478

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: In Progress [ 3 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 2.5.0 Alpha 2 [ 10240 ]

Fix Version: 2.5.0 [ 10170 ]

@firebird-automations
Copy link
Author

Modified by: @cincuranet

Component: Borland Data Provider [ 10080 ]

@firebird-automations
Copy link
Author

Modified by: @cincuranet

Fix Version: 2.5.0 [ 10170 ] =>

@firebird-automations
Copy link
Author

Modified by: @cincuranet

Component: Borland Data Provider [ 10080 ] =>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants