Re: DBI, blobs, and strings longer than 256 chars
Posted in 1998
On Wed, 2 Dec 1998, Stephen Roach wrote:
> On Mon, 30 Nov 1998 16:58:16 -0500, "Art S. Kagel" <kagel@bloomberg.net> wrote:
> > Steven Primrose-Smith wrote:
> > > After struggling for an afternoon trying to get blobs into an
> > > Informix database via perl and DBI, without any Informix-specific
> > > docs, I wondered is there a data type that supports strings longer
> > > than 256 chars without resorting to blobs. All transactions are
> > > carried out via SQL. The database is storing some HTML so nothing
> > > more than 32KB would be needed. MSAccess can manage this, so I
> > > figured Informix can too.
> >
> > Informix CHAR type is limited to 32767 characters so that should fill
> > the bill.
>
> That was the solution which I resorted to but I really wanted to use
> the TEXT type. My data source is flat files ported from another
> system.
>
> Actually, the problems started when I tried to get some test data into
> my TEXT column. Couln't convert from CHAR or VARCHAR. Couldn't get a
> 4GL screen to do the insert and dbload didn't do it either.
>
> Any ideas?
Has anybody bothered to look at how the blob tests handle blobs?
There is valuable information in the test suite! There are also
some caveats about blobs in the documentation -- the README file
etc. The warning about reading the README file is meant to be taken
literally!
If you are doing INSERT operations, read the blob data into a Perl
variable, if necessary by slurping the whole file into memory. The
make sure the INSERT operation lists a question mark placeholder for
the value. There are *no* blob literals in Informix, therefore you
cannot write blob literals in INSERT statements. UPDATE statements
cannot be handled by any code that you have available -- read the
documentation for why. It will only ever work with 7.30 or later
servers, and with comparable versions of ClientSDK (2.00 up). I'm
not exactly sure what the corresponding versions of IDS/UDO and
IDS/ADSO/XPO are, but I think they'll be 8.2 or 8.3 and 9.2.
Oh, and don't forget that the most appropriate forum is still the
dbi-users@fugue.com mailing list -- see http://www.fugue.com/dbi for
subscription information.
Yours,
Jonathan Leffler (jleffler@informix.com) #include <witticism.h>
Guardian of DBD::Informix v0.60 -- http://www.perl.com/CPAN
Informix IDN for D4GL & Linux -- http://www.informix.com/idn