Re: DBD::Informix and SELECT from MULTISET column

Re: DBD::Informix and SELECT from MULTISET column

am 15.02.2007 15:37:38 von jonathan.leffler

------=_Part_67609_531773.1171550258073
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

I've been trying to wrap my brain around it (pretty casually, I admit) for a
decade or so.
If you'd like to help out with some code changes, I'm very willing to accept
them.

....more below...

On 2/15/07, tvilliers wrote:
>
> On 23 Sep 2005, 16:23, tvilli...@gmail.com wrote:
> > I'm looking for a bit more information WRT the returned dataset from
> > selecting from a MULTISET column in Informix please.
> >
> > Create a small table:
> > "create table test (col1 int,col2 multiset(int not null))"
> > and insert a couple of rows of test data (eg, "1, {2,3}" etc)
> >
> > When I use this test script:
> >
> > _BEGIN_
> > use DBI;
> > use DBD::Informix qw(:ix_types);
> > my $dbh = DBI->connect(...);
> > my $sth = $dbh->prepare('SELECT col2 FROM test');
> > $sth->execute();
> > my $col2;
> > $sth->bind_col(1, \$col2, { TYPE => 'IX_MULTISET'} );
> > while ( my $row = $sth->fetchrow_hashref() ) {
> > print "$col2\n";}
> >
> > $sth->finish();
> > $dbh->disconnect;
> > _END_
> >
> > the returned resultset is "flat":
> > "
> > MULTISET{1,2}
> > ...
> > "
> >
> > I "expected" a reference to an object (an array); or how else would I
> > achieve such a result?


I still don't understand how you're supposed to manipulate dynamic
structures like multi-sets from the client-side without knowing in advance
what the type is. I did get pointed to some documentation earlier this week
-- I just need some time to inwardly digest (and, I'm not convinced it gives
me the answers I need).




It's been a while since the post above, but I'd still appreciate any
> pointers.
>
> Also, when the returned MULTISET column exceeds 256 bytes, it gets
> truncated, even though the data type is explicitly bound as in the
> previous example.


If you go poking in the DBD::Informix code, you'd find some code (written by
someone other than me - and I don't fully understand it) that deals with
these types up to a size of 256 bytes. I have not worked out what it does,
how it does it, why it does it, the extent to which it does work, etc.

The relevant file is dbdimp.ec.


I've tried setting the LongReadLen attribute, but it doesn't seem to
> make any difference to the result either.



DBD::Informix pretty thoroughly ignores LongReadLen - it won't make any
difference. A MULTISET is not a LOB type, anyway, so it is far from clear
that LongReadLen should affect it.


You're suffering from an itch I've not been suffering - want to do the "Open
Source thing" and scratch your itch? Patches (or new maintainers)
gratefully accepted.


--
Jonathan Leffler #include
Guardian of DBD::Informix - v2005.02 - http://dbi.perl.org
"I don't suffer from insanity - I enjoy every minute of it."

------=_Part_67609_531773.1171550258073--