Navigation Menu

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

Error selecting fields with same name from different tables [DNET257] #266

Closed
firebird-automations opened this issue Jul 16, 2009 · 1 comment

Comments

@firebird-automations
Copy link

Submitted by: pablo santos (psantosl)

On FbDataReader.cs, line ~377:
for (int i = 0; i < this.fields.Count; i++)
{
columnsIndexes.Add(this.fields[i].Alias.ToUpper(), i);
}

The error shows up when trying to run a sql like:
select table1.field, table2.field

On such cases fields[i].Alias is "field" for both items. This causes
the dictionary columnsIndexes to throw the "duplicate key" error.

Maybe a solution is to concatenate Alias and Relation?
columnsIndexes.Add(this.fields[i].Relation.ToUpper()
+"."+this.fields[i].Alias.ToUpper(), i);

As a side note, ToUpper() can be removed if columnsIndexes is
instantiated using StringComparer.CurrentCultureIgnoreCase.

Commits: 3e1861e

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 2.5.1 [ 10360 ]

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