Package railo.runtime.type

Examples of railo.runtime.type.QueryImpl


  public static Query getMemoryUsageAsQuery(int type) throws DatabaseException {
   
   
    java.util.List<MemoryPoolMXBean> manager = ManagementFactory.getMemoryPoolMXBeans();
    Iterator<MemoryPoolMXBean> it = manager.iterator();
    Query qry=new QueryImpl(new Collection.Key[]{
        KeyConstants._name,
        KeyConstants._type,
        KeyConstants._used,
        KeyConstants._max,
        KeyConstants._init
    },0,"memory");
   
    int row=0;
    MemoryPoolMXBean bean;
    MemoryUsage usage;
    MemoryType _type;
    while(it.hasNext()){
      bean = it.next();
      usage = bean.getUsage();
      _type = bean.getType();
      if(type==MEMORY_TYPE_HEAP && _type!=MemoryType.HEAP)continue;
      if(type==MEMORY_TYPE_NON_HEAP && _type!=MemoryType.NON_HEAP)continue;
       
      row++;
      qry.addRow();
      qry.setAtEL(KeyConstants._name, row, bean.getName());
      qry.setAtEL(KeyConstants._type, row, _type.name());
      qry.setAtEL(KeyConstants._max, row, Caster.toDouble(usage.getMax()));
      qry.setAtEL(KeyConstants._used, row, Caster.toDouble(usage.getUsed()));
      qry.setAtEL(KeyConstants._init, row, Caster.toDouble(usage.getInit()));
     
    }
    return qry;
  }
View Full Code Here


       
        DatasourceConnection dc=null;
      try {
      dc = pool.getDatasourceConnection(pc,datasource, username, password);
      try {
        new QueryImpl(pc,dc,SELECT,-1,-1,-1,"query");
      }
      catch (PageException e) {
        new QueryImpl(pc,dc,CREATE,-1,-1,-1,"query");
      }
    }
      catch (PageException e) {
      config.getErrWriter();
    }
View Full Code Here

      dc = pool.getDatasourceConnection(ThreadLocalPageContext.get(),datasource, username, password);
      SQLImpl sql = new SQLImpl(INSERT);
      sql.addItems(new SQLItemImpl(application,CFTypes.VARCHAR));
      sql.addItems(new SQLItemImpl(message,CFTypes.VARCHAR));
      sql.addItems(new SQLItemImpl(new DateTimeImpl(),CFTypes.DATE));
      new QueryImpl(ThreadLocalPageContext.get(),dc,sql,-1,-1,-1,"query");
    }
      catch (PageException e) {
      console.log(level, application, message);
    }
    finally{
View Full Code Here

  }
  public static Query createQuery(Collection.Key[] columns, int rows, String name) throws PageException{
    return creator().createQuery(columns, rows, name);
  }
  public static Query createQuery(Array names, Array types, int rows, String name) throws PageException{
    return new QueryImpl(names,types,rows,name);
  }
View Full Code Here

        Element[] elProviders = ConfigWebFactory.getChildren(parent,"resource-provider");
        Element[] elDefaultProviders = ConfigWebFactory.getChildren(parent,"default-resource-provider");
        ResourceProvider[] providers = config.getResourceProviders();
        ResourceProvider defaultProvider = config.getDefaultResourceProvider();
   
        Query qry=new QueryImpl(new String[]{"support","scheme","caseSensitive","default","class","arguments"},elProviders.length+elDefaultProviders.length,"resourceproviders");
        int row=1;
        for(int i=0;i<elDefaultProviders.length;i++) {
          getResourceProviders(new ResourceProvider[]{defaultProvider},qry,elDefaultProviders[i],row++,Boolean.TRUE);
        }
        for(int i=0;i<elProviders.length;i++) {
View Full Code Here

        String[] cols = new String[]{"attributes","isdirectory","lastmodified","length","mode","name",
                "path","url","type","raw"};
        String[] types = new String[]{"VARCHAR","BOOLEAN","DATE","DOUBLE","VARCHAR","VARCHAR",
                "VARCHAR","VARCHAR","VARCHAR","VARCHAR"};
       
        railo.runtime.type.Query query=new QueryImpl(cols,types,0,"query");
       
        // translate directory path for display
        if(directory.length()==0)directory="/";
        else if(directory.startsWith("./"))directory=directory.substring(1);
        else if(directory.charAt(0)!='/')directory='/'+directory;
        if(directory.charAt(directory.length()-1)!='/')directory=directory+'/';
               
        pageContext.setVariable(name,query);
        int row=0;
        for(int i=0;i<files.length;i++) {
            FTPFile file = files[i];
            if(file.getName().equals(".") || file.getName().equals("..")) continue;
            query.addRow();
            row++;
            query.setAt("attributes",row,"");
            query.setAt("isdirectory",row,Caster.toBoolean(file.isDirectory()));
            query.setAt("lastmodified",row,new DateTimeImpl(file.getTimestamp()));
            query.setAt("length",row,Caster.toDouble(file.getSize()));
            query.setAt("mode",row,FTPConstant.getPermissionASInteger(file));
            query.setAt("type",row,FTPConstant.getTypeAsString(file.getType()));
            //query.setAt("permission",row,FTPConstant.getPermissionASInteger(file));
            query.setAt("raw",row,file.getRawListing());
            query.setAt("name",row,file.getName());
            query.setAt("path",row,directory+file.getName());
            query.setAt("url",row,"ftp://"+client.getRemoteAddress().getHostName()+""+directory+file.getName());
        }
        writeCfftp(client);
        return client;
    }
