Author: timbo
Date: Tue Apr  6 15:43:43 2004
New Revision: 263

Modified:
   dbi/trunk/Changes
   dbi/trunk/DBI.pm
   dbi/trunk/ToDo
   dbi/trunk/lib/DBI/Profile.pm
Log:
Fixed DBI::Profile::DESTROY to not alter [EMAIL PROTECTED]
ToDo updates
Doc tweak for ParamValues


Modified: dbi/trunk/Changes
==============================================================================
--- dbi/trunk/Changes   (original)
+++ dbi/trunk/Changes   Tue Apr  6 15:43:43 2004
@@ -14,6 +14,7 @@
     table name not the file name thanks to Jeff Zucker.
   Fixed last_insert_id(...) thanks to Rudy Lippan.
   Fixed propagation of scalar/list context into proxied methods.
+  Fixed DBI::Profile::DESTROY to not alter [EMAIL PROTECTED]
 
   Changed selectall_arrayref() to call finish() if
     $attr->{MaxRows} is defined.

Modified: dbi/trunk/DBI.pm
==============================================================================
--- dbi/trunk/DBI.pm    (original)
+++ dbi/trunk/DBI.pm    Tue Apr  6 15:43:43 2004
@@ -5597,10 +5597,13 @@
 a ref to an empty hash.
 
 It is possible that the values in the hash returned by C<ParamValues>
-are not exactly the same as those passed to bind_param() or execute().
-The driver may have modified the values in some way based on the
+are not I<exactly> the same as those passed to bind_param() or execute().
+The driver may have slightly modified values in some way based on the
 TYPE the value was bound with. For example a floating point value
 bound as an SQL_INTEGER type may be returned as an integer.
+The values returned by C<ParamValues> can be passed to another
+bind_param() method with the same TYPE and will be seen by the
+database as the same value.
 
 It is also possible that the keys in the hash returned by C<ParamValues>
 are not exactly the same as those implied by the prepared statement.

Modified: dbi/trunk/ToDo
==============================================================================
--- dbi/trunk/ToDo      (original)
+++ dbi/trunk/ToDo      Tue Apr  6 15:43:43 2004
@@ -161,6 +161,8 @@
 
 Trace to tied file handle.
 
+preparse() - incl ability to split statements on semicolon
+
 Hooks for method entry and exit.
 
 $dbh->{Statement} can be wrong because fetch doesn't update value
@@ -212,6 +214,30 @@
 *** Small/quick/simple changes/checks ***
 
 fetchall_hashref for multiple keys - pending
+        my $hash_key_name = $sth->{FetchHashKeyName} || 'NAME';
+        my $names_hash = $sth->FETCH("${hash_key_name}_hash");
+
+        my @key_fields = (ref $key_field) ? @$key_field : ($key_field);
+        my @key_values;
+        foreach (@key_fields) {
+
+            my $index = $names_hash->{$_};  # perl index not column
+            ++$index if defined $index;     # convert to column number
+            $index ||= $key_field if DBI::looks_like_number($key_field) && 
$key_field>=1;
+
+            push @key_values, undef;
+            $sth->bind_col($index, \$key_value[-1]) or return;
+        }
+
+        my $rows = {};
+        my $NAME = $sth->{$hash_key_name};
+        while (my $row = $sth->fetchrow_arrayref($hash_key_name)) {
+            my $ref = $rows;
+            $ref = $ref->{$_} ||= {} for @key_values;
+            @[EMAIL PROTECTED] = @$row;
+        }
+        return \%rows;
+
 
 
 *** Assorted to-do items and random thoughts *** IN NO PARTICULAR ORDER ***

Modified: dbi/trunk/lib/DBI/Profile.pm
==============================================================================
--- dbi/trunk/lib/DBI/Profile.pm        (original)
+++ dbi/trunk/lib/DBI/Profile.pm        Tue Apr  6 15:43:43 2004
@@ -647,6 +647,7 @@
 
 sub DESTROY {
     my $self = shift;
+    local $@;
     eval { $self->on_destroy };
     if ($@) {
         my $class = ref($self) || $self;

Reply via email to