MariaDB issue (was Frontend cannot start)
Hi. I am trying to setup a test server and cannot launch frontend executable. I get the following error
Database driver mysql panic: Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"user" WHERE id = ?' at line 1
goroutine 1 [running]: main.main() /home/user/go/pkg/mod/github.com/readium/[email protected]/frontend/frontend.go:78 +0xaa9
We didn't adapt the LCP Server to MariaDB, but it is a fork of MySQL and should therefore be compatible.
I suppose that you have configured the servers with the appropriate database URI (see https://github.com/readium/readium-lcp-server#individual-server-configurations).
Here, you're talking about the Frontend Test Server (which is a toy and MUST NOT be used in production). From the error message, the culprit is here: https://github.com/readium/readium-lcp-server/blob/master/frontend/webuser/webuser.go#L146
Could you please try to change the escaped double-quotes for back ticks, i.e.
db.Prepare("SELECT id, uuid, name, email, password, hint FROM "user" WHERE id = ?")
becomes
db.Prepare("SELECT id, uuid, name, email, password, hint FROM user WHERE id = ?")
You'll have to do that in the whole webuser.go file (this is the only file which is using "user").
Please advise if it works, we'll update the codebase then.
Note: The next major version of the codebase will use an ORM (GORM) which will make it easier to adopt any SQL database.