FR: [ 2214883 ] Remove SQL code and Replace for Query
-- JUnit test pending Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2214883
This commit is contained in:
parent
8d6cd95f50
commit
c61ce5d86d
|
@ -22,6 +22,7 @@ import java.sql.PreparedStatement;
|
|||
import java.sql.ResultSet;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
@ -131,37 +132,11 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
|
|||
return m_lines;
|
||||
}
|
||||
//
|
||||
ArrayList<MBankStatementLine> list = new ArrayList<MBankStatementLine>();
|
||||
String sql = "SELECT * FROM C_BankStatementLine "
|
||||
+ "WHERE C_BankStatement_ID=?"
|
||||
+ "ORDER BY Line";
|
||||
PreparedStatement pstmt = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||
pstmt.setInt(1, getC_BankStatement_ID());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
list.add (new MBankStatementLine(getCtx(), rs, get_TrxName()));
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, "getLines", e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
final String whereClause = I_C_BankStatementLine.COLUMNNAME_C_BankStatement_ID+"=?";
|
||||
List<MBankStatementLine> list = new Query(getCtx(),I_C_BankStatementLine.Table_Name,whereClause,get_TrxName())
|
||||
.setParameters(getC_BankStatement_ID())
|
||||
.setOrderBy("Line")
|
||||
.list();
|
||||
MBankStatementLine[] retValue = new MBankStatementLine[list.size()];
|
||||
list.toArray(retValue);
|
||||
return retValue;
|
||||
|
|
Loading…
Reference in New Issue