Commit e11a972b authored by wansari's avatar wansari

Changed by wasim to close result set and prepared statement for DDUK


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@100953 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 6ef529ac
...@@ -114,7 +114,16 @@ public class StockUpdate ...@@ -114,7 +114,16 @@ public class StockUpdate
this.noArt = 1; this.noArt = 1;
} }
} }
//Changed by wasim on 16-03-2015 to close Prepared Statement/Result Set [START]
if(rs!=null)
{
rs.close();rs=null;
}
if(pstmt!=null)
{
pstmt.close();pstmt=null;
}
//Changed by wasim on 16-03-2015 to close Prepared Statement/Result Set [END]
System.out.println(" no_art accepted 16092014:: "+this.noArt); System.out.println(" no_art accepted 16092014:: "+this.noArt);
//ADDEDBY RITESH ON 31/07/14 END //ADDEDBY RITESH ON 31/07/14 END
tempTestDate = Timestamp.valueOf("1900-01-01 00:00:00"); tempTestDate = Timestamp.valueOf("1900-01-01 00:00:00");
...@@ -1356,6 +1365,16 @@ public class StockUpdate ...@@ -1356,6 +1365,16 @@ public class StockUpdate
cctrCodeDr = rs.getString(2); cctrCodeDr = rs.getString(2);
qtyPerArt = rs.getDouble(3); qtyPerArt = rs.getDouble(3);
} }
//Changed by wasim on 16-03-2015 to close Prepared Statement/Result Set [START]
if(rs!=null)
{
rs.close();rs=null;
}
if(pstmt!=null)
{
pstmt.close();pstmt=null;
}
//Changed by wasim on 16-03-2015 to close Prepared Statement/Result Set [END]
value = distCommon.getDisparams("999999","STKTRFR_SUBSTORE_CCTR_CHECK",conn); value = distCommon.getDisparams("999999","STKTRFR_SUBSTORE_CCTR_CHECK",conn);
if (value.equalsIgnoreCase("NULLFOUND")) value = "Y"; if (value.equalsIgnoreCase("NULLFOUND")) value = "Y";
if(value.equalsIgnoreCase("Y")) if(value.equalsIgnoreCase("Y"))
...@@ -1385,6 +1404,16 @@ public class StockUpdate ...@@ -1385,6 +1404,16 @@ public class StockUpdate
{ {
stkRetestDate=rs.getTimestamp(1); stkRetestDate=rs.getTimestamp(1);
} }
//Changed by wasim on 16-03-2015 to close Prepared Statement/Result Set [START]
if(rs!=null)
{
rs.close();rs=null;
}
if(pstmt!=null)
{
pstmt.close();pstmt=null;
}
//Changed by wasim on 16-03-2015 to close Prepared Statement/Result Set [END]
if(this.retestDate != null && this.retestDate.compareTo(tempTestDate) == 0){ if(this.retestDate != null && this.retestDate.compareTo(tempTestDate) == 0){
this.retestDate = stkRetestDate; this.retestDate = stkRetestDate;
} }
...@@ -1437,7 +1466,7 @@ public class StockUpdate ...@@ -1437,7 +1466,7 @@ public class StockUpdate
pstmt.executeUpdate(); pstmt.executeUpdate();
pstmt.close(); pstmt.close();
rs.close(); //rs.close();Changed by wasim on 17-03-2016 to comment as it is already closed
} }
else else
{ {
...@@ -1486,7 +1515,7 @@ public class StockUpdate ...@@ -1486,7 +1515,7 @@ public class StockUpdate
pstmt.setDouble(18,this.holdQty);//added by priyanka pstmt.setDouble(18,this.holdQty);//added by priyanka
pstmt.executeUpdate(); pstmt.executeUpdate();
pstmt.close(); pstmt.close();
rs.close(); //rs.close();Changed by wasim on 17-03-2016 to comment as it is already closed
} }
}//end of count }//end of count
else else
...@@ -1653,6 +1682,12 @@ public class StockUpdate ...@@ -1653,6 +1682,12 @@ public class StockUpdate
pstmt.executeUpdate(); pstmt.executeUpdate();
System.out.println("@@@@@@@ executed sucessfully............"); System.out.println("@@@@@@@ executed sucessfully............");
//Changed by wasim on 16-03-2015 to close Prepared Statement/Result Set [START]
if(pstmt!=null)
{
pstmt.close();pstmt=null;
}
//Changed by wasim on 16-03-2015 to close Prepared Statement/Result Set [END]
} }
} }
if(this.tranType.equalsIgnoreCase("I") || this.tranType.equalsIgnoreCase("ID")) if(this.tranType.equalsIgnoreCase("I") || this.tranType.equalsIgnoreCase("ID"))
...@@ -1687,6 +1722,12 @@ public class StockUpdate ...@@ -1687,6 +1722,12 @@ public class StockUpdate
System.out.println("Query :::- ["+sql+"]"); System.out.println("Query :::- ["+sql+"]");
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.executeUpdate(); pstmt.executeUpdate();
//Changed by wasim on 16-03-2015 to close Prepared Statement/Result Set [START]
if(pstmt!=null)
{
pstmt.close();pstmt=null;
}
//Changed by wasim on 16-03-2015 to close Prepared Statement/Result Set [END]
} }
else if (stockValuation.equalsIgnoreCase("C")) else if (stockValuation.equalsIgnoreCase("C"))
{ {
...@@ -1699,6 +1740,12 @@ public class StockUpdate ...@@ -1699,6 +1740,12 @@ public class StockUpdate
System.out.println("Query :::- ["+sql+"]"); System.out.println("Query :::- ["+sql+"]");
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.executeUpdate(); pstmt.executeUpdate();
//Changed by wasim on 16-03-2015 to close Prepared Statement/Result Set [START]
if(pstmt!=null)
{
pstmt.close();pstmt=null;
}
//Changed by wasim on 16-03-2015 to close Prepared Statement/Result Set [END]
} }
} }
sql = "select count(*) from stockvalue " sql = "select count(*) from stockvalue "
...@@ -1725,6 +1772,12 @@ public class StockUpdate ...@@ -1725,6 +1772,12 @@ public class StockUpdate
System.out.println("Query :::- ["+sql+"]"); System.out.println("Query :::- ["+sql+"]");
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.executeUpdate(); pstmt.executeUpdate();
//Changed by wasim on 16-03-2015 to close Prepared Statement/Result Set [START]
if(pstmt!=null)
{
pstmt.close();pstmt=null;
}
//Changed by wasim on 16-03-2015 to close Prepared Statement/Result Set [END]
}else{ }else{
sql =" update stockvalue set quantity = (case when quantity is null then 0 else quantity end) + (case when "+effQty+" is null then 0 else "+effQty+" end), " sql =" update stockvalue set quantity = (case when quantity is null then 0 else quantity end) + (case when "+effQty+" is null then 0 else "+effQty+" end), "
+"value = (case when value is null then 0 else value end) + ((case when "+effQty+" is null then 0 else "+effQty+" end) * (case when "+this.rate+" is null then 0 else "+this.rate+" end)) " +"value = (case when value is null then 0 else value end) + ((case when "+effQty+" is null then 0 else "+effQty+" end) * (case when "+this.rate+" is null then 0 else "+this.rate+" end)) "
...@@ -1733,7 +1786,13 @@ public class StockUpdate ...@@ -1733,7 +1786,13 @@ public class StockUpdate
+" and VALUE_KEY = '"+this.grade+"'"; +" and VALUE_KEY = '"+this.grade+"'";
System.out.println("Query :::- ["+sql+"]"); System.out.println("Query :::- ["+sql+"]");
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.executeUpdate(); pstmt.executeUpdate();
//Changed by wasim on 16-03-2015 to close Prepared Statement/Result Set [START]
if(pstmt!=null)
{
pstmt.close();pstmt=null;
}
//Changed by wasim on 16-03-2015 to close Prepared Statement/Result Set [END]
} }
}else{ }else{
sql ="update stockvalue set quantity = (case when quantity is null then 0 else quantity end) + (case when "+effQty+" is null then 0 else "+effQty+" end)," sql ="update stockvalue set quantity = (case when quantity is null then 0 else quantity end) + (case when "+effQty+" is null then 0 else "+effQty+" end),"
...@@ -1744,6 +1803,12 @@ public class StockUpdate ...@@ -1744,6 +1803,12 @@ public class StockUpdate
System.out.println("Query :::- ["+sql+"]"); System.out.println("Query :::- ["+sql+"]");
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.executeUpdate(); pstmt.executeUpdate();
//Changed by wasim on 16-03-2015 to close Prepared Statement/Result Set [START]
if(pstmt!=null)
{
pstmt.close();pstmt=null;
}
//Changed by wasim on 16-03-2015 to close Prepared Statement/Result Set [END]
} }
sql =" select (case when quantity is null then 0 else quantity end), (case when value is null then 0 else value end)" sql =" select (case when quantity is null then 0 else quantity end), (case when value is null then 0 else value end)"
+" from stockvalue" +" from stockvalue"
...@@ -1760,6 +1825,16 @@ public class StockUpdate ...@@ -1760,6 +1825,16 @@ public class StockUpdate
quantity1 = rs.getDouble(1); quantity1 = rs.getDouble(1);
value1 = rs.getDouble(2); value1 = rs.getDouble(2);
} }
//Changed by wasim on 16-03-2015 to close Prepared Statement/Result Set [START]
if(rs!=null)
{
rs.close();rs=null;
}
if(pstmt!=null)
{
pstmt.close();pstmt=null;
}
//Changed by wasim on 16-03-2015 to close Prepared Statement/Result Set [END]
System.out.println("Stock Value Quantity : "+quantity1+" Stock Value Value :"+value1); System.out.println("Stock Value Quantity : "+quantity1+" Stock Value Value :"+value1);
if (quantity1 == 0 && value1 != 0 ){ if (quantity1 == 0 && value1 != 0 ){
parmValueStr = distCommon.getDisparams("999999","ON_STKVALUE_ADJENTRY",conn); parmValueStr = distCommon.getDisparams("999999","ON_STKVALUE_ADJENTRY",conn);
...@@ -1806,6 +1881,12 @@ public class StockUpdate ...@@ -1806,6 +1881,12 @@ public class StockUpdate
pstmt.setString(4, this.siteCode); pstmt.setString(4, this.siteCode);
pstmt.setString(5, this.grade); pstmt.setString(5, this.grade);
int K = pstmt.executeUpdate(); int K = pstmt.executeUpdate();
//Changed by wasim on 16-03-2015 to close Prepared Statement/Result Set [START]
if(pstmt!=null)
{
pstmt.close();pstmt=null;
}
//Changed by wasim on 16-03-2015 to close Prepared Statement/Result Set [END]
if(K > 0) if(K > 0)
{ {
...@@ -1826,6 +1907,12 @@ public class StockUpdate ...@@ -1826,6 +1907,12 @@ public class StockUpdate
pstmt.setDouble(4,effQty); pstmt.setDouble(4,effQty);
pstmt.setDouble(5,effQty*this.rate); pstmt.setDouble(5,effQty*this.rate);
pstmt.executeUpdate(); pstmt.executeUpdate();
//Changed by wasim on 16-03-2015 to close Prepared Statement/Result Set [START]
if(pstmt!=null)
{
pstmt.close();pstmt=null;
}
//Changed by wasim on 16-03-2015 to close Prepared Statement/Result Set [END]
}else{ }else{
System.out.println("StockValue update failed, there is no record in stockvalue for " + this.siteCode); System.out.println("StockValue update failed, there is no record in stockvalue for " + this.siteCode);
errString = "VTSTKVERR"; errString = "VTSTKVERR";
......
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