Commit b54bf4f5 authored by agaikwad's avatar agaikwad

close prepared statement(pickrate method)


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@43461 ce508802-f39f-4f6c-b175-0d175dae99d5
parent da55b71c
...@@ -1157,7 +1157,7 @@ public class DistCommon ...@@ -1157,7 +1157,7 @@ public class DistCommon
* @exception ITMException * @exception ITMException
* @see * @see
*/ */
public double pickRate(String priceList,String trDate,String itemCode,String aLotNo,String listType,Connection conn)throws ITMException public double pickRate(String priceList,String trDate,String itemCode,String aLotNo,String listType,Connection conn)throws ITMException//---1Method
{ {
//System.out.println("--------------[pickRate]---------------------------------"); //System.out.println("--------------[pickRate]---------------------------------");
//System.out.println("DP[priceList/trDate/itemCode/tranType/aLotNo/listType/conn]"); //System.out.println("DP[priceList/trDate/itemCode/tranType/aLotNo/listType/conn]");
...@@ -1176,6 +1176,7 @@ public class DistCommon ...@@ -1176,6 +1176,7 @@ public class DistCommon
//System.out.println("-----------------------------------------------"); //System.out.println("-----------------------------------------------");
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
PreparedStatement pstmt2 = null;
ResultSet rs = null; ResultSet rs = null;
ResultSet rs2 = null; ResultSet rs2 = null;
ResultSet rs3 = null; ResultSet rs3 = null;
...@@ -1299,26 +1300,26 @@ public class DistCommon ...@@ -1299,26 +1300,26 @@ public class DistCommon
+ "AND LIST_TYPE = 'L' " + "AND LIST_TYPE = 'L' "
+ "AND EFF_FROM <= ? " + "AND EFF_FROM <= ? "
+ "AND VALID_UPTO >= ?"; + "AND VALID_UPTO >= ?";
pstmt = conn.prepareStatement(sql); pstmt2 = conn.prepareStatement(sql);
pstmt.setTimestamp(1,tranDate); pstmt2.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate); pstmt2.setTimestamp(2,tranDate);
rs2 = pstmt.executeQuery(); rs2 = pstmt2.executeQuery();
//System.out.println("The priceListParent sql .. "+sql); //System.out.println("The priceListParent sql .. "+sql);
if(rs2.next()) if(rs2.next())
{ {
rate = rs2.getDouble(1); rate = rs2.getDouble(1);
//System.out.println("The rate inside priceListParent is ..."+rate); //System.out.println("The rate inside priceListParent is ..."+rate);
rs2.close(); // 22/06/09 manoharan rs2.close(); // 22/06/09 manoharan
pstmt.close(); // 22/06/09 manoharan pstmt2.close(); // 22/06/09 manoharan
rs2 =null; // 22/06/09 manoharan rs2 =null; // 22/06/09 manoharan
pstmt = null; // 22/06/09 manoharan pstmt2 = null; // 22/06/09 manoharan
} }
else else
{ {
rs2.close(); // 22/06/09 manoharan rs2.close(); // 22/06/09 manoharan
pstmt.close(); // 22/06/09 manoharan pstmt2.close(); // 22/06/09 manoharan
rs2 =null; // 22/06/09 manoharan rs2 =null; // 22/06/09 manoharan
pstmt = null; // 22/06/09 manoharan pstmt2 = null; // 22/06/09 manoharan
return -1; return -1;
} }
...@@ -2127,7 +2128,7 @@ public class DistCommon ...@@ -2127,7 +2128,7 @@ public class DistCommon
* @exception ITMException * @exception ITMException
* @see * @see
*/ */
public double pickRate(String priceList,String trDate,String itemCode,String aLotNo,String listType,double quantity,String aunit,Connection conn)throws ITMException public double pickRate(String priceList,String trDate,String itemCode,String aLotNo,String listType,double quantity,String aunit,Connection conn)throws ITMException//Mthod3
{ {
//System.out.println("--------------[pickRate]---------------------------------"); //System.out.println("--------------[pickRate]---------------------------------");
//System.out.println("DP[priceList/trDate/itemCode/tranType/aLotNo/listType/quantity/unit/conn]"); //System.out.println("DP[priceList/trDate/itemCode/tranType/aLotNo/listType/quantity/unit/conn]");
...@@ -3296,7 +3297,7 @@ public class DistCommon ...@@ -3296,7 +3297,7 @@ public class DistCommon
* @exception ITMException * @exception ITMException
* @see * @see
*/ */
public double pickRate(String priceList,String trDate,String itemCode,String aLotNo,String listType,double quantity,Connection conn)throws ITMException public double pickRate(String priceList,String trDate,String itemCode,String aLotNo,String listType,double quantity,Connection conn)throws ITMException//Method 4
{ {
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
Statement stmt = null; Statement stmt = null;
...@@ -8286,6 +8287,7 @@ public class DistCommon ...@@ -8286,6 +8287,7 @@ public class DistCommon
System.out.println("@@@@@--------------[pickRate]--[(String priceList,String trDate,String itemCode,String aLotNo,Connection conn)]-called------------------------------"); System.out.println("@@@@@--------------[pickRate]--[(String priceList,String trDate,String itemCode,String aLotNo,Connection conn)]-called------------------------------");
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
PreparedStatement pstmt2 = null;
ResultSet rs = null; ResultSet rs = null;
ResultSet rs2 = null; ResultSet rs2 = null;
ResultSet rs3 = null; ResultSet rs3 = null;
...@@ -8392,25 +8394,25 @@ public class DistCommon ...@@ -8392,25 +8394,25 @@ public class DistCommon
+ "AND LIST_TYPE = ? " + "AND LIST_TYPE = ? "
+ "AND EFF_FROM <= ? " + "AND EFF_FROM <= ? "
+ "AND VALID_UPTO >= ?"; + "AND VALID_UPTO >= ?";
pstmt = conn.prepareStatement(sql); pstmt2 = conn.prepareStatement(sql);
pstmt.setString(1,listType); pstmt2.setString(1,listType);
pstmt.setTimestamp(2,tranDate); pstmt2.setTimestamp(2,tranDate);
pstmt.setTimestamp(3,tranDate); pstmt2.setTimestamp(3,tranDate);
rs2 = pstmt.executeQuery(); rs2 = pstmt2.executeQuery();
if(rs2.next()) if(rs2.next())
{ {
rate = rs2.getDouble(1); rate = rs2.getDouble(1);
rs2.close(); rs2.close();
pstmt.close(); pstmt2.close();
rs2 =null; rs2 =null;
pstmt = null; pstmt2 = null;
} }
else else
{ {
rs2.close(); rs2.close();
pstmt.close(); pstmt2.close();
rs2 =null; rs2 =null;
pstmt = null; pstmt2 = null;
return -1; return -1;
} }
...@@ -9140,6 +9142,7 @@ public class DistCommon ...@@ -9140,6 +9142,7 @@ public class DistCommon
System.out.println("@@@@@--------------[pickRate]--[(String priceList,String trDate,String itemCode,Connection conn)]-called------------------------------"); System.out.println("@@@@@--------------[pickRate]--[(String priceList,String trDate,String itemCode,Connection conn)]-called------------------------------");
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
PreparedStatement pstmt2 = null;
ResultSet rs = null; ResultSet rs = null;
ResultSet rs2 = null; ResultSet rs2 = null;
ResultSet rs3 = null; ResultSet rs3 = null;
...@@ -9229,25 +9232,25 @@ public class DistCommon ...@@ -9229,25 +9232,25 @@ public class DistCommon
+ "AND LIST_TYPE = ? " + "AND LIST_TYPE = ? "
+ "AND EFF_FROM <= ? " + "AND EFF_FROM <= ? "
+ "AND VALID_UPTO >= ?"; + "AND VALID_UPTO >= ?";
pstmt = conn.prepareStatement(sql); pstmt2 = conn.prepareStatement(sql);
pstmt.setString(1,listType); pstmt2.setString(1,listType);
pstmt.setTimestamp(2,tranDate); pstmt2.setTimestamp(2,tranDate);
pstmt.setTimestamp(3,tranDate); pstmt2.setTimestamp(3,tranDate);
rs2 = pstmt.executeQuery(); rs2 = pstmt2.executeQuery();
if(rs2.next()) if(rs2.next())
{ {
rate = rs2.getDouble(1); rate = rs2.getDouble(1);
rs2.close(); rs2.close();
pstmt.close(); pstmt2.close();
rs2 =null; rs2 =null;
pstmt = null; pstmt2 = null;
} }
else else
{ {
rs2.close(); rs2.close();
pstmt.close(); pstmt2.close();
rs2 =null; rs2 =null;
pstmt = null; pstmt2 = null;
return -1; return -1;
} }
......
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