NHibernate
  1. NHibernate
  2. NH-847

Oracle stored procedure with Ref Cursor out

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2.0.Beta2
    • Fix Version/s: 2.1.1.GA
    • Component/s: Core
    • Labels:
      None

      Activity

      Hide
      Matthew Griffore added a comment -

      Isn't it just a matter of adding the required code to the InitializeParameter() method of the Oracle Driver class to properly initialize a ref_cursor parameter. You would most likely have to use a combination of name and sqlType to determine what is a ref_cursor.

      Something like the following:

      private const string RefCursorPrefix = "cur_";

      protected override void InitializeParameter(IDbDataParameter dbParam, string name, SqlType sqlType)
      {
      if (sqlType.DbType == DbType.Guid)

      { base.InitializeParameter(dbParam, name, GuidSqlType); }

      else if (sqlType.DbType == DbType.Object && name.StartsWith(RefCursorPrefix))

      { base.InitializeParameter(dbParam, name, ((OracleParameter)dbParam).OracleDbType = OracleDbType.RefCursor); }

      else

      { base.InitializeParameter(dbParam, name, sqlType); }

      }

      Show
      Matthew Griffore added a comment - Isn't it just a matter of adding the required code to the InitializeParameter() method of the Oracle Driver class to properly initialize a ref_cursor parameter. You would most likely have to use a combination of name and sqlType to determine what is a ref_cursor. Something like the following: private const string RefCursorPrefix = "cur_"; protected override void InitializeParameter(IDbDataParameter dbParam, string name, SqlType sqlType) { if (sqlType.DbType == DbType.Guid) { base.InitializeParameter(dbParam, name, GuidSqlType); } else if (sqlType.DbType == DbType.Object && name.StartsWith(RefCursorPrefix)) { base.InitializeParameter(dbParam, name, ((OracleParameter)dbParam).OracleDbType = OracleDbType.RefCursor); } else { base.InitializeParameter(dbParam, name, sqlType); } }
      Hide
      Matthew Griffore added a comment -

      Any chance of increasing the priority of this issue?

      Show
      Matthew Griffore added a comment - Any chance of increasing the priority of this issue?
      Show
      Richard Brown added a comment - Added support for Oracle stored procedures. Note, fix is for OracleDataClient. Example mappings and PL/SQL can be found at: http://nhibernate.svn.sourceforge.net/viewvc/nhibernate/trunk/nhibernate/src/NHibernate.Test/SqlTest/Custom/Oracle/Mappings.hbm.xml?view=markup http://nhibernate.svn.sourceforge.net/viewvc/nhibernate/trunk/nhibernate/src/NHibernate.Test/SqlTest/Custom/Oracle/StoredProcedures.hbm.xml?view=markup
      Hide
      Matthew Griffore added a comment -

      Is this fix available in 2.1.2GA?

      Show
      Matthew Griffore added a comment - Is this fix available in 2.1.2GA?
      Hide
      Richard Brown added a comment -

      Yes, notwithstanding NH-2027.

      Show
      Richard Brown added a comment - Yes, notwithstanding NH-2027 .

        People

        • Assignee:
          Richard Brown
          Reporter:
          Brian Choi
        • Votes:
          24 Vote for this issue
          Watchers:
          20 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved:

            Who's Looking?