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


> So { '1' => 'integer' } sure looks like a bug.

>> 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.

> Yes. Outputting the _string_ "SQL_INTEGER" would be wrong as it wouldn't
> work for the code above.

Thanks for the clarification Tim, that all makes sense. I've changed DBD::Pg to
do the right thing for ParamTypes. Specifically, it outputs a hash with placeholder
numbers or names as keys, as before, and with a hashref for the values that
contains a single key (always "pg_type") and the internal type number as the value.

{ 1 => { pg_type => 23 }, 2 => { pg_type => 1024 } }

and

{ ':foo' => { pg_type => 23 }, ':foo2' => { pg_type => 1024 } }

The just-released 2.11.0 version of DBD::Pg has this behavior.

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


-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAkjzNqMACgkQvJuQZxSWSsgs7QCgoxIdn7KDhRUGc63QkDlqgtxI
5L8AnjjpaxLeA5ZPK8/2+sB2/3XAuAzN
=UIqO
-----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.