|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
GetSchemaTable w/join returns incorrect info -- MS Ole driver / OrGetSchemaTable() returns incomplete and erroneous information. For example, assume I have 2 tables: create table TBL_A ( ID number(10,0) not null, ATTR_1 number(10,0), ATTR_2 varchar2(50) ) ; -- Create/Recreate primary, unique and foreign key constraints alter table TBL_A add constraint PK_TBL_A primary key (ID); -- Create table create table TBL_B ( ID number(10,0) not null, ATTR_1 number(10,0), ATTR_2 varchar2(50), ATTR_3 varchar2(50), ATTR_4 varchar2(50) ) ; -- Create/Recreate primary, unique and foreign key constraints alter table TBL_B add constraint PK_TBL_B primary key (ID); ....and then I run the following code: OleDbConnection conn = new OleDbConnection("Provider=MSDAORA.1;Data source=..."); OleDbCommand cmd = conn.CreateCommand(); cmd.CommandText = "select A.*, B.* from TBL_A join TBL_B on A.ID = B.ID"; OleDbDataReader schemaReader = cmd.ExecuteReader(CommandBehavior.SchemaOnly | CommandBehavior.KeyInfo)); DataTable schemaTbl = schemaReader.GetSchemaTable();The schema table returns all the columns from TBL_A correctly, but ATTR_3 column from TBL _B is not returned, and other columns from TBL_B have wrong information for BaseTableName and BaseColumnName. Correct schema information is returned if I change the select statement to the functionally equivalent "select A.*, B.* from TBL_A, TBL_B where A.ID = B.ID". I don't like that syntax as well, and we already have a lot of sql written in the other format that I really don't want to rewrite. Other useful info... .Net Framework version 1.1. MDAC version 2.81.1117.0. I'm using Oracle client 9.2.0.1 against an Oracle 10g server. Note that the Oracle Ole Db Provider returns the correct column set but does not return key information correctly. |
|||||||||||||||||||||||