db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r542925 - in /db/derby/code/trunk/java/drda/org/apache/derby/impl/drda: DRDAConnThread.java Database.java
Date Wed, 30 May 2007 20:26:19 GMT
Author: rhillegas
Date: Wed May 30 13:26:17 2007
New Revision: 542925

URL: http://svn.apache.org/viewvc?view=rev&rev=542925
Log:
DERBY-2695: Oystein's soft upgrade support for LOB locators.

Modified:
    db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java
    db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/Database.java

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=542925&r1=542924&r2=542925
==============================================================================
--- 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 30
13:26:17 2007
@@ -2484,7 +2484,19 @@
 			}
 			for (int i = start; i < numVars + start; i++)
 			{
-				outovr_drdaType[i] = reader.readUnsignedByte();
+                int drdaType = reader.readUnsignedByte();
+                if (!database.supportsLocator()) { 
+                    // ignore requests for locator when it is not supported
+                    if ((drdaType >= DRDAConstants.DRDA_TYPE_LOBLOC)
+                        && (drdaType <= DRDAConstants.DRDA_TYPE_NCLOBLOC)) {
+                        if (SanityManager.DEBUG) {
+                            trace("ignoring drdaType: " + drdaType);
+                        }
+                        reader.readNetworkShort(); // Skip rest
+                        continue;
+                    }
+                }
+                outovr_drdaType[i] = drdaType;
 				if (SanityManager.DEBUG)
 					trace("drdaType is: "+ outovr_drdaType[i]);
 				precision = reader.readNetworkShort();

Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/Database.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/Database.java?view=diff&rev=542925&r1=542924&r2=542925
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/Database.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/Database.java Wed May 30 13:26:17
2007
@@ -399,6 +399,34 @@
 				}
 		return s;
 	}
+    
+    private boolean locatorSupport = false;
+    private boolean locatorSupportChecked = false;
+    
+    /**
+     * Checks whether database can support locators.  This is done by
+     * checking whether one of the stored procedures needed for
+     * locators exists.  (If the database has been soft-upgraded from
+     * an earlier version, the procedures will not exist).
+     *
+     * @throws SQLException if metadata call fails
+     * @return <code>true</code> if locators are supported,
+     *         <code>false</code otherwise
+     */
+    boolean supportsLocator() throws SQLException
+    {
+        if (!locatorSupportChecked) {
+            // Check if locator procedures exist
+            ResultSet rs = getConnection().getMetaData()
+                    .getProcedures(null, "SYSIBM", "BLOBTRUNCATE");
+            locatorSupport =  rs.next();  // True if procedure exists
+            rs.close();
+            locatorSupportChecked = true;
+        }
+        
+        return locatorSupport;
+    }
+       
 
     /**
      * This method resets the state of this Database object so that it can



Mime
View raw message