Tim Bunce wrote:
>
> Steffen (and anyone else interested),
>
> I think we need to mention SQL_ATTR_METADATA_ID in the DBI docs
> somewhere (even though we don't include an API for it) because we're
> assuming that (for ODBC drivers) it has a certain value.
>
> Also, I think we need to document the differences, where there are
> any, between passing
>
> undef
> ""
> "%"
>
> to the various meta data methods.
Attached is a short explanation of this topic.
Tell me if some text passages should be extended.
Steffen
*** DBI-1.21-orig/DBI.pm Thu Feb 07 04:15:50 2002
--- DBI.pm Sat Mar 09 23:32:09 2002
***************
*** 4462,4467 ****
--- 4462,4515 ----
=head1 FURTHER INFORMATION
+ =head2 Catalog Functions
+
+ An application can retrieve metadata information from the DBMS by issuing
+ appropriate queries on the views of the Information Schema. Unfortunately,
+ C<INFORMATION_SCHEMA> views are seldom supported by the DBMS.
+ Special functions (catalog functions) are available to return result sets
+ for a small but important portion of that metadata:
+
+ column_info
+ foreign_key_info
+ primary_key_info
+ table_info
+
+ All catalog functions accept arguments in order to restrict the result sets.
+ Passing C<undef> to an optional argument does not constrain the search for
+ that argument. However, an empty string ('') is treated as a regular search
+ criteria.
+
+ B<Caveat>: Some DBMS store empty strings as C<NULL>. Neither C<undef> nor
+ an empty string ('') may match these records!
+
+ Most arguments in the catalog functions accept only B<ordinary values>, e.g.
+ the arguments of C<primary_key_info()>.
+ Such arguments are treated as a literal string, i.e. the case is significant
+ and quote characters are taken literally.
+
+ Some arguments in the catalog functions accept B<search patterns> (strings
+ containing '_' and/or '%'), e.g. the C<$table> argument of C<column_info()>.
+ Passing '%' is equivalent to leaving the argument C<undef>.
+
+ B<Caveat>: The pattern '%' has a special meaning for C<table_info()>.
+
+ B<Caveat>: The underscore ('_') is valid and often used in SQL identifiers.
+ Passing such a value to a search pattern argument may return more rows than
+ expected!
+
+ One argument in the catalog functions accepts a B<list of values>:
+ the C<$type> argument of C<table_info()>.
+
+ The ODBC and SQL/CLI specifications define a way to change the default
+ behavior described above: All arguments (except list value arguments) are
+ treated as identifier if the C<SQL_ATTR_METADATA_ID> attribute is set to
+ C<SQL_TRUE>.
+ The DBI (currently) does not support the C<SQL_ATTR_METADATA_ID> attribute,
+ i.e. it behaves like an ODBC driver where C<SQL_ATTR_METADATA_ID> is set to
+ C<SQL_FALSE>.
+
+
=head2 Transactions
Transactions are a fundamental part of any robust database system. They