if (_dbObjs.length > 0) {
Connection conn = _session.getSQLConnection().getConnection();
final StringBuffer buf = new StringBuffer();
for (int i = 0; i < _dbObjs.length; i++) {
final IDatabaseObjectInfo oi = _dbObjs[i];
if (!conn.getCatalog().equals(oi.getCatalogName()))
conn.setCatalog(oi.getCatalogName());
if (oi.getSimpleName().endsWith(";0")) {
// this is a UDF, not a stored procedure.
buf.append("/* WILL NOT EXECUTE USER-DEFINED FUNCTION ");
buf.append(oi.getQualifiedName());
buf.append(" */\n\n");
continue;
}
/* call sp_help on the stored procedure, then look at the second ResultSet for
* the parameter information. */
String useThisName = MssqlIntrospector.getFixedVersionedObjectName(oi.getSimpleName());
CallableStatement stmt = conn.prepareCall("{ call sp_help (?) }");
stmt.setString(1, useThisName);
ResultSet rs;
StringBuffer procExec = new StringBuffer();
procExec.append("DECLARE @rc int\nEXECUTE @rc = [");
procExec.append(oi.getCatalogName());
procExec.append("].[");
procExec.append(oi.getSchemaName());
procExec.append("].[");
procExec.append(useThisName);
procExec.append("] ");
if (!stmt.execute())