From 17f67f6e13764c5cf2bbcccd70ad9c2816dd53a0 Mon Sep 17 00:00:00 2001 From: Luck Date: Wed, 9 Dec 2020 18:08:17 +0000 Subject: [PATCH] Use case insensitive LIKE command on H2 databases (#2760) --- .../implementation/sql/connection/file/H2ConnectionFactory.java | 2 +- .../sql/connection/file/SqliteConnectionFactory.java | 2 +- .../sql/connection/hikari/MariaDbConnectionFactory.java | 2 +- .../sql/connection/hikari/MySqlConnectionFactory.java | 2 +- .../sql/connection/hikari/PostgreConnectionFactory.java | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/implementation/sql/connection/file/H2ConnectionFactory.java b/common/src/main/java/me/lucko/luckperms/common/storage/implementation/sql/connection/file/H2ConnectionFactory.java index 193a142e0..7ca1f417d 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/implementation/sql/connection/file/H2ConnectionFactory.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/implementation/sql/connection/file/H2ConnectionFactory.java @@ -83,6 +83,6 @@ public class H2ConnectionFactory extends FlatfileConnectionFactory { @Override public Function getStatementProcessor() { - return s -> s.replace("'", "`"); + return s -> s.replace('\'', '`').replace("LIKE", "ILIKE"); } } diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/implementation/sql/connection/file/SqliteConnectionFactory.java b/common/src/main/java/me/lucko/luckperms/common/storage/implementation/sql/connection/file/SqliteConnectionFactory.java index a2f1ba375..e5caf4d75 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/implementation/sql/connection/file/SqliteConnectionFactory.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/implementation/sql/connection/file/SqliteConnectionFactory.java @@ -76,6 +76,6 @@ public class SqliteConnectionFactory extends FlatfileConnectionFactory { @Override public Function getStatementProcessor() { - return s -> s.replace("'", "`"); + return s -> s.replace('\'', '`'); } } diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/implementation/sql/connection/hikari/MariaDbConnectionFactory.java b/common/src/main/java/me/lucko/luckperms/common/storage/implementation/sql/connection/hikari/MariaDbConnectionFactory.java index 26c723515..092e36f74 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/implementation/sql/connection/hikari/MariaDbConnectionFactory.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/implementation/sql/connection/hikari/MariaDbConnectionFactory.java @@ -71,6 +71,6 @@ public class MariaDbConnectionFactory extends HikariConnectionFactory { @Override public Function getStatementProcessor() { - return s -> s.replace("'", "`"); // use backticks for quotes + return s -> s.replace('\'', '`'); // use backticks for quotes } } diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/implementation/sql/connection/hikari/MySqlConnectionFactory.java b/common/src/main/java/me/lucko/luckperms/common/storage/implementation/sql/connection/hikari/MySqlConnectionFactory.java index 6f051b5bc..4269fff96 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/implementation/sql/connection/hikari/MySqlConnectionFactory.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/implementation/sql/connection/hikari/MySqlConnectionFactory.java @@ -105,6 +105,6 @@ public class MySqlConnectionFactory extends HikariConnectionFactory { @Override public Function getStatementProcessor() { - return s -> s.replace("'", "`"); // use backticks for quotes + return s -> s.replace('\'', '`'); // use backticks for quotes } } diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/implementation/sql/connection/hikari/PostgreConnectionFactory.java b/common/src/main/java/me/lucko/luckperms/common/storage/implementation/sql/connection/hikari/PostgreConnectionFactory.java index 176df1823..2bdf4cf51 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/implementation/sql/connection/hikari/PostgreConnectionFactory.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/implementation/sql/connection/hikari/PostgreConnectionFactory.java @@ -68,6 +68,6 @@ public class PostgreConnectionFactory extends HikariConnectionFactory { @Override public Function getStatementProcessor() { - return s -> s.replace("'", "\""); + return s -> s.replace('\'', '"'); } }