Skip to content

Commit

Permalink
fix: some SQL queries were malformed
Browse files Browse the repository at this point in the history
Some SQL query strings were missing spaces and, when appending the
strings together, the resulting query had syntax issue
  • Loading branch information
romainf-ubi committed Nov 24, 2022
1 parent c8eb6ca commit 8e35d95
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ private static final String replaceQueryForFifo(String query) {
"AND " +
"job.pk_facility = ? " +
"AND " +
"(job.str_os = ? OR job.str_os IS NULL)" +
"(job.str_os = ? OR job.str_os IS NULL) " +
"AND " +
"job.pk_job IN ( " +
"SELECT " +
Expand All @@ -256,7 +256,7 @@ private static final String replaceQueryForFifo(String query) {
"AND " +
"j.pk_facility = ? " +
"AND " +
"(j.str_os = ? OR j.str_os IS NULL)" +
"(j.str_os = ? OR j.str_os IS NULL) " +
"AND " +
"(CASE WHEN lst.int_waiting_count > 0 THEN lst.pk_layer ELSE NULL END) = l.pk_layer " +
"AND " +
Expand Down Expand Up @@ -333,7 +333,7 @@ private static final String replaceQueryForFifo(String query) {
"AND " +
"job.pk_facility = ? " +
"AND " +
"(job.str_os = ? OR job.str_os IS NULL)" +
"(job.str_os = ? OR job.str_os IS NULL) " +
"AND " +
"job.pk_job IN ( " +
"SELECT /* index (h i_str_host_tag) */ " +
Expand All @@ -354,7 +354,7 @@ private static final String replaceQueryForFifo(String query) {
"AND " +
"j.pk_facility = ? " +
"AND " +
"(j.str_os = ? OR j.str_os IS NULL)" +
"(j.str_os = ? OR j.str_os IS NULL) " +
"AND " +
"(CASE WHEN lst.int_waiting_count > 0 THEN lst.pk_layer ELSE NULL END) = l.pk_layer " +
"AND " +
Expand Down Expand Up @@ -426,7 +426,7 @@ private static final String replaceQueryForFifo(String query) {
"AND " +
"(folder_resource.int_max_gpus = -1 OR folder_resource.int_gpus < folder_resource.int_max_gpus) " +
"AND " +
"job_resource.int_priority > ?" +
"job_resource.int_priority > ? " +
"AND " +
"job_resource.int_cores < job_resource.int_max_cores " +
"AND " +
Expand All @@ -438,7 +438,7 @@ private static final String replaceQueryForFifo(String query) {
"AND " +
"job.pk_facility = ? " +
"AND " +
"(job.str_os = ? OR job.str_os IS NULL)" +
"(job.str_os = ? OR job.str_os IS NULL) " +
"AND " +
"job.pk_job IN ( " +
"SELECT /* index (h i_str_host_tag) */ " +
Expand All @@ -457,7 +457,7 @@ private static final String replaceQueryForFifo(String query) {
"AND " +
"j.pk_facility = ? " +
"AND " +
"(j.str_os = ? OR j.str_os IS NULL)" +
"(j.str_os = ? OR j.str_os IS NULL) " +
"AND " +
"(CASE WHEN lst.int_waiting_count > 0 THEN lst.pk_layer ELSE NULL END) = l.pk_layer " +
"AND " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class FilterDaoJdbc extends JdbcDaoSupport implements FilterDao {

private static final String GET_ACTIVE_FILTERS =
"SELECT " +
"filter.*" +
"filter.* " +
"FROM " +
"filter " +
"WHERE " +
Expand All @@ -66,7 +66,7 @@ public class FilterDaoJdbc extends JdbcDaoSupport implements FilterDao {

private static final String GET_FILTERS =
"SELECT " +
"filter.*" +
"filter.* " +
"FROM " +
"filter " +
"WHERE " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ public void updateMaxRSS(JobInterface job, long value) {
"str_visible_name = NULL, " +
"ts_stopped = current_timestamp "+
"WHERE " +
"str_state = 'PENDING'" +
"str_state = 'PENDING' " +
"AND " +
"pk_job = ?";

Expand Down Expand Up @@ -945,7 +945,7 @@ public void updateParent(JobInterface job, GroupDetail dest, Inherit[] inherits)
"AND " +
"job.b_auto_book = true " +
"AND " +
"job_stat.int_waiting_count != 0" +
"job_stat.int_waiting_count != 0 " +
"AND " +
"job_resource.int_cores < job_resource.int_max_cores " +
"AND " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public void insertShow(ShowEntity show) {
"SELECT " +
"COUNT(show.pk_show) " +
"FROM " +
"show LEFT JOIN show_alias ON (show.pk_show = show_alias.pk_show )" +
"show LEFT JOIN show_alias ON (show.pk_show = show_alias.pk_show) " +
"WHERE " +
"(show.str_name = ? OR show_alias.str_name = ?) ";
public boolean showExists(String name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ public void isOptimizable() {
layer.getLayerId());

jdbcTemplate.update(
"UPDATE layer_usage SET int_core_time_success = 3600 * 6" +
"UPDATE layer_usage SET int_core_time_success = 3600 * 6 " +
"WHERE pk_layer=?", layer.getLayerId());

assertFalse(layerDao.isOptimizable(layer, 5, 3600));
Expand All @@ -532,7 +532,7 @@ public void isOptimizable() {
* Assert True
*/
jdbcTemplate.update(
"UPDATE layer_usage SET int_core_time_success = 3500 * 5" +
"UPDATE layer_usage SET int_core_time_success = 3500 * 5 " +
"WHERE pk_layer=?", layer.getLayerId());

assertTrue(layerDao.isOptimizable(layer, 5, 3600));
Expand Down

0 comments on commit 8e35d95

Please sign in to comment.