twohoursonelife / OneLifeWeb

Web services used by the game server and client of OneLife, now seperate from the monolith repository.
https://twohoursonelife.com
Other
3 stars 2 forks source link

Existing Database Tables not recognized as created #4

Open Strohtaler opened 2 years ago

Strohtaler commented 2 years ago

I noted that even after having all database tables created (Ticket Server), I still got the link to create the database.

After digging a bit, I found that some PHP scripts have code to check if a given table is already created, for example in function ts_doesTableExist in ticketServer/server.php. The table name comparison (line 1254) is done in a case-sensitive way like: if( $tableName == $inTableName ), This will fail since some databases return table names in all lowercase (others all uppercase).

It can be solved (as tested) using if( strcasecmp( $tableName, $inTableName ) == 0 ) instead, but I am not a PHP developer, so I prefer not doing it myself.

(Actually I would prefer to directly query for the given table SELECT count(*) FROM information_schema.tables WHERE table_schema = '$databaseName' and table_name = '$inTableName')

connorhsm commented 2 years ago

What database engines do this, and which were you using for this to happen?

I believe all of this code was written with MySQL in mind, mostly over four years ago.

Strohtaler commented 2 years ago

That could be the problem. I am using XAMPP (x64-8.1.5-0-VS16) for servers and database - I supposed it comes with MySQL, its control center still states so, but it is MariaDB ( 10.4.24-MariaDB), a fork of MySQL.

connorhsm commented 2 years ago

Afaik MariaDB can be used as a drop in replacement for MySQL, I was considering using it if I were to finish dockerising this project, but have yet to test.