On Sun, Jun 09, 2002 at 06:35:34PM -0400, Pradeep Padala wrote:
> > Feel free to implement other DBI functions that I've not implemented
> > yet.
> 
> I was trying to implement get_info, column_info, foreign_key_info. Some of
> my notes/doubts below.
> 
> get_info:
>       I couldn't find a proper stored procedure or function to get
>         all the infotypes SQL/CLI defines. sp_server_info returns DBMS_NAME,
>       DBMS_VER and some more. Should we use that? The values contain
> 
>       DBMS_NAME = "SQL Server"
>       DBMS_VER = "SQL Server/11.9/P/Sun_svr4/OS 5.5.1/1/OPT/Mon Feb 10
> 00:01:37 PDT 1998"
> 
>       Are these the values expected by DBI?

The format of DBMS_VER is wrong.

The way to do this is get the best ODBC driver for Postgress and
use DBD::ODBC and the DBI to write this code for you! Like this:

  perl -MDBI::DBD -e write_getinfo_pm dbi:ODBC:pgdb user pass > lib/DBD/Pg/GetInfo.pm

You can thank Steffen Goeldner for that :)


> column_info:
>       sp_columns gives all the columns DBI defines. But there are two
>       extra columns.
>       sp_columns returns a record set with the following columns
> 
>       type_qualifier
>       table_owner
>       table_name
>       column_name
>       data_type
>       type_name
>       precision
>       length
>       scale
>       radix
>       nullable
>       remarks
> ----> ss_data_type
> ----> colid
>       column_def
>       sql_data_type
>       sql_datetime_sub
>       char_octet_length
>       ordinal_position
>       is_nullable
> 
> foreign_key_info
>       sp_fkeys returns all the columns defined by DBI except the last
>         three
> 
>       FK_NAME
>         PK_NAME
>         DEFERRABILITY
> 
> I am not quite sure how to solve above problems. Should we write a select
> statement which can give the record set DBI expects?

The best way to do this is generally to trace what SQL statements
the ODBC driver for your database is doing - then do the same.

Tim.

Reply via email to