FbConnection.GetSchema("Indexes") has wrong value in IS_UNIQUE column
---------------------------------------------------------------------
Key: DNET-354
URL: http://tracker.firebirdsql.org/browse/DNET-354
Project: .NET Data provider
Issue Type: Bug
Components: ADO.NET Provider
Affects Versions: 2.5.2
Reporter: Vladan Bato
Assignee: Jiri Cincura
Priority: Minor
The DataTable returned by FbConnection.GetSchema("Indexes") has wrong values in
the IS_UNIQUE column, due to a bug in the FbIndexes.ProcessResult method that
sets the IS_UNIQUE column to 0 (false) for all non-primary keys.
The bug is in the following code:
if (row["PRIMARY_KEY"] == DBNull.Value ||
Convert.ToInt32(row["PRIMARY_KEY"],
CultureInfo.InvariantCulture) != 0)
{
row["IS_PRIMARY"] = true;
}
else
{
row["IS_UNIQUE"] = false;
}
It mistakenly changes the IS_UNIQUE column to false when the index is not a
primary key.
Please note that there is already (in the previous lines) an "if" statement
that sets the IS_PRIMARY column, so I don't know what the purpose of this block
of code is. Maybe the intent was to set IS_UNIQUE to true for all primary keys
(but as far as I can see, rdb$indices.rdb$unique_flag is already set for
primary keys)?
This block of code should either be removed entirely or else changed to:
if (row["PRIMARY_KEY"] == DBNull.Value ||
Convert.ToInt32(row["PRIMARY_KEY"],
CultureInfo.InvariantCulture) != 0)
{
row["IS_UNIQUE"] = true;
}
--
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
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
Firebird-net-provider mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider