Fic MsSQL and Oracle prepared statement building issue

feature/appm-store/pbac
lasanthaDLPDS 5 years ago
parent 6abcb8f394
commit 6b72f71101

@ -135,12 +135,12 @@ public class OracleApplicationDAOImpl extends GenericApplicationDAOImpl {
try (PreparedStatement stmt = conn.prepareStatement(sql); try (PreparedStatement stmt = conn.prepareStatement(sql);
){ ){
if (filter.getLimit() != -1) { if (filter.getLimit() != -1) {
stmt.setInt(paramIndex++, filter.getOffset());
if (filter.getLimit() == 0) { if (filter.getLimit() == 0) {
stmt.setInt(paramIndex++, 100); stmt.setInt(paramIndex++, 100);
} else { } else {
stmt.setInt(paramIndex++, filter.getLimit()); stmt.setInt(paramIndex++, filter.getLimit());
} }
stmt.setInt(paramIndex++, filter.getOffset());
} }
stmt.setInt(paramIndex++, tenantId); stmt.setInt(paramIndex++, tenantId);

@ -133,12 +133,12 @@ public class SQLServerApplicationDAOImpl extends GenericApplicationDAOImpl {
try (PreparedStatement stmt = conn.prepareStatement(sql); try (PreparedStatement stmt = conn.prepareStatement(sql);
){ ){
if (filter.getLimit() != -1) { if (filter.getLimit() != -1) {
stmt.setInt(paramIndex++, filter.getOffset());
if (filter.getLimit() == 0) { if (filter.getLimit() == 0) {
stmt.setInt(paramIndex++, 100); stmt.setInt(paramIndex++, 100);
} else { } else {
stmt.setInt(paramIndex++, filter.getLimit()); stmt.setInt(paramIndex++, filter.getLimit());
} }
stmt.setInt(paramIndex++, filter.getOffset());
} }
stmt.setInt(paramIndex++, tenantId); stmt.setInt(paramIndex++, tenantId);

@ -70,8 +70,8 @@ public class OracleReviewDAOImpl extends GenericReviewDAOImpl {
statement.setInt(1, releaseId); statement.setInt(1, releaseId);
statement.setInt(2, Constants.REVIEW_PARENT_ID); statement.setInt(2, Constants.REVIEW_PARENT_ID);
statement.setInt(3, tenantId); statement.setInt(3, tenantId);
statement.setInt(4, request.getLimit()); statement.setInt(4, request.getOffSet());
statement.setInt(5, request.getOffSet()); statement.setInt(5, request.getLimit());
try (ResultSet rs = statement.executeQuery()) { try (ResultSet rs = statement.executeQuery()) {
return DAOUtil.loadReviews(rs); return DAOUtil.loadReviews(rs);
} }
@ -124,8 +124,8 @@ public class OracleReviewDAOImpl extends GenericReviewDAOImpl {
} }
ps.setInt(index++, Constants.REVIEW_PARENT_ID); ps.setInt(index++, Constants.REVIEW_PARENT_ID);
ps.setInt(index++, tenantId); ps.setInt(index++, tenantId);
ps.setInt(index++, request.getLimit()); ps.setInt(index++, request.getOffSet());
ps.setInt(index, request.getOffSet()); ps.setInt(index, request.getLimit());
try (ResultSet rs = ps.executeQuery()) { try (ResultSet rs = ps.executeQuery()) {
return DAOUtil.loadReviews(rs); return DAOUtil.loadReviews(rs);
} }
@ -180,8 +180,8 @@ public class OracleReviewDAOImpl extends GenericReviewDAOImpl {
ps.setInt(index++, Constants.REVIEW_PARENT_ID); ps.setInt(index++, Constants.REVIEW_PARENT_ID);
ps.setString(index++, username); ps.setString(index++, username);
ps.setInt(index++, tenantId); ps.setInt(index++, tenantId);
ps.setInt(index++, request.getLimit()); ps.setInt(index++, request.getOffSet());
ps.setInt(index, request.getOffSet()); ps.setInt(index, request.getLimit());
try (ResultSet rs = ps.executeQuery()) { try (ResultSet rs = ps.executeQuery()) {
return DAOUtil.loadReviews(rs); return DAOUtil.loadReviews(rs);
} }

@ -70,8 +70,8 @@ public class SQLServerReviewDAOImpl extends GenericReviewDAOImpl {
statement.setInt(1, releaseId); statement.setInt(1, releaseId);
statement.setInt(2, Constants.REVIEW_PARENT_ID); statement.setInt(2, Constants.REVIEW_PARENT_ID);
statement.setInt(3, tenantId); statement.setInt(3, tenantId);
statement.setInt(4, request.getLimit()); statement.setInt(4, request.getOffSet());
statement.setInt(5, request.getOffSet()); statement.setInt(5, request.getLimit());
try (ResultSet rs = statement.executeQuery()) { try (ResultSet rs = statement.executeQuery()) {
return DAOUtil.loadReviews(rs); return DAOUtil.loadReviews(rs);
} }
@ -124,8 +124,8 @@ public class SQLServerReviewDAOImpl extends GenericReviewDAOImpl {
} }
ps.setInt(index++, Constants.REVIEW_PARENT_ID); ps.setInt(index++, Constants.REVIEW_PARENT_ID);
ps.setInt(index++, tenantId); ps.setInt(index++, tenantId);
ps.setInt(index++, request.getLimit()); ps.setInt(index++, request.getOffSet());
ps.setInt(index, request.getOffSet()); ps.setInt(index, request.getLimit());
try (ResultSet rs = ps.executeQuery()) { try (ResultSet rs = ps.executeQuery()) {
return DAOUtil.loadReviews(rs); return DAOUtil.loadReviews(rs);
} }
@ -180,8 +180,8 @@ public class SQLServerReviewDAOImpl extends GenericReviewDAOImpl {
ps.setInt(index++, Constants.REVIEW_PARENT_ID); ps.setInt(index++, Constants.REVIEW_PARENT_ID);
ps.setString(index++, username); ps.setString(index++, username);
ps.setInt(index++, tenantId); ps.setInt(index++, tenantId);
ps.setInt(index++, request.getLimit()); ps.setInt(index++, request.getOffSet());
ps.setInt(index, request.getOffSet()); ps.setInt(index, request.getLimit());
try (ResultSet rs = ps.executeQuery()) { try (ResultSet rs = ps.executeQuery()) {
return DAOUtil.loadReviews(rs); return DAOUtil.loadReviews(rs);
} }

@ -55,8 +55,8 @@ public class OracleSubscriptionDAOImpl extends GenericSubscriptionDAOImpl {
try (PreparedStatement stmt = conn.prepareStatement(sql)) { try (PreparedStatement stmt = conn.prepareStatement(sql)) {
stmt.setInt(1, appReleaseId); stmt.setInt(1, appReleaseId);
stmt.setInt(2, tenantId); stmt.setInt(2, tenantId);
stmt.setInt(3, limitValue); stmt.setInt(3, offsetValue);
stmt.setInt(4, offsetValue); stmt.setInt(4, limitValue);
try (ResultSet rs = stmt.executeQuery()) { try (ResultSet rs = stmt.executeQuery()) {
while (rs.next()) { while (rs.next()) {
subscribedUsers.add(rs.getString("USER")); subscribedUsers.add(rs.getString("USER"));
@ -95,8 +95,8 @@ public class OracleSubscriptionDAOImpl extends GenericSubscriptionDAOImpl {
try (PreparedStatement ps = conn.prepareStatement(sql)) { try (PreparedStatement ps = conn.prepareStatement(sql)) {
ps.setInt(1, appReleaseId); ps.setInt(1, appReleaseId);
ps.setInt(2, tenantId); ps.setInt(2, tenantId);
ps.setInt(3, limitValue); ps.setInt(3, offsetValue);
ps.setInt(4, offsetValue); ps.setInt(4, limitValue);
try (ResultSet rs = ps.executeQuery()) { try (ResultSet rs = ps.executeQuery()) {
while (rs.next()) { while (rs.next()) {
subscribedRoles.add(rs.getString("ROLE")); subscribedRoles.add(rs.getString("ROLE"));
@ -135,8 +135,8 @@ public class OracleSubscriptionDAOImpl extends GenericSubscriptionDAOImpl {
try (PreparedStatement ps = conn.prepareStatement(sql)) { try (PreparedStatement ps = conn.prepareStatement(sql)) {
ps.setInt(1, appReleaseId); ps.setInt(1, appReleaseId);
ps.setInt(2, tenantId); ps.setInt(2, tenantId);
ps.setInt(3, limitValue); ps.setInt(3, offsetValue);
ps.setInt(4, offsetValue); ps.setInt(4, limitValue);
try (ResultSet rs = ps.executeQuery()) { try (ResultSet rs = ps.executeQuery()) {
while (rs.next()) { while (rs.next()) {
subscribedGroups.add(rs.getString("GROUPS")); subscribedGroups.add(rs.getString("GROUPS"));

@ -55,8 +55,8 @@ public class SQLServerSubscriptionDAOImpl extends GenericSubscriptionDAOImpl {
try (PreparedStatement stmt = conn.prepareStatement(sql)) { try (PreparedStatement stmt = conn.prepareStatement(sql)) {
stmt.setInt(1, appReleaseId); stmt.setInt(1, appReleaseId);
stmt.setInt(2, tenantId); stmt.setInt(2, tenantId);
stmt.setInt(3, limitValue); stmt.setInt(3, offsetValue);
stmt.setInt(4, offsetValue); stmt.setInt(4, limitValue);
try (ResultSet rs = stmt.executeQuery()) { try (ResultSet rs = stmt.executeQuery()) {
while (rs.next()) { while (rs.next()) {
subscribedUsers.add(rs.getString("USER")); subscribedUsers.add(rs.getString("USER"));
@ -95,8 +95,8 @@ public class SQLServerSubscriptionDAOImpl extends GenericSubscriptionDAOImpl {
try (PreparedStatement ps = conn.prepareStatement(sql)) { try (PreparedStatement ps = conn.prepareStatement(sql)) {
ps.setInt(1, appReleaseId); ps.setInt(1, appReleaseId);
ps.setInt(2, tenantId); ps.setInt(2, tenantId);
ps.setInt(3, limitValue); ps.setInt(3, offsetValue);
ps.setInt(4, offsetValue); ps.setInt(4, limitValue);
try (ResultSet rs = ps.executeQuery()) { try (ResultSet rs = ps.executeQuery()) {
while (rs.next()) { while (rs.next()) {
subscribedRoles.add(rs.getString("ROLE")); subscribedRoles.add(rs.getString("ROLE"));
@ -135,8 +135,8 @@ public class SQLServerSubscriptionDAOImpl extends GenericSubscriptionDAOImpl {
try (PreparedStatement ps = conn.prepareStatement(sql)) { try (PreparedStatement ps = conn.prepareStatement(sql)) {
ps.setInt(1, appReleaseId); ps.setInt(1, appReleaseId);
ps.setInt(2, tenantId); ps.setInt(2, tenantId);
ps.setInt(3, limitValue); ps.setInt(3, offsetValue);
ps.setInt(4, offsetValue); ps.setInt(4, limitValue);
try (ResultSet rs = ps.executeQuery()) { try (ResultSet rs = ps.executeQuery()) {
while (rs.next()) { while (rs.next()) {
subscribedGroups.add(rs.getString("GROUPS")); subscribedGroups.add(rs.getString("GROUPS"));

Loading…
Cancel
Save