95% of all code makes me cry. The other 5% are white space.
-- save mode & disable backslashes SET @old_sql_mode=@@sql_mode; SET @@sql_mode=CONCAT_WS(',', @@sql_mode, 'NO_BACKSLASH_ESCAPES'); -- run the query SELECT 'C:\\media\data\temp\'; -- enable backslashes SET @@sql_mode=@old_sql_mode;
Server settings that enable / disable escaping have lead to one gazillion SQL injection and syntax problems. When will we get rid of these useless settings? Example by outis on Stack Overflowcomments powered by Disqus
Send us your own example of code that made you cry! Please include:
Note that we may choose not to publish some submissions if we feel they're not appropriate. We hope you understand.
Use jOOQ, instead of JDBC.
jOOQ generates Java code from your database and lets you build typesafe SQL queries through its fluent API.