Re: Help sought with definition and implementation of ParamTypes attribute

"Greg Sabino Mullane" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase.devel
Message-ID <[email protected]>
-----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

- --
Greg Sabino Mullane [email protected]
PGP Key: 0x14964AC8 200810112235
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAkjxZu0ACgkQvJuQZxSWSsg7gACg4B2weT8TxJ9Fj/G/k9ghKlen
yEwAoPD42R2gc4tA01X3R2fnLRbDg0lN
=2Y32
-----END PGP SIGNATURE-----
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.