Please see the DBD::ODBC POD about details for this "private function"
to get primary key metadata. An example is:

    #-- Note: $dbh->func and the last parameter identify the 'private'
    #-- functions that a specific DBD driver may provide.
    $sth = $dbh->func($DbName,    # Or catalog name
                      $Schema,    # Or owner name
                      $TableName,
                      'GetPrimaryKeys');

You can then use $sth to fetch the result set with any of the normal DBI
fetch methods (like processing result set for a SELECT SQL command).

In the ODBC API doc for Catalog or Metadata functions, the $DbName
parameter is also called "catalog name" and $Schema parameter called
the  "owner name". How these apply to your data source will vary.

Reviewing ODBC SDK doc/book may be necessary to get a more background on
these ODBC specific metadata functions.

Bill


Jason Wu wrote:
> 
> Hi All,
> 
> I try to use the DBD-ODBC GetPrimaryKeys function. But I don't understand what is
> the $Catalog, $Schema stands for ? And How do I use them ?
> 
> Please give me a hand.
> 
>     sub GetPrimaryKeys {
>                         my ($dbh, $Catalog, $Schema, $Table) = @_;
>                         # create a "blank" statement handle
>                         my $sth = DBI::_new_sth($dbh, { 'Statement' => 
>"SQLPrimaryKeys" });
>                         _GetPrimaryKeys($dbh, $sth, $Catalog, $Schema, $Table) or 
>return undef;
>                         $sth;
>     }
> 
------------------------------------------------------------------------
Bill Cowan, Vice President R&D, Metagenix, Inc.
[EMAIL PROTECTED], 919-490-0034 X-218, Fax: 919-490-0143
URL: http://www.metagenix.com/

Reply via email to