Loading src/main/java/it/inaf/oats/vospace/persistence/NodeDAO.java +12 −11 Original line number Diff line number Diff line Loading @@ -106,7 +106,7 @@ public class NodeDAO { + "c.type, c.async_trans, c.sticky, c.job_id IS NOT NULL AS busy_state, c.creator_id, c.group_read, c.group_write,\n" + "c.is_public, c.content_length, c.created_on, c.last_modified, c.accept_views, c.provide_views, c.quota, c.content_md5, c.target\n" + "FROM node n\n" + "JOIN node c ON c.path ~ (n.path::varchar || ? || '*{1}')::lquery OR c.path = n.path\n" + "JOIN node c ON c.parent_path = n.path OR c.path = n.path\n" + "WHERE n.node_id = id_from_vos_path(?)\n" + "ORDER BY vos_path"; Loading @@ -116,7 +116,6 @@ public class NodeDAO { ps.setString(++i, path); ps.setString(++i, path); ps.setString(++i, "/".equals(path) ? "" : "/"); ps.setString(++i, "/".equals(path) ? "" : "."); ps.setString(++i, path); return ps; }, (row, index) -> { Loading Loading @@ -317,8 +316,8 @@ public class NodeDAO { } public void renameNode(Long nodeId, String name) { String sql = "UPDATE node SET name = ?\n, os_name = COALESCE(os_name, name)" + "WHERE path ~ ('*.' || ?)::lquery"; String sql = "UPDATE node SET name = ?, os_name = COALESCE(os_name, name) " + "WHERE node_id = ?"; jdbcTemplate.update(conn -> { PreparedStatement ps = conn.prepareStatement(sql); Loading Loading @@ -413,8 +412,10 @@ public class NodeDAO { } public void setBranchJobId(Long rootNodeId, String jobId) { String sql = "UPDATE node SET job_id = ?\n" + "WHERE path ~ ('*.' || ? || '.*')::lquery"; String sql = "UPDATE node c SET job_id = ? " + "FROM node r " + "WHERE r.node_id = ? " + "AND r.path @> c.path"; jdbcTemplate.update(conn -> { PreparedStatement ps = conn.prepareStatement(sql); Loading Loading
src/main/java/it/inaf/oats/vospace/persistence/NodeDAO.java +12 −11 Original line number Diff line number Diff line Loading @@ -106,7 +106,7 @@ public class NodeDAO { + "c.type, c.async_trans, c.sticky, c.job_id IS NOT NULL AS busy_state, c.creator_id, c.group_read, c.group_write,\n" + "c.is_public, c.content_length, c.created_on, c.last_modified, c.accept_views, c.provide_views, c.quota, c.content_md5, c.target\n" + "FROM node n\n" + "JOIN node c ON c.path ~ (n.path::varchar || ? || '*{1}')::lquery OR c.path = n.path\n" + "JOIN node c ON c.parent_path = n.path OR c.path = n.path\n" + "WHERE n.node_id = id_from_vos_path(?)\n" + "ORDER BY vos_path"; Loading @@ -116,7 +116,6 @@ public class NodeDAO { ps.setString(++i, path); ps.setString(++i, path); ps.setString(++i, "/".equals(path) ? "" : "/"); ps.setString(++i, "/".equals(path) ? "" : "."); ps.setString(++i, path); return ps; }, (row, index) -> { Loading Loading @@ -317,8 +316,8 @@ public class NodeDAO { } public void renameNode(Long nodeId, String name) { String sql = "UPDATE node SET name = ?\n, os_name = COALESCE(os_name, name)" + "WHERE path ~ ('*.' || ?)::lquery"; String sql = "UPDATE node SET name = ?, os_name = COALESCE(os_name, name) " + "WHERE node_id = ?"; jdbcTemplate.update(conn -> { PreparedStatement ps = conn.prepareStatement(sql); Loading Loading @@ -413,8 +412,10 @@ public class NodeDAO { } public void setBranchJobId(Long rootNodeId, String jobId) { String sql = "UPDATE node SET job_id = ?\n" + "WHERE path ~ ('*.' || ? || '.*')::lquery"; String sql = "UPDATE node c SET job_id = ? " + "FROM node r " + "WHERE r.node_id = ? " + "AND r.path @> c.path"; jdbcTemplate.update(conn -> { PreparedStatement ps = conn.prepareStatement(sql); Loading