"Morse, Richard E." wrote:
> 
> Simon Oliver [mailto:[EMAIL PROTECTED]] wrote:
> 
> > This probably means that the ODBC driver does not support the function
> > (GetPrimaryKeys).
> 
> As you noted, a trace reveals that this function isn't supported.  If the driver
> doesn't support SQLPrimaryKeys, would the DBD::ODBC driver's ->primary_key that
> you noted above work?
I suspect it uses GetPrimaryKeys - so no!

> do have SQLSpecialColumns -- can I get primary key data from this call?
Don't know - try it :)

According to the M$ docs you need to pass an identifier type of
SQL_BEST_ROWID (==1):

"SQL_BEST_ROWID: Returns the optimal column or set of columns that, by
retrieving values from the column or columns, allows any row in the
specified table to be uniquely identified."

Sounds like a primary key, but it could be a unique index.  For example
you might have a table with fields (id, name, data) where both id and name
are unique - you could use id as the primary key and put a unique index or
constraint on the name to allow it to be used as an alternative pk in
foreign keys.

An alternative is DBD::ADO.  The latest version has the primary_key()
method.  With DBD::ADO you can use the Jet OLEDB driver instead of ODBC
which should give you better performance and finer control.

--
  Simon Oliver
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to