Re: New Memo Field Capabilities.
Posted in 1995
> gsri@acca.nmsu.edu (Youngs) writes:
> I have the need to store some narrative with my database
> for storage. A friend of mine told me this was not easy
> with Informix. I may have to store 2-300 words which
> accompany a set of tables. I know I can do this in PC-
> Access. I was told carriage returns cause a problem in
> Informix.
>
> Should I nix the idea of using Informix to store narrative ?
Don't.
> Anyone have some wisdom to share on this issue ?
You don't say anything about the version of Informix, nor the
language you intend to use.
Using OnLine you can use blobs (byte or text) to store what
you want. If you store carriage returns you'l get them back,
so that should be no problem.
Informix SE have no blobs, so you have to find some alternative.
Theoretically you could make one char field that was large enough,
but that would probably waste too much space.
What we do is creating a table something like this:
create table xxtext(
serno serial not null,
reffield something referencing your_table,
thetext char(80),
primary key(serno))
The reffield references the table where you now have your memo
field in Access.
The serno-field serves both as the primary key and a simple way
to sequence your lines of text.
You then store each line of text in thetext-field. (If you have
lines with more than 80 characters can you read them? If so just
make the field larger.)
You obviously do not store carriage return/line feeds here.
This isn't elegant, but it works.
Of course if you add lines to a text, you should delete all the
records in this table with the relevant value in the reffield
and reinsert all lines so the serno-field will be in the
right sequence.
You shouldn't ever need to know the value of the serno-field
in your application, so even if you use ODBC and have problems
getting at this, it shouldn't matter.
If your text contains non printable characters the char type
of Informix has allways been able to store them, except for
character value 0. On newer versions (from 6.0 and up) you
may have to set some NLS-values for the database for some
very very strange reason. (Informix seems to believe, or
perhaps it is the SQL standard organization, that anything
outside 7 bit ascii shall require loops and turns to get
into the database in a char-type field?!?)
Nils.Myklebust@ccmail.telemax.no
NM-data, Aasesvei 71, N-1300 Sandvika, Norway
My opinions are those of my company