You are viewing a plain text version of this content. The canonical link for it is here.
Posted to lokahi-commits@incubator.apache.org by to...@apache.org on 2006/09/29 16:26:59 UTC

svn commit: r451341 - in /incubator/lokahi/lokahi/branches/mysql: conf/db.properties src/java/org/apache/lokahi/core/api/file/File.java

Author: toback
Date: Fri Sep 29 09:26:58 2006
New Revision: 451341

URL: http://svn.apache.org/viewvc?view=rev&rev=451341
Log:
Re:

http://mail-archives.apache.org/mod_mbox/incubator-lokahi-dev/200609.mbox/%3c451B183D.6030000@free.fr%3e

Modified:
    incubator/lokahi/lokahi/branches/mysql/conf/db.properties
    incubator/lokahi/lokahi/branches/mysql/src/java/org/apache/lokahi/core/api/file/File.java

Modified: incubator/lokahi/lokahi/branches/mysql/conf/db.properties
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/branches/mysql/conf/db.properties?view=diff&rev=451341&r1=451340&r2=451341
==============================================================================
--- incubator/lokahi/lokahi/branches/mysql/conf/db.properties (original)
+++ incubator/lokahi/lokahi/branches/mysql/conf/db.properties Fri Sep 29 09:26:58 2006
@@ -432,7 +432,7 @@
 mysql.core.job.lock.result=SELECT RESULT FROM TMC_JOB where job_id=? FOR UPDATE
 mysql.core.job.store.finish=sp_tmc_add_job2
 mysql.core.job.update=sp_tmc_job_update
-mysql.core.file.prep.blob={call sp_tmc_prep_file_content(?,EMPTY_BLOB())}
+mysql.core.file.prep.blob={call sp_tmc_prep_file_content(?,?)}
 mysql.core.job.prep.blob={call sp_TMC_prep_job(?,EMPTY_BLOB())}
 mysql.tomcat.server.by.name=SELECT * FROM TM_CONTAINER tc WHERE lower(tc.CONTAINER_NAME) like lower(?)
 mysql.core.server.by.name=SELECT h.HARDWARE_ID, h.INSTANCE_ID, h.ENV_ID, h.PHYSICAL_LOCATION, h.HARDWARE_NAME, h.STATUS_ID, h.COMMENTS, h.DEFAULT_IP_ID FROM TMC_HARDWARE h WHERE lower(h.HARDWARE_NAME) like lower(?)

Modified: incubator/lokahi/lokahi/branches/mysql/src/java/org/apache/lokahi/core/api/file/File.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/branches/mysql/src/java/org/apache/lokahi/core/api/file/File.java?view=diff&rev=451341&r1=451340&r2=451341
==============================================================================
--- incubator/lokahi/lokahi/branches/mysql/src/java/org/apache/lokahi/core/api/file/File.java (original)
+++ incubator/lokahi/lokahi/branches/mysql/src/java/org/apache/lokahi/core/api/file/File.java Fri Sep 29 09:26:58 2006
@@ -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()) {
@@ -180,6 +180,19 @@
       throw e;
     }
     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 {