Attached is a patch for DBI which defines the column_info
interface.

Steffen
*** DBI-1.20/DBI.pm     Sat Aug 25 01:33:52 2001
--- DBI.pm      Sat Oct 20 19:19:07 2001
***************
*** 296,301 ****
--- 296,302 ----
  
        tables          => { U =>[1,6,'$catalog, $schema, $table, $type [, \%attr ]' ] 
},
        table_info      => { U =>[1,6,'$catalog, $schema, $table, $type [, \%attr ]' ] 
},
+       column_info     => { U =>[1,6,'$catalog, $schema, $table, $column [, \%attr ]' 
+] },
        primary_key_info=> { U =>[4,5,'$catalog, $schema, $table [, \%attr ]' ] },
        primary_key     => { U =>[4,5,'$catalog, $schema, $table [, \%attr ]' ] },
        type_info_all   => { U =>[1,1] },
***************
*** 1068,1073 ****
--- 1069,1078 ----
        shift->_not_impl('table_info');
      }
  
+     sub column_info {
+       shift->_not_impl('column_info');
+     }
+ 
      sub primary_key_info {
        shift->_not_impl('primary_key_info');
      }
***************
*** 2719,2724 ****
--- 2724,2850 ----
  be part of the Data Access SDK.
  
  See also page 306 of the (very large) SQL/CLI specification:
+ 
+   
+http://www.jtc1sc32.org/sc32/jtc1sc32.nsf/Attachments/DF86E81BE70151D58525699800643F56/$FILE/32N0595T.PDF
+ 
+ 
+ =item C<column_info> I<NEW>
+ 
+ B<Warning:> This method is experimental and may change.
+ 
+   $sth = $dbh->column_info( $catalog, $schema, $table, $column );
+ 
+ Returns an active statement handle that can be used to fetch
+ information about columns in specified tables.
+ 
+ The arguments $schema, $table and $column may accept search patterns
+ according to the database/driver, for example: $table = '%FOO%';
+ 
+ Note: The support for the selection criteria is driver specific. If the
+ driver doesn't support one or more of them then you may get back more
+ than you asked for and can do the filtering yourself.
+ 
+ The statement handle returned has at least the following fields in the
+ order shown below. Other fields, after these, may also be present.
+ 
+ B<TABLE_CAT>: The catalog identifier.
+ This field is NULL (C<undef>) if not applicable to the data source,
+ which is often the case.  This field is empty if not applicable to the
+ table.
+ 
+ B<TABLE_SCHEM>: The schema identifier.
+ This field is NULL (C<undef>) if not applicable to the data source,
+ and empty if not applicable to the table.
+ 
+ B<TABLE_NAME>: The table identifier.
+ Note: A driver may provide column metadata not only for base tables, but
+ also for derived objects like SYNONYMS etc.
+ 
+ B<COLUMN_NAME>: The column identifier.
+ 
+ B<DATA_TYPE>: The concise data type code.
+ 
+ B<TYPE_NAME>: A data source dependent data type name.
+ 
+ B<COLUMN_SIZE>: The column size.
+ This is the maximum length in characters for character data types,
+ the number of digits or bits for numeric data types or the length
+ in the representation of temporal types.
+ See the relevant specifications for detailed information.
+ 
+ B<BUFFER_LENGTH>: The length in bytes of transferred data.
+ 
+ B<DECIMAL_DIGITS>: The total number of significant digits to the right of
+ the decimal point.
+ 
+ B<NUM_PREC_RADIX>: The radix for numeric precision.
+ The value is 10 or 2 for numeric data types and NULL (C<undef>) if not
+ applicable.
+ 
+ B<NULLABLE>: Indicates if a column can accept NULLs.
+ The following codes are defined:
+ 
+   SQL_NO_NULLS          0
+   SQL_NULLABLE          1
+   SQL_NULLABLE_UNKNOWN  2
+ 
+ B<REMARKS>: A description of the column.
+ 
+ B<COLUMN_DEF>: The default value of the column.
+ 
+ B<SQL_DATA_TYPE>: The SQL data type.
+ 
+ B<SQL_DATETIME_SUB>: The subtype code for datetime and interval data types.
+ 
+ B<CHAR_OCTET_LENGTH>: The maximum length in bytes of a character or binary
+ data type column.
+ 
+ B<ORDINAL_POSITION>: The column sequence number (starting with 1).
+ 
+ B<IS_NULLABLE>: Indicates if the column can accept NULLs.
+ Possible values are: 'NO', 'YES' and ''.
+ 
+ SQL/CLI defines the following additional columns:
+ 
+   CHAR_SET_CAT
+   CHAR_SET_SCHEM
+   CHAR_SET_NAME
+   COLLATION_CAT
+   COLLATION_SCHEM
+   COLLATION_NAME
+   UDT_CAT
+   UDT_SCHEM
+   UDT_NAME
+   DOMAIN_CAT
+   DOMAIN_SCHEM
+   DOMAIN_NAME
+   SCOPE_CAT
+   SCOPE_SCHEM
+   SCOPE_NAME
+   MAX_CARDINALITY
+   DTD_IDENTIFIER
+   IS_SELF_REF
+ 
+ The result set is ordered by TABLE_CAT, TABLE_SCHEM, TABLE_NAME
+ and ORDINAL_POSITION.
+ 
+ Note: There is some overlap with statement attributes (in perl) and
+ SQLDescribeCol (in ODBC). However, SQLColumns provides more metadata.
+ 
+ For more detailed information about the fields and their meanings,
+ you can refer to:
+ 
+   http://msdn.microsoft.com/library/en-us/odbc/htm/odbcsqlcolumns.asp
+ 
+ If that URL ceases to work then use the MSDN search facility at:
+ 
+   http://search.microsoft.com/us/dev/
+ 
+ and search for C<SQLColumns returns> using the exact phrase option.
+ The link you want will probably just be called C<SQLColumns> and will
+ be part of the Data Access SDK.
+ 
+ See also page 135 of the current SQL/CLI Working Draft:
  
    
http://www.jtc1sc32.org/sc32/jtc1sc32.nsf/Attachments/DF86E81BE70151D58525699800643F56/$FILE/32N0595T.PDF
  

Reply via email to