Re: Help sought with definition and implementation of ParamTypes attribute

"H.Merijn Brand" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase.devel
Message-ID <[email protected]>
On Sun, 12 Oct 2008 02:55:51 -0000, "Greg Sabino Mullane"
<[email protected]> wrote:

> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: RIPEMD160
> 
> 
> > values are hashrefs of type information in the same form as that
> > provided to the various bind_param() methods
> ...
> 
> > I'm not sure why the values of the keys are hash references unless
> > multiple values are to be stored. If multiple values per key are stored
> > what are they typically? I can only find one DBD which implements
> > ParamTypes (DBD::Pg) and unless I am mistaken it sets the values of the
> > keys to a scalar value - the type of the parameter.
> 
> Yes, it's scalar values in DBD::Pg. If I recall correctly, it was done that
> way simply because it seemed better to return a simple name. To be 100%
> accurate it should probably return a hashref because that's what bind_param
> takes. In other words:
> 
>   $sth->bind_param('$1', 234, { pg_type => SQL_INTEGER });
>   warn Dumper $sth->{ParamTypes};
> 
> gives:
> 
> $VAR1 = {
>           '1' => 'integer'
>         };
> 
> When it should technically return:
> 
> $VAR1 = {
>           '1' => { pg_type => 'SQL_INTEGER' }
>         };
> 
> However, bind_param currently saves the value to an internal form, without
> saving how it got there, which makes the key of that inner hash ('pg_type')
> difficult to show. Because the value, SQL_INTEGER, is really a constant, it's
> equally difficult to know to output 'SQL_INTEGER' - we'd really have to output
> the number it maps to.
> 
> I can easily adjust ParamTypes in DBD::Pg to give a hashref, if that's
> what you end up doing for DBD::ODBC

Me too, if that's what is better. It's new and probably nobody uses it.
I just implemented it to be as complete as possible while fixing and
implementing other stuff.

/me still hopes for next actions on logging
/me still hopes on nextr actions on DBD::File

-- 
H.Merijn Brand          Amsterdam Perl Mongers  http://amsterdam.pm.org/
using & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00,
11.11, 11.23, and 11.31, SuSE 10.1, 10.2, and 10.3, AIX 5.2, and Cygwin.
http://mirrors.develooper.com/hpux/           http://www.test-smoke.org/
http://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.