Author: timbo
Date: Fri May 13 01:50:39 2005
New Revision: 1048
Modified:
dbi/trunk/Changes
dbi/trunk/DBI.pm
dbi/trunk/DBI.xs
Log:
Added $sth->{ParamTypes} specification thanks to Dean Arnold.
Modified: dbi/trunk/Changes
==============================================================================
--- dbi/trunk/Changes (original)
+++ dbi/trunk/Changes Fri May 13 01:50:39 2005
@@ -14,6 +14,7 @@ DBI::Changes - List of significant chang
Changed warning about multiple copies of Driver.xst found in @INC
to ignore duplicated directories thanks to Ed Avis.
+ Added $sth->{ParamTypes} specification thanks to Dean Arnold.
Added $h->{Callbacks} attribute to enable code hooks to be invoked
when certain methods are called. For example:
$dbh->{Callbacks}->{prepare} = sub { ... };
Modified: dbi/trunk/DBI.pm
==============================================================================
--- dbi/trunk/DBI.pm (original)
+++ dbi/trunk/DBI.pm Fri May 13 01:50:39 2005
@@ -6059,6 +6059,41 @@ where N is a sequence number starting at
The C<ParamValues> attribute was added in DBI 1.28.
+=item C<ParamTypes> (hash ref, read-only)
+
+Returns a reference to a hash containing the type information
+currently bound to placeholders. The keys of the hash are the
+'names' of the placeholders: either integers starting at 1, or,
+for drivers that support named placeholders, the actual parameter
+name string. The hash values are hashrefs of type information in
+the same form as that provided to the various bind_param() methods
+(See L</"Data Types for Placeholders"> for the format and values),
+plus anything else that was passed as the third argument to bind_param().
+Returns undef if not supported by the driver.
+
+If the driver supports C<ParamTypes>, but no values have been bound
+yet, then the driver should return a hash with the placeholder name
+keys, but all the values undef; however, some drivers may return
+a ref to an empty hash, or, alternately, may provide type
+information supplied by the database (only a few databases can do that).
+
+It is possible that the values in the hash returned by C<ParamTypes>
+are not I<exactly> the same as those passed to bind_param() or execute().
+The driver may have modified the type information in some way based
+on the bound values, other hints provided by the prepare()'d
+SQL statement, or alternate type mappings required by the driver or target
+database system.
+
+It is also possible that the keys in the hash returned by C<ParamTypes>
+are not exactly the same as those implied by the prepared statement.
+For example, DBD::Oracle translates 'C<?>' placeholders into 'C<:pN>'
+where N is a sequence number starting at 1.
+
+The C<ParamTypes> attribute was added in DBI 1.49. Implementation
+is the responsibility of individual drivers; the DBI layer default
+implementation simply returns undef.
+
+
=item C<Statement> (string, read-only)
Returns the statement string passed to the L</prepare> method.
Modified: dbi/trunk/DBI.xs
==============================================================================
--- dbi/trunk/DBI.xs (original)
+++ dbi/trunk/DBI.xs Fri May 13 01:50:39 2005
@@ -1716,6 +1716,8 @@ dbih_get_attr_k(SV *h, SV *keysv, int db
valuesv = &sv_undef;
else if (strEQ(key, "ParamValues"))
valuesv = &sv_undef;
+ else if (strEQ(key, "ParamTypes"))
+ valuesv = &sv_undef;
break;
case 'R':