KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Length of C_STRING in Unicode mode
PRODUCT: 4D Developer | VERSION: 11 | PLATFORM: Mac & Win
Published On: July 30, 2008

In 4D v11 SQL, when running in Unicode mode, C_STRING is equivalent to C_TEXT. This means that the maximum string length parameter in C_STRING will be ignored.

Here is an example highlighting the difference from 4D 2004:

4D 2004:

C_STRING(1;$var)
$varSize:=Length($var)  `$varSize = 0
$var:="1234567890"  `$var = 1
$varSize:=Length($var)  `$varSize = 1


In 4D 2004, the size of a variable created with C_STRING will never be greater then the string length parameter.

4D v11 SQL:
C_STRING(1;$var)
$varSize:=Length($var)  `$varSize = 0
$var:="1234567890"  `$var = 1
$varSize:=Length($var)  `$varSize = 10


In 4D v 11 SQL, the size of a variable created with C_STRING will adjust to the contents of the variable.

Note - 4D 2004 databases that have been converted to 4D v11 SQL and are running in compatibility mode will function the same as in 4D 2004.