Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
mapper DB.runUpdate crashes if question marks in valid strings #1248
the following will fail
DB.runUpdate("insert into myTable (name, comment) values ('Tim', 'Why?'), Nil)
because the code in mapper is incorrectly parsing for ? as a parameter in the entire sql statement not just in parameter positions.
See this post for discussion
including trace and source code reference
Suggested short-term workaround:
and return error instead of crashing and looking for items in empty param list
Hi, i found another workaround which might be better suited. Since the issue is DB.LoggedPreparedStatementHandler, i've come up with this solution. It uses the idea of Scala's String.format to use %% to get a percent sign. So i've given it support for ??.
This is probably not that good when you have user generated content, but .replaceAll("?", "??) is manageable imho. (you gotta escape for injections anyhow.