Re: VARCHAR
Posted in 1998
Ramiro Rela wrote: > I'm working on I4GL v4.10 under IBM AIX Version 3 for RISC System/6000 Start planning to upgrade. The operating system is old; the software is old; soon neither will be supported. > I have some fields on my tables which are defined CHAR(few tenths) > used for descriptions. The fine manual I read says VARCHAR fields > use less space (when storing small strings) than CHAR ones. I wander > which are the disadvantages of using VARCHAR instead of CHAR. Primarily you cannot move your code from OnLine to SE without redefining the database. There are some complications in the engine if the VARCHAR fields are indexed, so performance too. But the reduced disk space needed if the VARCHAR fields are normally significantly shorter than the maximum length can compensate enough. > Performance perhaps? Now I have v4.00 manuals only. > I think I4GL v4.00 doesn't support VARCHAR Why? I think it does, but it was probably only documented somewhere obscure with other OnLine features. Remember, OnLine was brand new (techincally) with version 4.00; prior to that, there was SE & Turbo. > so I need info about the definition of VARCHAR variables > and the meaning of the minimun size when defining > VARCHAR (maxsize, minsize). DEFINE nv VARCHAR(255) I'm almost certain that the ", minsize" bit is either not allowed at all or functionally ignored when the declaration is in I4GL. In the database, it means that enough space is allocated for minsize characters when the row is inserted, even if the data is shorter than that. This is presumably because you are confident that a short string will be updated to some value about minsize characters long, and by pre-allocating the space, you avoid moving your row on disk. -- Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net) Guardian of DBD::Informix v0.60 -- see http://www.perl.com/CPAN #include <disclaimer.h>