string length issue

Avatar

Avatar

_Michael_Feicht

Avatar

_Michael_Feicht

_Michael_Feicht

11-02-2008

When is a string represented as varchar and when as longtext in the database. I don't know at development-time how long the string will be at runtime.

I know that I could modify the database manually but I think there should be a better way to achieve the same result?



kind regards

Michael

Replies

Avatar

Avatar

Jasmin_Charbonn

Avatar

Jasmin_Charbonn

Jasmin_Charbonn

11-02-2008

Not really. The variable will be created by default as varchar(). If you need longtext, you need to change them manually in the db like you mentioned.



Jasmin

Avatar

Avatar

HowardTreisman

Avatar

HowardTreisman

HowardTreisman

13-02-2008

A very early version of Workflow had a variable type of "text", which equatetd to a longtext. It's a real pain not having it, and I can only imagine that it would be reasonably easy to add it.

Please request this feature enhancment through support, and maybe we'll see it in the next version.

Howard

http://www.avoka.com

Avatar

Avatar

_Michael_Feicht

Avatar

_Michael_Feicht

_Michael_Feicht

14-02-2008

After some research and trial and error I have found out how LC maps its string variables to MySQL datatypes.



* 1 <= n <= 255 ==> varchar(n) [ 2^8 - 1]

* 256 <= n <= 65.535 ==> text [2^16 - 1]

* 65536 <= n <= 4.294.967.295 ==> longtext [2^32 - 1]



Note: If you reduce the length of a string, the data type will not be changed.

Avatar

Avatar

Jasmin_Charbonn

Avatar

Jasmin_Charbonn

Jasmin_Charbonn

15-02-2008

If you set the size to -1, I believe it'll create a column of type "clob" in which case you won't have to worry with the size.



Jasmin