Re: in need of help
Posted in 1999
Topics: Data Types & Schema Design
>Varchar columns are the ones with the 255-character limit. Char columns can be >far longer, including your very-legal length of 2500. Is there any chance the >datatype changed from a char to a varchar somewhere along the line? Nope, I just droped and re-created the table with char(2500) for 3 columns. At 04:43 PM 7/21/99 -0700, Richard Auslander wrote: >Aaz - > >Varchar columns are the ones with the 255-character limit. Char columns can be >far longer, including your very-legal length of 2500. Is there any chance the >datatype changed from a char to a varchar somewhere along the line? > >Rich > >aaz@leopard.com wrote: > >> Hi all, >> If I do a char(2500) is it legal? Up until yesterday the columns where >> accepting more than 256 bytes, now it is choking on 256+ , is there an >> server setting that can override my column sizes? Also if the limit is 255 >> why does my create table with columns of char(2500) work? >> >> In need of help >> >> thanks >> -aaz >> >> At 09:37 AM 7/14/99 +0300, Octav Chiriac wrote: >> > >> >On Tue, Jul 13, 1999 at 03:04:36PM -0600, aaz@leopard.com wrote: >> >> Hi all, >> >> New to informix and am porting an app that talked to MySql to Informix. >> >> Anyways I am in need of columns that can store more than 255 characters. In >> >> mySql this is a text datatype. It appears informix has it as well however >> >> its a binary datatype hence doing inserts with text between " simply is not >> >> working. >> >> >> >> 2 things: >> >> 1. If I want to store form submissions that have more that 255 characters >> >> how do I do it (what datatype) >> > >> >If your submission is less than 32K - use CHAR. >> >If you need more you have three options: >> > - use more columns of type CHAR >> > - use more records each containing a portion of CHAR >> > - use a TEXT column >> > >> >In the latter case you can't insert the data by putting it between quotas. >> >It depends what language you use. >> > >> > >> >> >> >> 2. Are there any informix sql functions for converting things to the text >> >> datatype to and from? >> >> >> > >> >Don't remember one. But I didn't use this datatype very often so it could >> >be one (I have doubts about this). Anyway you can save the data from a >> >text column into a file or retrieve it in memory. >> > >> >Best Regards, >> >Octav >> > >> >-- >> >Octav Chiriac Phone: (373) 2 22 99 67 >> >NetInfo S.R.L. Fax: (373) 2 21 36 59 >> >Chisinau (373) 2 24 00 83 >> >Moldova, Republic of mailto:com@netinfo-moldova.com >> > > >-- >Richard C. Auslander >Database Manager > >AirFlash, Inc. >1733 Woodside Rd., Suite #110 >Redwood City, CA 94061 >(650) 556-7928 > >www.airflash.com >
aaz@leopard.com wrote: > >Varchar columns are the ones with the 255-character limit. > >Char columns can be far longer, including your very-legal > >length of 2500. Is there any chance the > >datatype changed from a char to a varchar somewhere along the line? > > Nope, I just droped and re-created the table with char(2500) for 3 > columns. Judging from the question I received from AAZ via the dbi-users mailing list (for Perl DBI and DBD questions), the problem is mostly that Aaz is not really telling you what he is really trying to do, which is to prepare an INSERT statement with a 2500-character string literal, and is running into the error that the string literal is too long. This is solved by using a placeholder in the prepared statement and supplying the string in a USING clause when the statement is executed. And, to boot, this is all being done in Perl with DBI and DBD::Informix. The conversation on the c.d.i has not been very enlightening for anyone because insufficient information was given to allow an accurate answer. -- Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net) Guardian of DBD::Informix v0.60 -- see http://www.perl.com/CPAN #include <disclaimer.h>