View Full Code Here

      Array array=null;
      Query query=null;
      Object rtn;
      if(listInfo==LIST_INFO_QUERY_ALL || listInfo==LIST_INFO_QUERY_NAME){
        boolean listOnlyNames=listInfo==LIST_INFO_QUERY_NAME;
        rtn=query=new QueryImpl(
        listOnlyNames?new String[]{"name"}:names,
        listOnlyNames?new String[]{"VARCHAR"}:types,
        0,"query");
      }
      else
View Full Code Here

        String[] types = new String[]{v,v,v,d,d,v,v,v,v,v,v,v,v,d,d,v,v,v};
        SearchData data=new SearchDataImpl(suggestions);
        SuggestionItem item=null;// this is already here to make sure the classloader load this sinstance
       
       
        railo.runtime.type.Query qry=new QueryImpl(cols,types,0,"query");
       
      SearchCollection collection;
      long time=System.currentTimeMillis();
      AddionalAttrs.setAddionalAttrs(contextBytes,contextPassages,contextHighlightBegin,contextHighlightEnd);
      try {
        for(int i=0;i<collections.length;i++) {
          collection=collections[i];
          startrow=collection.search(data,qry,criteria,collection.getLanguage(),type,startrow,maxrows,categoryTree,category);
           
            if(maxrows>=0 && qry.getRecordcount()>=maxrows) break;
        }
        pageContext.setVariable(name,qry);
      }
      catch(SearchException se) {
          throw Caster.toPageException(se);
      }
      finally{
        AddionalAttrs.removeAddionalAttrs();
      }
     
      time=System.currentTimeMillis()-time;
      Double recSearched=new Double(data.getRecordsSearched());
      int len=qry.getRecordcount();
      for(int i=1;i<=len;i++) {
          qry.setAt("recordssearched",i,recSearched);
      }
     
      // status
      if(status!=null) {
        Struct sct=new StructImpl();
        pageContext.setVariable(status, sct);
        sct.set(FOUND, new Double(qry.getRecordcount()));
        sct.set(SEARCHED, recSearched);
        sct.set(KeyConstants._time, new Double(time));
       
        // TODO impl this values
       
View Full Code Here

        _(ps,"}");
    }
   
    private static void _(PrintStream ps,ResultSet res) {
      try {
      _(ps, new QueryImpl(res,"query",null).toString());
    } catch (PageException e) {
      _(ps, res.toString());
    }
    }
View Full Code Here

    });
     
      PageContext pc = ThreadLocalPageContext.get();
   
    try {
      query = new QueryImpl(pc,dc,sqlSelect,-1,-1,-1,"query");
    }
      catch (DatabaseException de) {
        if(dc==null || !createTableIfNotExist) throw de;
        try {
          SQL sql = createSQL(dc,"text",strType);
          ScopeContext.info(log,sql.toString());
        new QueryImpl(pc,dc,sql,-1,-1,-1,"query");
        }
        catch (DatabaseException _de) {
          try {
            SQL sql = createSQL(dc,"memo",strType);
            ScopeContext.info(log,sql.toString());
          new QueryImpl(pc,dc,sql,-1,-1,-1,"query");
          }
          catch (DatabaseException __de) {
            SQL sql = createSQL(dc,"clob",strType);
            ScopeContext.info(log,sql.toString());
            new QueryImpl(pc,dc,sql,-1,-1,-1,"query");
          }
        }
        query = new QueryImpl(pc,dc,sqlSelect,-1,-1,-1,"query");
    }
      ScopeContext.info(log,sqlSelect.toString());
    return query;
  }
View Full Code Here

TOP

Related Classes of railo.runtime.type.QueryImpl

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.