Skip to content

[ongeki,general] Fix bug about calculateRankByUserAndEventId() and add test config file for mysql

Mikira Sora requested to merge (removed):master into master

Problem

In my previous !19 (merged) , I provide calculateRankByUserAndEventId() and implement it with native SQL query.
I tested SQLite but didn't test other databases like MySQL and MariaDB, the latter both got trouble with this SQL query.

problem Log
Caused by: java.sql.SQLSyntaxErrorException: (conn=1009) 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 'where user_id == 1 limit 1' at line 1
	at org.mariadb.jdbc.export.ExceptionFactory.createException(ExceptionFactory.java:282)
	at org.mariadb.jdbc.export.ExceptionFactory.create(ExceptionFactory.java:370)
	at org.mariadb.jdbc.message.ClientMessage.readPacket(ClientMessage.java:134)
	at org.mariadb.jdbc.client.impl.StandardClient.readPacket(StandardClient.java:855)
	at org.mariadb.jdbc.client.impl.StandardClient.readResults(StandardClient.java:794)
	at org.mariadb.jdbc.client.impl.StandardClient.readResponse(StandardClient.java:713)
	at org.mariadb.jdbc.client.impl.StandardClient.execute(StandardClient.java:637)
	at org.mariadb.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:95)
	at org.mariadb.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:288)
	at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)
	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)
	at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:57)
	... 124 more

Solutions

Now I re-factory calculateRankByUserAndEventId() again, and it will use @Query with non-native query. (thx friend @rinsama notice me and provide solution)
And I wrote new application.properties for mysql testing env, now developers can easily use three database environments to conduct a series of test cases.


Please take a code review and test 🙂

Merge request reports

Loading