01-10-2014, 12:06 AM,
|
|
Forums
Senior Member
|
Posts: 155
Threads: 9
Joined: Jan 2014
|
|
RE: upper case letter in the database/company name .....
It seems that this simple and obvious bug is still awaiting the fix applying, so let us try again.
This is nothing to do with who wrote the code, the line is well intentioned but in this case wrong, but we all make mistakes sometimes.
Everybody agrees that where table names, and field names are hard coded into webERP then we should keep them all lower case, so that if in future we enable a DBMS that doesn't like lower case then the code should just work. In fact I have tried hard (but so far failed) to persuade people here of the benefit of using standard ANSI sql for this purpose.
However this bug has nothing to do with avoiding hard coded upper case characters. Throughout the last decade webERP has allowed those using mysql to have upper case characters in their database name. With the latest release those who chose this option now find on upgrade their webERP throws an error saying
"ERROR Message Report : You do not seem to have a database
configured correctly to use with webERP. Check you database exists and there
is a corresponding directory in the 'companies' directory of the same name.
Contact your system administrator for assistance."
Not helpful... The reason for this is that webERP stores the database name in a session variable. The line in includes/ConnectDB.inc changes this value to all lower case. Now if the database name is all lower case nothing happens, but if it contains one or more upper case characters then the value of this session variable is changed to something that is not the database name in use.
Now if we want to restrict the installer to only install lower case DB names (can't it be done on a per DBMS basis? ie only restrict if the chosen DBMS does not allow upper case?) then that would be one thing. However this bug causes webERP implementations that have worked fine for a decade to suddenly crash. It does seem a bit of a no brainer to fix it, or am I missing something?
If the user wants to transfer to postgres at a later date, then actually changing the case of their DB name would be the least of their problems
|
|
01-10-2014, 09:56 PM,
|
|
Forums
Senior Member
|
Posts: 155
Threads: 9
Joined: Jan 2014
|
|
RE: upper case letter in the database/company name .....
This bug fix has now been applied by Phil.
Thanks very much for doing this Phil!
I will start a new thread for the next bug fix I have, lets hope it doesn't take quite so much time and effort for the next one
|
|
02-10-2014, 10:04 PM,
|
|
Forums
Senior Member
|
Posts: 155
Threads: 9
Joined: Jan 2014
|
|
RE: upper case letter in the database/company name .....
Hi Jo, AFAIK the code has always been consistent in allowing upper and lower case characters in the database name. There is no problem in future with enforcing new databases to be lower case, the problem was that this change affected databases that already existed, and broke those implementations.
If the database exists, and the directory exists, and the two have the same name then the user should be able to continue. I don't see why webERP should block them, but this wasn't the case, and webERP blocked access.
Again AFAIK there is no problem at the OS level as we use PHP functions to do any of the work.
It is the same with the illegal characters thing. IMHO I don't see that we should be telling people what characters they can use in their company name, or their customers and suppliers can use. If problems exist with particular characters we should solve those problems rather than just block users.
Thanks
Tim
|
|
02-10-2014, 10:20 PM,
|
|
icedlava
Senior Member
|
Posts: 80
Threads: 9
Joined: Sep 2012
|
|
RE: upper case letter in the database/company name .....
(02-10-2014, 10:04 PM)Forums Wrote: Hi Jo, AFAIK the code has always been consistent in allowing upper and lower case characters in the database name. I did note when I first went into the code that in some places it forced lower case for database name, but not on the last 'new' install which was not checked. It is now i think.
Quote:There is no problem in future with enforcing new databases to be lower case, the problem was that this change affected databases that already existed, and broke those implementations.
This wasn't the problem here or at least what I was talking about. I would not want to enforce lower case in database names either. They should be allowed to have upper case and lower case and special characters as is allowed now (I think - not tried lately on install).
This bug was really about creating the company file directory during install - the issue was there. The check for lower case in connect db would have been correct had it not been for the typo in install that created that directory.The later check in connect db should also have checked for 'old' installs if they did indeed allow upper and lower case file directory names at some point.
Quote:If the database exists, and the directory exists, and the two have the same name then the user should be able to continue. I don't see why webERP should block them, but this wasn't the case, and webERP blocked access.
Yes, I know what the bug was - there was a check for lower case on the directory file name. This would have been correct - but the typo was in the directory creation during company creation which was meant to create a lower case directory file name so that it did not cause issues between case sensitive/non-case sensitive operating systems, and some SCM that also have the same case issue and need lower case file directory names.
Quote:It is the same with the illegal characters thing. IMHO I don't see that we should be telling people what characters they can use in their company name, or their customers and suppliers can use. If problems exist with particular characters we should solve those problems rather than just block users.
I don't either, I agree with you but while it seemed to be an issue in the past (when i first started usingwebERP with some code contradiction - and maybe later i can't recall) that was not the issue in this case. It was the issue of file system name.
Cheers,
|
|
02-11-2014, 12:13 AM,
|
|
icedlava
Senior Member
|
Posts: 80
Threads: 9
Joined: Sep 2012
|
|
RE: upper case letter in the database/company name .....
Hi Tim,
(02-10-2014, 11:58 PM)Forums Wrote: It may have been in the old installer, .... ... I had been saying throughout this thread was that the change to connectdb had unwittingly broken a number of existing installations, and I suggested a fix for the problem that sorted it. For some reason this turned into a bigger deal than it should as there was reluctance to admit the problem existed. However it has now been fixed. Yes I understand what you were saying. It worked for what you meant it to do, that was good.
What I was saying was, the fix applied was OK for the immediate symptom, but the actual bug in this case of the logic I explained above, was a problem in the installer - ie the installer created a directory with upper and lower case names instead of the intended lower case. This was part of the installer rewrite. The case of the database was irrelevant really to the actual bug I'm talking about. The connect db code was in fact therefore correct and supposed to ensure it lower case in the file system. The error was in the installer. I was asked to look at this a while back but some issues have delayed me this last month or so, and this post is just a response to that, no more.
Irrespective of that, if there is any fix put in place now or wanted to support the logic I posted about, it would have to also do a final check for 'old' upper/lower case file system directories. I don't mind what is decided , I've adjusted my custom repo for this but I can adjust the main repo code if you need.
Cheers,
|
|
|