[Appsunit-develop] [cvscommit] project/src/net/sourceforge/appsunit/environment AppsSession.java,
Status: Beta
Brought to you by:
jancumps
|
From: Jan C. <jan...@us...> - 2006-11-30 21:06:16
|
Update of /cvsroot/appsunit/project/src/net/sourceforge/appsunit/environment In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv18040 Modified Files: AppsSession.java Log Message: Binding parameters. Index: AppsSession.java =================================================================== RCS file: /cvsroot/appsunit/project/src/net/sourceforge/appsunit/environment/AppsSession.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AppsSession.java 23 Sep 2006 22:12:25 -0000 1.4 --- AppsSession.java 30 Nov 2006 21:06:11 -0000 1.5 *************** *** 43,91 **** PreparedStatement stmt = null; ! String usr = null; stmt = connection.prepareStatement( "select user_id " + "from fnd_user " ! + "where user_name = '" ! + user ! + "'"); rs = stmt.executeQuery(); // execute if (rs.next()) { ! usr = rs.getString(1); // retrieve map_id } rs.close(); ! if (usr == null) { throw new Exception("User " + user + " not found."); } ! String rsp = null; stmt = connection.prepareStatement( "select responsibility_id " + "from fnd_responsibility " ! + "where responsibility_key = '" ! + responsibility ! + "'"); rs = stmt.executeQuery(); // execute if (rs.next()) { ! rsp = rs.getString(1); // retrieve responsibility_id } rs.close(); ! if (rsp == null) { throw new Exception("Responsibility " + responsibility + " not found."); } ! String appl = null; stmt = connection.prepareStatement( "select application_id from fnd_application where " ! + "application_short_name = '" ! + application ! + "'"); rs = stmt.executeQuery(); // execute if (rs.next()) { ! appl = rs.getString(1); // retrieve application_id } rs.close(); ! if (appl == null) { throw new Exception("Application " + application + " not found."); } --- 43,88 ---- PreparedStatement stmt = null; ! int usr = 0; stmt = connection.prepareStatement( "select user_id " + "from fnd_user " ! + "where user_name = ?"); ! stmt.setString(1, user); rs = stmt.executeQuery(); // execute if (rs.next()) { ! usr = rs.getInt(1); // retrieve user_id } rs.close(); ! if (usr == 0) { throw new Exception("User " + user + " not found."); } ! int rsp = 0; stmt = connection.prepareStatement( "select responsibility_id " + "from fnd_responsibility " ! + "where responsibility_key = ?"); ! stmt.setString(1, responsibility); rs = stmt.executeQuery(); // execute if (rs.next()) { ! rsp = rs.getInt(1); // retrieve responsibility_id } rs.close(); ! if (rsp == 0) { throw new Exception("Responsibility " + responsibility + " not found."); } ! int appl = 0; stmt = connection.prepareStatement( "select application_id from fnd_application where " ! + "application_short_name = ?"); ! stmt.setString(1, application); rs = stmt.executeQuery(); // execute if (rs.next()) { ! appl = rs.getInt(1); // retrieve application_id } rs.close(); ! if (appl == 0) { throw new Exception("Application " + application + " not found."); } *************** *** 95,105 **** cstmt = connection.prepareCall( "{ call apps.fnd_global.apps_initialize(" ! + "user_id => " ! + usr ! + ", resp_id => " ! + rsp ! + ", resp_appl_id => " ! + appl + ", security_group_id => null)}"); try { // the first call somethimes fails. --- 92,103 ---- cstmt = connection.prepareCall( "{ call apps.fnd_global.apps_initialize(" ! + "user_id => ?" ! + ", resp_id => ?" ! + ", resp_appl_id => ?" + ", security_group_id => null)}"); + cstmt.setInt(1, usr); + cstmt.setInt(2, rsp); + cstmt.setInt(3, appl); + try { // the first call somethimes fails. |