cloudwan / gohan

Gohan is an API Gateway Server written by Go that makes it easy for developers to create and maintain REST-style API
http://www.slideshare.net/natiueno/gohan-61170476
Other
109 stars 44 forks source link

Improve logging in the sql package #728

Closed p-kozlowski closed 5 years ago

p-kozlowski commented 5 years ago

I encountered issues when debugging why a custom query was failing. The query looked somewhat like

SELECT * 
FROM t1 INNER JOIN t2 
WHERE t1.col1 LIKE '%' || t2.col1 || '%' 
AND t1.col1 = ?;
  1. The reason of the syntax error was not logged at all
  2. The query argument was substituted with the first '%'

Now we log the error reason and properly escape '%' characters in the query