* @return <b>true</b> if member is blocked (present at associated black list for this list) <b>false</b> otherwise.
* @throws SQLException
*/
public boolean isBlocked (JDCConnection oConn) throws SQLException {
boolean bBlocked;
CallableStatement oCall;
PreparedStatement oStmt;
ResultSet oRSet;
String sList;
String sProc;
String sParm;
if (DebugFile.trace) {
DebugFile.writeln("Begin ListMember.isBlocked([Connection])");
DebugFile.incIdent();
}
sList = oMember.getString(DB.gu_list);
switch (oMember.getShort(DB.tp_member)) {
case Company.ClassId:
sProc = "k_sp_company_blocked";
sParm = oMember.getString(DB.gu_company);
if (DebugFile.trace) DebugFile.writeln("gu_company=" + sParm);
break;
case Contact.ClassId:
sProc = "k_sp_contact_blocked";
sParm = oMember.getString(DB.gu_contact);
if (DebugFile.trace) DebugFile.writeln("gu_contact=" + sParm);
break;
default:
sProc = "k_sp_email_blocked";
sParm = oMember.getString(DB.tx_email);
if (DebugFile.trace) DebugFile.writeln("tx_email=" + sParm);
}
switch (oConn.getDataBaseProduct()) {
case JDCConnection.DBMS_POSTGRESQL:
if (DebugFile.trace) DebugFile.writeln("Connection.prepareStatement(SELECT " + sProc + "(?,?))");
oStmt = oConn.prepareStatement("SELECT " + sProc + "(?,?)", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
oStmt.setString(1, sList);
oStmt.setString(2, sParm);
oRSet = oStmt.executeQuery();
oRSet.next();
bBlocked = (oRSet.getShort(1)!=(short)0);
oRSet.close();
oStmt.close();
break;
case JDCConnection.DBMS_ORACLE:
if (DebugFile.trace) DebugFile.writeln("Connection.prepareCall({ call " + sProc + "(?,?,?)})");
oCall = oConn.prepareCall("{ call " + sProc + "(?,?,?)}");
oCall.setString(1, sList);
oCall.setString(2, sParm);
oCall.registerOutParameter(3, java.sql.Types.DECIMAL);
oCall.execute();
bBlocked = (oCall.getBigDecimal(3).intValue()!=0);
oCall.close();
break;
default:
if (DebugFile.trace) DebugFile.writeln("Connection.prepareCall({ call " + sProc + "(?,?,?)})");
oCall = oConn.prepareCall("{ call " + sProc + "(?,?,?)}");
oCall.setString(1, sList);
oCall.setString(2, sParm);
oCall.registerOutParameter(3, java.sql.Types.SMALLINT);
oCall.execute();
bBlocked = (oCall.getShort(3)!=(short)0);
oCall.close();
}
if (DebugFile.trace) {
DebugFile.decIdent();
DebugFile.writeln("End ListMember.isBlocked() : " + String.valueOf(bBlocked));