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") doesn't correctly identify array-columns [DNET182] #192

Closed
firebird-automations opened this issue Oct 8, 2008 · 7 comments

Comments

@firebird-automations
Copy link

Submitted by: jonas högström (jonas.hogstrom)

In the Employee database, there is a column in the JOB table declared as

LANGUAGE\_REQ VARCHAR\(15\) \[5\]

When loading the metadata of the database using FbConnection.GetSchema("Columns"), the last value of the collection is called "IS_ARRAY", but this value is incorrectly returned as false for the LANGUAGE_REQ column.

The reason turns out to be an invalid comparison in FirebirdSql.Data.Schema.FbColumns.ProcessResult:

            row\["IS\_ARRAY"\]     = \(row\["COLUMN\_ARRAY"\] == DBNull\.Value\);

should be:

            row\["IS\_ARRAY"\]     = \(row\["COLUMN\_ARRAY"\] \!= DBNull\.Value\);

Also, when looking at the values found in GetSchemaTable from a datareader;

        command\.CommandText = "SELECT LANGUAGE\_REQ FROM JOB";
        DbDataReader reader = command\.ExecuteReader\(\);
        DataTable dt = reader\.GetSchemaTable\(\);
        Type t = dt\.Rows\[0\]\["DataType"\]

the type returned is "System.Array", but the actual value from the query is a System.String[]

Commits: 4311892

@firebird-automations
Copy link
Author

Commented by: jonas högström (jonas.hogstrom)

I did some research and found the actual reason for the bug, so I updated the report...

@firebird-automations
Copy link
Author

Modified by: jonas högström (jonas.hogstrom)

description: In the Employee database, there is a column in the JOB table declared as

LANGUAGE\_REQ VARCHAR\(15\) \[5\]

When loading the metadata of the database using FbConnection.GetSchema("Columns"), the last value of the collection is called "IS_ARRAY", but this value is incorrectly returned as false for the LANGUAGE_REQ column. As far as I can see, there is nothing that indicates that the column is an array column, or how big the array is.

Also, when looking at the values found in GetSchemaTable from a datareader;

        command\.CommandText = "SELECT LANGUAGE\_REQ FROM JOB";
        DbDataReader reader = command\.ExecuteReader\(\);
        DataTable dt = reader\.GetSchemaTable\(\);
        Type t = dt\.Rows\[0\]\["DataType"\]

the type returned is "System.Array", but the actual value from the query is a System.String[]

=>

In the Employee database, there is a column in the JOB table declared as

LANGUAGE\_REQ VARCHAR\(15\) \[5\]

When loading the metadata of the database using FbConnection.GetSchema("Columns"), the last value of the collection is called "IS_ARRAY", but this value is incorrectly returned as false for the LANGUAGE_REQ column.

The reason turns out to be an invalid comparison in FirebirdSql.Data.Schema.FbColumns.ProcessResult:

            row\["IS\_ARRAY"\]     = \(row\["COLUMN\_ARRAY"\] == DBNull\.Value\);

should be:

            row\["IS\_ARRAY"\]     = \(row\["COLUMN\_ARRAY"\] \!= DBNull\.Value\);

Also, when looking at the values found in GetSchemaTable from a datareader;

        command\.CommandText = "SELECT LANGUAGE\_REQ FROM JOB";
        DbDataReader reader = command\.ExecuteReader\(\);
        DataTable dt = reader\.GetSchemaTable\(\);
        Type t = dt\.Rows\[0\]\["DataType"\]

the type returned is "System.Array", but the actual value from the query is a System.String[]

@firebird-automations
Copy link
Author

Modified by: jonas högström (jonas.hogstrom)

Version: 2.5.0 Alpha 2 [ 10240 ]

@firebird-automations
Copy link
Author

Modified by: @cincuranet

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

@firebird-automations
Copy link
Author

Commented by: @cincuranet

The == vs. != is fixed.

The datatype returned in SchemaTable is correct. System.String[] is an array of strings, and System.Array is just array of "unknown" type(s).

@firebird-automations
Copy link
Author

Modified by: @cincuranet

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

resolution: Fixed [ 1 ]

Fix Version: 2.5.0. Alpha 3 [ 10261 ]

Fix Version: 2.5.0 [ 10170 ]

@firebird-automations
Copy link
Author

Modified by: @cincuranet

Fix Version: 2.5.0 [ 10170 ] =>

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