Expand my Community achievements bar.

string length issue

Avatar

Level 3
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
4 Replies

Avatar

Level 10
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

Level 9
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

Level 3
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

Level 10
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