Hey folks, at the moment I really don't think this is possible but decided to throw it on here to see if there were any ideas.
Essentially, I would like a way to grab any 1) arbitrary table (that I have permissions to) in DBMS that I have an ODBC connection too; 2) A column in that table and determine 3) If there are repeated values in that column. and possibly even 4) find check constraints defined in the DDL for that column.
What I *don't* want to do is check for column uniqueness by doing a query for the column and check manually if there are repeated values by either
1) looping through to check for duplicates ( O(n^2) time )
2) Sorting the column and comparing adjacent values ( like O (n^2 log n) I think)
What I would like an consistent, generic, ODBC-ish (referring to the C API that is) way to extract the meta data for the column to determine if it was declared as Unique in the DDL (I know there could also be unique columns not declared in the DDL as well) which would tell me in constant O(1) time if it's unique regardless of the DBMS I'm using (that is, in ODBC and not though DBMS-specific data dictionary queries). I would also like more meta data (e.g. check constraints) that may have been DDL'd into the column/table, but I'd also be happy for uniqueness. (It did occur to me that I could check FK's to see what they refer to, which would be a candidate key)
I know about the INFORMATION_SCHEMA views in the ANSI Standard, but there are significant DBMS's that do not support (e.g. Oracle) so it's no good.
Again, I figure this is a dream, but who knows! Thanks!


LinkBack URL
About LinkBacks




Reply With Quote



Bookmarks
Algorithms and Data Structures
Java tutorials
Algorithms Forum