Raggaer / castro

High performance content management system for Open Tibia servers
MIT License
46 stars 19 forks source link

Castro extensions sql file #73

Closed Raggaer closed 7 years ago

Raggaer commented 7 years ago

For some reason the SQL file is broken when the installer tries to run it

forgee commented 7 years ago

Looks like the problem stems from the mysql driver not accepting multiple statements in a single string.

Some related reading: https://stackoverflow.com/questions/28548559/does-a-go-mysql-driver-exist-that-supports-multiple-statements-within-a-single-s?rq=1

Possible solution, but supposedly "greatly increases the risk of SQL injections": https://github.com/go-sql-driver/mysql#multistatements

Another option in our case might be to split the query on semi-colon and execute each statement separately.

Update We might also put each table in a separate file and use an array with the filenames to execute them in the correct order. (I have confirmed that this solution solves the issue).

Raggaer commented 7 years ago

We can use multiStatements=true on the installation part without problems actually. I tried and everything works fone.

Thanks