Package com.intersys.cache

Examples of com.intersys.cache.Dataholder


         Dataholder[] argv = new Dataholder[1];
         argv[0] = Dataholder.create(list);

         Database conn =  CacheDatabase.getDatabase(con);

         Dataholder res;

         try
         {
            res = conn.runClassMethod("CM.methgetClassDefinition", "getClassDefinition", argv, Database.RET_OBJECT);
         }
         catch (CacheException e)
         {
            Statement stat = con.createStatement();
            stat.executeUpdate
            (

               "CREATE METHOD CM.getClassDefinition(IN className %String)\n" +
                  "RETURNS Integer\n" +
                  "PROCEDURE\n" +
                  "LANGUAGE COS\n" +
                  "{\n" +
                  "   new id,oref,oFile,file\n" +
                  "   if $F($ZV,\"Linux\") \n" +
                  "      set file = \"$HOME/CacheTemp\"_$job_\".xml\"\n" +
                  "   else \n" +
                  "      set file = \"c:\\\\temp\\\\$CacheTemp\"_$job_\".xml\"   \n" +
                  "   do $SYSTEM.OBJ.ExportCDL(className ,file, \"-d\")\n" +
                  "   set oFile = ##class(%FileBinaryStream).%New()\n" +
                  "   do oFile.LinkToFile(file)\n" +
                  "\n" +
                  "   set outStream = ##class(%GlobalCharacterStream).%New()\n" +
                  "   do outStream.CopyFrom(oFile)\n" +
                  "   quit outStream\n" +
                  "}"
            );
            stat.close();

            res = conn.runClassMethod("CM.methgetClassDefinition", "getClassDefinition", argv, Database.RET_OBJECT);
         }


         CacheObject cobj = res.getCacheObject();
         CharacterStream characterStream = (CharacterStream) (cobj.newJavaInstance());

         CacheReader reader = characterStream.getReader();

         StringBuffer sb = new StringBuffer();
View Full Code Here


        
         Database conn =  (JBindDatabase) CacheDatabase.getDatabase(session.getSQLConnection().getConnection());

         Id id = new Id(processData.pid);
         com.intersys.classes.SYSTEM.Process proc = (com.intersys.classes.SYSTEM.Process) com.intersys.classes.SYSTEM.Process._open(conn, id);
         Dataholder dataholder = proc.terminate();
         return dataholder.getIntValue();
      }
      catch (Exception e)
      {
         throw new RuntimeException(e);
      }
View Full Code Here

         Dataholder[] argv = new Dataholder[0];

         Connection con = _session.getSQLConnection().getConnection();
         Database database =  (JBindDatabase) CacheDatabase.getDatabase(con);

         Dataholder res = null;
         try
         {
            res = database.runClassMethod("CM.methM1", "M1", argv, Database.RET_OBJECT);
         }
         catch (CacheException e)
         {
            Statement stat = con.createStatement();
            stat.executeUpdate
            (

               "CREATE METHOD CM.M1()" +
               "  RETURNS %GlobalCharacterStream" +
               "  LANGUAGE COS" +
               "  {" +
               "     SET outStream = ##class(%GlobalCharacterStream).%New()" +
               "     SET c=\"\"" +
               "     DO list^%Wslocks(,.d,.c)" +
               "     SET lockCount=$Length(d,$$del1^%Wprim)" +
               "     FOR index=1:1:lockCount-1 {" +
               "         DO outStream.WriteLine($PIECE(d,$$del1^%Wprim,index))" +
               "     }" +
               "     quit outStream" +
               "  }"
            );
            stat.close();

            res = database.runClassMethod("CM.methM1", "M1", argv, Database.RET_OBJECT);
         }

         CacheObject cobj = res.getCacheObject();
         if (cobj == null)
         {
            System.out.println("null");
         }
         CharacterStream cs = (CharacterStream)(cobj.newJavaInstance());
View Full Code Here

   }

   public Dataholder terminate() throws CacheException
   {
      Dataholder[] args = new Dataholder[0];
      Dataholder res=mInternal.runInstanceMethod("Terminate",args,Database.RET_PRIM);
      return res;

   }
View Full Code Here

         argv[0] = Dataholder.create(selectSQL);

         Database conn =  (JBindDatabase) CacheDatabase.getDatabase(_session.getSQLConnection().getConnection());
         //Dataholder res = conn.runClassMethod("%Library.CMUtilities", "getExecutionPlan", argv, Database.RET_OBJECT);

         Dataholder res = null;
         try
         {
            res = conn.runClassMethod("CM.methM2", "M2", argv, Database.RET_OBJECT);
         }
         catch (CacheException e)
         {
            Statement stat = _session.getSQLConnection().createStatement();
            stat.executeUpdate
            (

            "CREATE METHOD CM.M2(IN sql %String)" +
                     "  RETURNS %GlobalCharacterStream" +
                     "  LANGUAGE COS" +
                     "  {" +
                     "     quit:$get(sql)=\"\" \"\"" +
                     "     kill %plan\n" +
                     "     set outStream = ##class(%GlobalCharacterStream).%New()" +
                     "     set sql(1)=sql,sql=1" +
                     "     do ShowPlan^%apiSQL(.sql,1)" +
                     "     set nSub = 1,line = \"\"" +
                     "     set to = +$g(%plan)+1" +
                     "     while nSub<to " +
                     "     {" +
                     "        set line = $g(%plan(nSub))" +
                     "        do outStream.WriteLine(line)" +
                     "        set nSub = nSub + 1" +
                     "     }" +
                     "     kill %plan\n" +
                     "     quit outStream" +
                     "  }"
            );
            stat.close();

            res = conn.runClassMethod("CM.methM2", "M2", argv, Database.RET_OBJECT);
         }


         CacheObject cobj = res.getCacheObject();
         CharacterStream characterStream = (CharacterStream) (cobj.newJavaInstance());

         CacheReader reader = characterStream.getReader();

         StringBuffer sb = new StringBuffer();
View Full Code Here

TOP

Related Classes of com.intersys.cache.Dataholder

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.