Announcement Announcement Module
Collapse
No announcement yet.
ignoring result sets Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ignoring result sets

    Hi,

    I have a sybase stored proc that can return an indeterminate number of result sets while it is working, finally returning a status. I want to ignore those result sets silently.

    If I just dont add a SqlReturnResultSet parameter to my StoredProcedure object, I get warnings in the log file (ResultSet returned from stored procedure but a corresponding SqlReturnResultSet parameter was not declared).

    What I did was to subclass the JdbcTemplate:
    Code:
        
    class MyProc extends StoredProcedure {
        public static final String SQL = "my_proc";
            
        public MyProc () {
            setJdbcTemplate(new JdbcTemplate() {
                /**
                 * overridden to silently ignore any returned result sets
                 */
                protected Map extractReturnedResultSets(CallableStatement cs, List parameters, int updateCount) throws SQLException {
                    logger.debug ("ignoring result sets");
                    return Collections.EMPTY_MAP;
                }
            });
        setDataSource(dataSource);
        setFunction(true);
        setSql(SQL);
        ...
    Question: will this break anything? From what I can tell no, but I'd like to be sure...

  • #2
    Personnaly I would create a new stored procedure that does the job and does not return any resultsets.

    Comment


    • #3
      I don't think you are breaking anything except for compatibility with future faremework modifications.

      Thinking a bit more about this, it might not be a bad idea to provide a specialization of the SqlReturnResultSet parameter that could handle any resultsets encountered. This parameter would have to be generic enough to handle the possible resultsets returned and in your case it could simply ignore them.

      I'll post something when I have more details.

      Comment


      • #4
        I have added a new issue (SPR-593) in Jira for this.

        Comment

        Working...
        X