Hi all,

The class File must be patched to be usable with MySql, which doesn't use the broker.blobHack method.
Also one function must be changed in conf/db.properties:
mysql.core.file.prep.blob={call sp_tmc_prep_file_content(?,EMPTYBLOB)}
must be changed to:
mysql.core.file.prep.blob={call sp_tmc_prep_file_content(?,?)}
Sorry to not being able to put a patch for this last.
Best regards,

--
Cordialement,
Ludo - http://www.ubik-products.com
---
"L'amour pour principe et l'ordre pour base; le progres pour but" (A.Comte)
Index: 
/Users/ludo/Workspaces/UbikDevSite/lokahi/src/java/org/apache/lokahi/core/api/file/File.java
===================================================================
--- 
/Users/ludo/Workspaces/UbikDevSite/lokahi/src/java/org/apache/lokahi/core/api/file/File.java
        (revision 450355)
+++ 
/Users/ludo/Workspaces/UbikDevSite/lokahi/src/java/org/apache/lokahi/core/api/file/File.java
        (working copy)
@@ -168,10 +168,10 @@
   private static boolean storeBlob(int id, String toStore) throws SQLException 
{
     boolean ret = false;
     try {
-      broker.useSQL("core.file.prep.blob", id);
-      if (toStore == null) toStore = "";
-      byte[] blobBytes = toStore.getBytes();
-      broker.blobHack("core.file.content.lock", "core.file.content.update", 
id, blobBytes);
+        if 
("oracle".equals(PropertiesFile.getConstantValue("lokahi.broker.type")))
+            storeBlobOracleImpl(id, toStore);
+        else
+            storeBlobStdImpl(id, toStore);
       ret = true;
     } catch (SQLException e) {
       if (logger.isInfoEnabled()) {
@@ -182,6 +182,19 @@
     return ret;
   }
 
+  private static void storeBlobOracleImpl(int id, String toStore) throws 
SQLException {   
+      broker.useSQL("core.file.prep.blob", id);
+      if (toStore == null) toStore = "";
+      byte[] blobBytes = toStore.getBytes();
+      broker.blobHack("core.file.content.lock", "core.file.content.update", 
id, blobBytes);      
+  }
+
+  private static void storeBlobStdImpl(int id, String toStore) throws 
SQLException {
+      if (toStore == null) toStore = "";
+      byte[] blobBytes = toStore.getBytes();
+      broker.useSQL("core.file.prep.blob", id ,blobBytes);
+  }
+
   static boolean delete(File f) throws SQLException {
     return broker.delete("core.file.delete", f.getPk());
   }

Reply via email to