diff options
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; |