diff options
author | Vitaly Takmazov | 2023-02-03 04:22:50 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-02-03 04:22:50 +0300 |
commit | 73b8c2dc544df207d8c7b9e36d20955ff1d88577 (patch) | |
tree | f5c25f04ca48157dd1ebe6ff7dbd5992a6de9aaa /src/main/java/com/juick/service/BaseJdbcService.java | |
parent | 26ef36070cb02bb6522a347d8692b6534d550a7c (diff) |
Make SQL vendor queries private
Diffstat (limited to 'src/main/java/com/juick/service/BaseJdbcService.java')
-rw-r--r-- | src/main/java/com/juick/service/BaseJdbcService.java | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/main/java/com/juick/service/BaseJdbcService.java b/src/main/java/com/juick/service/BaseJdbcService.java index ab2e3fc8..d16dadd2 100644 --- a/src/main/java/com/juick/service/BaseJdbcService.java +++ b/src/main/java/com/juick/service/BaseJdbcService.java @@ -39,18 +39,18 @@ public class BaseJdbcService { @Inject NamedParameterJdbcTemplate namedParameterJdbcTemplate; @Value("#{new Boolean('${spring.sql.init.platform}' == 'sqlserver')}") - protected boolean omitRecursiveKeyword; + private boolean omitRecursiveKeyword; @Value("#{('${spring.sql.init.platform}' == 'sqlite') or ('${spring.sql.init.platform}' == 'mysql')}") // Added in MariaDB 10.6 - protected boolean haveNoANSIFetch; + private boolean haveNoANSIFetch; @Value("#{new Boolean('${spring.sql.init.platform}' == 'sqlite')}") - protected boolean haveNoDates; + private boolean haveNoDates; @Value("#{new Boolean('${spring.sql.init.platform}' == 'sqlite')}") - protected boolean haveNoGreatest; + private boolean haveNoGreatest; @Value("#{new Boolean('${spring.sql.init.platform}' == 'sqlite')}") - protected boolean haveNoForUpdate; + private boolean haveNoForUpdate; @Value("#{new Boolean('${spring.sql.init.platform}' == 'mysql')}") - protected boolean haveNoOffsetDateTime; + private boolean haveNoOffsetDateTime; public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() { return namedParameterJdbcTemplate; @@ -59,6 +59,11 @@ public class BaseJdbcService { public JdbcTemplate getJdbcTemplate() { return jdbcTemplate; } + + public String withRecursive() { + return omitRecursiveKeyword ? "WITH" : "WITH RECURSIVE"; + } + protected String limit(int rows) { if (haveNoANSIFetch) { return "LIMIT " + rows; |