db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r1303372 - in /db/derby/code/branches/10.5: ./ java/ java/client/org/apache/derby/client/am/CallableStatement.java
Date Wed, 21 Mar 2012 12:50:14 GMT
Author: kmarsden
Date: Wed Mar 21 12:50:13 2012
New Revision: 1303372

URL: http://svn.apache.org/viewvc?rev=1303372&view=rev
Log:
DERBY-2515 Network client does not retain the INOUT parameter value change for

Contributed by Rick Hillegas.
Merged /db/derby/code/trunk:r1086799,1087346  just the code change.
The test had conflicts.



Modified:
    db/derby/code/branches/10.5/   (props changed)
    db/derby/code/branches/10.5/java/   (props changed)
    db/derby/code/branches/10.5/java/client/org/apache/derby/client/am/CallableStatement.java

Propchange: db/derby/code/branches/10.5/
------------------------------------------------------------------------------
  Merged /db/derby/code/branches/10.7:r1303263
  Merged /db/derby/code/trunk:r1086799,1087346

Propchange: db/derby/code/branches/10.5/java/
------------------------------------------------------------------------------
  Merged /db/derby/code/branches/10.7/java:r1303263

Modified: db/derby/code/branches/10.5/java/client/org/apache/derby/client/am/CallableStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/client/org/apache/derby/client/am/CallableStatement.java?rev=1303372&r1=1303371&r2=1303372&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/client/org/apache/derby/client/am/CallableStatement.java
(original)
+++ db/derby/code/branches/10.5/java/client/org/apache/derby/client/am/CallableStatement.java
Wed Mar 21 12:50:13 2012
@@ -1215,6 +1215,55 @@ public class CallableStatement extends P
             throw se.getSQLException();
         }
     }
+
+    //----------------------------overrides----------------------------------
+
+    public void completeExecuteCall(Sqlca sqlca, Cursor singletonParams) // no result sets
returned
+    {
+        super.completeExecuteCall( sqlca, singletonParams );
+
+        //
+        // For INOUT parameters, propagate return values back to the input parameter array.
+        // See DERBY-2515.
+        //
+
+        if ( singletonParams == null ) { return ; }
+        if ( parameterMetaData_ == null ) { return; }
+
+        int     cursorParamCount = singletonParams.columns_;
+        
+        for ( int i = 0; i < cursorParamCount; i++ )
+        {
+            if ( parameterMetaData_.sqlxParmmode_[ i ] == java.sql.ParameterMetaData.parameterModeInOut
)
+            {
+                int jdbcParamNumber = i + 1;
+                Object  returnArg;
+                
+                try {
+                    returnArg = singletonParams.isNull_[ i ] ? null : singletonParams.getObject(
jdbcParamNumber );
+                } catch (SqlException se)
+                {
+                    IllegalArgumentException iae = new IllegalArgumentException( se.getMessage()
);
+                    iae.initCause( se );
+                    throw iae;
+                }
+                
+                //
+                // special case to coerce Integer to Short for SMALLINT
+                //
+                if ( parameterMetaData_.types_[ i ] == Types.SMALLINT )
+                {
+                    if ( (returnArg != null) && (returnArg instanceof Integer) )
+                    {
+                        returnArg = new Short( ((Integer) returnArg).shortValue() );
+                    }
+                }
+                
+                setInput( jdbcParamNumber, returnArg );
+            }   // end if INOUT arg
+        }       // end loop through args
+    }
+
     
     //----------------------------helper methods----------------------------------
 



Mime
View raw message