The DBI needs to sort the keys in %$attr for connect_cached and prepare_cached to ensure a canonical cache key is generated.
Currently this is done in perl and is relatively expensive: my @attr_keys = ($attr) ? sort keys %$attr : (); my $key = do { local $^W; # silence undef warnings join "~~", $dsn, $user, $auth, $attr ? (@attr_keys,@[EMAIL PROTECTED]) : () }; my @attr_keys = ($attr) ? sort keys %$attr : (); my $key = ($attr) ? join("~~", $statement, @attr_keys, @[EMAIL PROTECTED]) : $statement; I'd like to wrap that up into a _concat_hash_keys( \%hash, $separator, [EMAIL PROTECTED] ) function implemented in C.. As part of that we'd need a function to return the keys of a hash in sorted order. That just needs to allocate an array of char*'s, load it with pointers to each of the keys in the hash, and then call qsort(). The bonus is that that function would enable the ParamValues reported by ShowErrorStatement to be listed in sorted order: http://rt.cpan.org/Ticket/Display.html?id=27272 (function could take a flag to indicate lexical or numeric sort order) Any volunteers, either for both or just the sort function? Tim.