db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r534610 - in /db/derby/code/trunk/java: client/org/apache/derby/client/net/NetStatementRequest.java drda/org/apache/derby/impl/drda/DRDAConnThread.java
Date Wed, 02 May 2007 20:45:19 GMT
Author: rhillegas
Date: Wed May  2 13:45:17 2007
New Revision: 534610

URL: http://svn.apache.org/viewvc?view=rev&rev=534610
Log:
DERBY-2506: Committed Narayanan's PreparedCallable_DRDA_v5.diff, adding some BLOB locator
support.

Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatementRequest.java
    db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatementRequest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatementRequest.java?view=diff&rev=534610&r1=534609&r2=534610
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatementRequest.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatementRequest.java Wed
May  2 13:45:17 2007
@@ -849,6 +849,20 @@
                         }
 
                         break;
+                    case DRDAConstants.DRDA_TYPE_NLOBLOC:
+                        //The FD:OCA data or the FDODTA contains the locator
+                        //value corresponding to the LOB. write the integer
+                        //value representing the locator here.
+                        writeIntFdocaData(((Blob)inputs[i]).
+                                getLocator());
+                        break;
+                    case DRDAConstants.DRDA_TYPE_NCLOBLOC:
+                        //The FD:OCA data or the FDODTA contains the locator
+                        //value corresponding to the LOB. write the integer
+                        //value representing the locator here.
+                        writeIntFdocaData(((Clob)inputs[i]).
+                                getLocator());
+                        break;
                     default:
                         throw new SqlException(netAgent_.logWriter_, 
                             new ClientMessageId(SQLState.NET_UNRECOGNIZED_JDBC_TYPE),
@@ -1325,6 +1339,14 @@
                         lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NLOBBYTES;
                         lidAndLengths[i][1] =
                                 buildPlaceholderLength(parameterMetaData.sqlLength_[i]);
+                    } else if (b instanceof Blob && ((Blob)b).isLocator()){
+                        //we are sending locators.
+                        //Here the LID local identifier in the FDODSC
+                        //FD:OCA descriptor should be initialized as
+                        //to contain a BLOB locator.
+                        lidAndLengths[i][0] = 
+                                    DRDAConstants.DRDA_TYPE_NLOBLOC;
+                        lidAndLengths[i][1] = 4;
                     } else {
                         lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NLOBBYTES;
                         try {
@@ -1356,6 +1378,15 @@
                         
                         if (c == null) {
                             lobLength = parameterMetaData.sqlLength_[i];
+                        } else if (c instanceof Clob && ((Clob)c).isLocator()) {
+                            //The inputRow contains an Integer meaning that
+                            //we are sending locators.
+                            //Here the LID local identifier in the FDODSC
+                            //FD:OCA descriptor should be initialized as
+                            //to contain a CLOB locator.
+                            lidAndLengths[i][0] = 
+                                    DRDAConstants.DRDA_TYPE_NCLOBLOC;
+                            lidAndLengths[i][1] = 4;
                         } else if (isExternalClob) {
                             try {
                                 lobLength = c.length();

Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java?view=diff&rev=534610&r1=534609&r2=534610
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java Wed May 
2 13:45:17 2007
@@ -4439,6 +4439,42 @@
 				 }
 				 break;
 			 }
+                        case DRDAConstants.DRDA_TYPE_NLOBLOC:
+                        {
+                            //read the locator value
+                            int paramVal = reader.readInt(getByteOrder());
+                            
+                            if (SanityManager.DEBUG)
+                                trace("locator value is: "+paramVal);
+                            
+                            //Map the locator value to the Blob object in the
+                            //Hash map.
+                            java.sql.Blob blobFromLocator = (java.sql.Blob)
+                            database.getConnection().getLOBMapping(paramVal);
+                            
+                            //set the PreparedStatement parameter to the mapped
+                            //Blob object.
+                            ps.setBlob(i+1, blobFromLocator);
+                            break;
+                        }
+                        case DRDAConstants.DRDA_TYPE_NCLOBLOC:
+                        {
+                            //read the locator value.
+                            int paramVal = reader.readInt(getByteOrder());
+                            
+                            if (SanityManager.DEBUG)
+                                trace("locator value is: "+paramVal);
+                            
+                            //Map the locator value to the Clob object in the
+                            //Hash Map.
+                            java.sql.Clob clobFromLocator = (java.sql.Clob)
+                            database.getConnection().getLOBMapping(paramVal);
+                            
+                            //set the PreparedStatement parameter to the mapped
+                            //Clob object.
+                            ps.setClob(i+1, clobFromLocator);
+                            break;
+                        }
 			default:
 				{
 				String paramVal = reader.readLDStringData(stmt.ccsidMBCEncoding);



Mime
View raw message