Commit 3f0c2edf authored by manohar's avatar manohar

preparedstatement used in place of statement


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@92124 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 450885e1
...@@ -138,7 +138,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -138,7 +138,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
Connection conn = null; Connection conn = null;
ResultSet rs = null; ResultSet rs = null;
ResultSet rs1 = null; ResultSet rs1 = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null,pstmt1 = null ;
Statement st = null; Statement st = null;
StringBuffer retTabSepStrBuff = new StringBuffer(); StringBuffer retTabSepStrBuff = new StringBuffer();
double pendQty = 0; double pendQty = 0;
...@@ -333,16 +333,22 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -333,16 +333,22 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
} }
else else
{ {
sql ="SELECT SUM(STOCK.QUANTITY - STOCK.ALLOC_QTY ),SUM(STOCK.HOLD_QTY ) " sql ="SELECT SUM(STOCK.QUANTITY - case when STOCK.ALLOC_QTY is null then 0 else STOCK.ALLOC_QTY end ),SUM(case when STOCK.HOLD_QTY is null then 0 else STOCK.HOLD_QTY end ) "
+"FROM STOCK,ITEM,LOCATION,INVSTAT " +"FROM STOCK,ITEM,LOCATION,INVSTAT "
+"WHERE (ITEM.ITEM_CODE = STOCK.ITEM_CODE) " +"WHERE (ITEM.ITEM_CODE = STOCK.ITEM_CODE) "
+"AND (LOCATION.LOC_CODE = STOCK.LOC_CODE ) " +"AND (LOCATION.LOC_CODE = STOCK.LOC_CODE ) "
+"AND (LOCATION.INV_STAT = INVSTAT.INV_STAT) " +"AND (LOCATION.INV_STAT = INVSTAT.INV_STAT) "
+"AND INVSTAT.AVAILABLE = 'Y' " +"AND INVSTAT.AVAILABLE = 'Y' "
+"AND STOCK.ITEM_CODE = '"+ rs.getString(6) + "'" +"AND STOCK.ITEM_CODE = ? "
+"AND STOCK.SITE_CODE = '"+ rs.getString(12) +"'" +"AND STOCK.SITE_CODE = ? "
+"AND (STOCK.QUANTITY - STOCK.ALLOC_QTY) > 0 "; +"AND (STOCK.QUANTITY - case when STOCK.ALLOC_QTY is null then 0 else STOCK.ALLOC_QTY end ) > 0 ";
rs1 = st.executeQuery(sql); // 01/11/12 manoharan preparedstatement used instead of statement
//rs1 = st.executeQuery(sql);
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1,rs.getString(6) );
pstmt1.setString(2,rs.getString(12));
rs1 = pstmt1.executeQuery();
if (rs1.next()) if (rs1.next())
{ {
bappend = true; bappend = true;
...@@ -355,6 +361,9 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -355,6 +361,9 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
System.out.println("Bal stk qty for item ....." + rs.getString(6) + " is " + balStockQty+" hold qty="+holdQty); System.out.println("Bal stk qty for item ....." + rs.getString(6) + " is " + balStockQty+" hold qty="+holdQty);
} }
rs1.close(); rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
} }
//if (balStockQty > 0) //if (balStockQty > 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment