Package sos.ftphistory.sql

Examples of sos.ftphistory.sql.Insert_cmd


      if (files_id == null || files_id.length() == 0 || files_id.equals("0")) {
       
       
       
       
         Insert_cmd insert1 = new Insert_cmd(getConnection(), getLogger(), SOSFTPHistory.TABLE_FILES);
         insert1.withQuote = true;
         insert1.set("MANDATOR", mandator);
         insert1.set("SOURCE_HOST", source_host);
         insert1.set("SOURCE_HOST_IP", source_host_ip);
         insert1.set("SOURCE_DIR", source_dir);
         insert1.set("SOURCE_FILENAME", source_filename);
         insert1.set("SOURCE_USER", source_user);
         insert1.set("MD5", md5);
         insert1.set_num("FILE_SIZE", file_size);
         insert1.set_direct("CREATED", "%now");
         insert1.set("CREATED_BY", _createdBy);
         insert1.set_direct("MODIFIED", "%now");
         insert1.set("MODIFIED_BY", _createdBy);
         getConnection().execute(insert1.make_cmd());       
       
     
        
        if (getConnection() instanceof SOSDB2Connection) {
          files_id = getConnection().getSingleValue("values identity_val_local()");
        }
        else {
          files_id = getConnection().getLastSequenceValue(SOSFTPHistory.SEQ_TABLE_FILES);
        }
        if (files_id == null || files_id.length() == 0 || files_id.equals("0")) {
          throw new Exception("not found lastSequeceValue: SEQ [" + SOSFTPHistory.SEQ_TABLE_FILES + "] for table " + SOSFTPHistory.TABLE_FILES);
        }
      }

     
     
       Insert_cmd insert2 = new Insert_cmd(getConnection(), getLogger(), SOSFTPHistory.TABLE_FILES_HISTORY);
       insert2.withQuote = true;
       insert2.set("GUID",guid);
       insert2.set("SOSFTP_ID",files_id);
       insert2.set("OPERATION",operation);
       insert2.set("TRANSFER_TIMESTAMP",transfer_timestamp);
       insert2.set_num("PID",pid);
       insert2.set_num("PPID",ppid);
       insert2.set("TARGET_HOST",target_host);
       insert2.set("TARGET_HOST_IP",target_host);
       insert2.set("TARGET_USER",target_user);
       insert2.set("TARGET_DIR",target_dir);
       insert2.set("TARGET_FILENAME",target_filename);
       insert2.set("PROTOCOL",protocol);
       insert2.set_num("PORT",port);
       insert2.set("STATUS",status);
       insert2.setNull("LAST_ERROR_MESSAGE",last_error_message);
       insert2.setNull("LOG_FILENAME",log_filename);
       insert2.setNull("JUMP_HOST",jump_host);
       insert2.setNull("JUMP_HOST_IP",jump_host_ip);
       insert2.setNull("JUMP_USER",jump_user);
       insert2.setNull("JUMP_PROTOCOL",jump_protocol);
       insert2.set_numNull("JUMP_PORT", jump_port);
      
      
         if (recordExtraParameters != null && recordExtraParameters.size() > 0) {
          Iterator it = recordExtraParameters.entrySet().iterator();
          while (it.hasNext()) {
          Map.Entry entry = (Map.Entry) it.next();
          String val = (String) entry.getValue();
          if (val == null || val.length() == 0) {
            val = "NULL";
          }else{
            val = SOSFTPHistory.getNormalizedField(getConnection(), val, 255);
          }
          insert2.set((String) entry.getKey(),val);
          }
         }       
     
     
      String g = getConnection().getSingleValue("select \"GUID\" from " + SOSFTPHistory.TABLE_FILES_HISTORY + " where \"GUID\" = '" + guid + "'");
      if (g == null || g.length() == 0) {
         insert2.set_direct("MODIFIED", "%now");
         insert2.set("MODIFIED_BY", _createdBy);
         insert2.set_direct("CREATED", "%now");
         insert2.set("CREATED_BY", _createdBy);
          getConnection().execute(insert2.make_cmd());       
        return true;
      }else {
        if (isOrder) {
           Update_cmd update1 = new Update_cmd(getConnection(), getLogger(), SOSFTPHistory.TABLE_FILES_HISTORY);
           update1.withQuote = true;
View Full Code Here

TOP

Related Classes of sos.ftphistory.sql.Insert_cmd

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.