[#2669] Fixed this issue by setting @@sql_mode = 'NO_BACKSLASH_ESCAPES'
This commit is contained in:
parent
bf7650e2d0
commit
0f4297cc97
@ -322,7 +322,7 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
|
||||
String s4 = (derby ? s1 : null);
|
||||
|
||||
// [#2669] MySQL uses backslashes for escaping...
|
||||
String s5 = "no SQL \\'injection\\' in MySQL either";
|
||||
String s5 = "no SQL \\injection\\ in MySQL either\\";
|
||||
|
||||
Byte b1 = Byte.valueOf("1");
|
||||
Byte b2 = (derby ? b1 : null);
|
||||
|
||||
@ -38,6 +38,8 @@ package org.jooq.test;
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.jooq.SQLDialect.CUBRID;
|
||||
import static org.jooq.SQLDialect.FIREBIRD;
|
||||
import static org.jooq.SQLDialect.MARIADB;
|
||||
import static org.jooq.SQLDialect.MYSQL;
|
||||
import static org.jooq.test._.listeners.JDBCLifecycleListener.RS_CLOSE_COUNT;
|
||||
import static org.jooq.test._.listeners.JDBCLifecycleListener.RS_START_COUNT;
|
||||
import static org.jooq.test._.listeners.JDBCLifecycleListener.STMT_CLOSE_COUNT;
|
||||
@ -525,6 +527,12 @@ public abstract class jOOQAbstractTest<
|
||||
if (!connectionInitialised) {
|
||||
connectionInitialised = true;
|
||||
connection = getConnection0(null, null);
|
||||
|
||||
// [#2669] Turn of MySQL backslash escaping, which causes trouble
|
||||
if (asList(MARIADB, MYSQL).contains(create().configuration().dialect().family())) {
|
||||
create().execute("SET @@sql_mode=CONCAT_WS(',', @@sql_mode, 'NO_BACKSLASH_ESCAPES');");
|
||||
}
|
||||
|
||||
final Connection c = connection;
|
||||
|
||||
// Reactivate this, to enable mock connections
|
||||
|
||||
Loading…
Reference in New Issue
Block a user