Translation constants truncated

yehster wrote on Wednesday, April 08, 2015:

The constant_name column is a varchar(255) but when using UTF-8, characters are multibyte, so in reality the maximum size is far less than 255. As an example

Pecularities in many browsers may mean that the output below enters your screen in sudden jerks and that there are long pauses of several seconds where it appears as though things may have crashed. That is not the case, you will eventually see output coming out line by line. There may be sequential numbers appearing below, this is to indicate that even though nothing else may be displaying there is activity going on. These numbers will be interspersed with the content of the billing and that is normal.

is truncated to:

Pecularities in many browsers may mean that the output below enters your screen in sudden jerks and that there are long pauses of several seconds where it appears as though things may have crashed. That is not the case, you will eventually see output co

bradymiller wrote on Thursday, April 09, 2015:

Hi Kevin,

The constant_name is a needed key to keep the queries quick and is also in BINARY to allow constants with different casing. Is there a way to make this longer but still keep it a key and support different casing?

-brady
OpenEMR

sunsetsystems wrote on Thursday, April 09, 2015:

Here’s a thought. You could replace the cons_id key with a hash (e.g. md5 or sha1) of the constant name. That way, given the constant, you can compute the hash and look up the definition from that. The queries would be simpler (only one table), keys shorter, and the lang_constants table would be needed only as a reference of what constants are supported.

Rod
http://www.sunsetsystems.com/

bradymiller wrote on Friday, April 10, 2015:

Hi,

That would require code changes and need to support both mechanisms.

What about making it a blob and putting a key with length of 50 on it. That should remove the limit constraint, maintain casing differences, and keep performance with the key.

-brady
OpenEMR

sunsetsystems wrote on Friday, April 10, 2015:

This would be a good time to specify the problem we’re trying to solve. :slight_smile:

Rod
http://www.sunsetsystems.com/

bradymiller wrote on Wednesday, April 15, 2015:

Hi Rod and Kevin,

Problem is to support large constants (greater than 240 bytes).

This should suffice for a fix:

It’s testing well. Let me know if it works on your large constants. Let me know if it’s ok to commit to codebase (or if there’s a better solution).

-brady
OpenEMR

sunsetsystems wrote on Wednesday, April 15, 2015:

Hi Brady, have not tested but it looks reasonable to me.

Rod
http://www.sunsetsystems.com/

bradymiller wrote on Friday, April 17, 2015:

Hi,

Tests well and works on mega-size constants. I just committed this to the codebase.

-brady
OpenEMR