bradymiller wrote on Tuesday, September 18, 2012:
Hi,
Quick thoughts on yehster’s reply: It’s generally a good idea to separate code from the developer (or code from politics) when reviewing code/project proposals. Just try to pretend it is a blinded study…
Still in analysis phase here. The current test case I am using is the following scenario:
1. OpenEMR is installed on windows
2. CAMOS is installed (so CAMOS table names are lowercase, CAMOS data entries into register and forms are uppercase and the CAMOS codebase sql queries are uppercase)
3. A CDR rule is created in Adminsitraion->Rules that uses the form_camos tables (CAMOS is stored in the CDR tables as lowercase).
4. Rxnorm is installed (so rxnorm tables names are lowercase and future codebase sql queries will be uppercase)
5. Bring it over to linux
Going through the above non-OpenEMR codebase solutions:
1) set lower_case_table_names to 1 in linux
-Still need to test to ensure this setting will work with both uppercase/lowercase CAMOS in table name
-Issue will be that it will effect other software that is using the mysql server
-Issue is that shared hosting will most likely not support this
2) re-uppercase the CAMOS and rxnorm table names (this is my initial favorite)
-Issue is that the CDR entries created in windows(since in lowercase) to query the form_camos table will break in addition to any other features that store the database table names.
-Some room for human error when converting the rxnorm tables
3) modify codebase/database to down-case CAMOS
-This would be very extensive and still wouldn’t support the rxnorm tables since it is a standardized install that uses uppercase for rxnorm.
4) Make the codebase flexible for casing of the CAMOS and rxnorm table in addition to having a method to support other tables (for example, customized forms).
-My commit above addresses this, which does the following.
a)If a sql error is thrown, then it checks the error. If it is a Table is missing error then it sees if the missing table in the error statement is one of chosen tables that are supported.
b) If it is a supported table, then it checks for existence of the opposite table (so if form_camos is missing, it will check for form_CAMOS or vice versa).
c) If the opposite table does exist, then it analyzing the original statement to ensure that all tables within the statement that are supported (for example, if have several of the CAMOS tables in one join statement) are of the same family (either uppercase or lowercase form), and that each of their opposite tables exist. (this rigid testing is done to not allow inifinite recursion)
d)If criteria in c are fulfilled, then the new statement is created with the opposite tables and run.
Regarding error reporting, note this is actually compounded by the fact that the current Execute function (with auditing) clears the error code in most environments, which I think I have fixed in below commit, which I discussed above (but still testing):
http://github.com/bradymiller/openemr/commit/e5497774ef5617ab3c79cdf4f3d4afead4768963
So, need to ensure this bug is fixed before can test/ensure that the error codes aren’t swallowed up by the requery. Some simpleton testing (with casing/dropping tables) has shown that the correct errors are shown.
-brady
OpenEMR