Uploaded image for project: 'NHibernate'
  1. NHibernate
  2. NH-847

Oracle stored procedure with Ref Cursor out

    Details

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

      Gliffy Diagrams

        Attachments

          Activity

          Hide
          griffore 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
          griffore 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
          griffore Matthew Griffore added a comment -

          Any chance of increasing the priority of this issue?

          Show
          griffore Matthew Griffore added a comment - Any chance of increasing the priority of this issue?
          Show
          flukefan 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
          griffore Matthew Griffore added a comment -

          Is this fix available in 2.1.2GA?

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

          Yes, notwithstanding NH-2027.

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

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Who's Looking?