Package railo.runtime.type

Examples of railo.runtime.type.ArrayImpl


      qry.rename(COLUMN_DEFAULT,COLUMN_DEFAULT_VALUE);
   
    // make sure decimal digits exists
    QueryColumn col = qry.getColumn(DECIMAL_DIGITS,null);
    if(col==null){
      Array arr=new ArrayImpl();
      for(int i=1;i<=len;i++) {
        arr.append(railo.runtime.op.Constants.DOUBLE_ZERO);
      }
      qry.addColumn(DECIMAL_DIGITS, arr);
    }
   
   
    // add is primary
    Map primaries = new HashMap();
    String tblName;
    Array isPrimary=new ArrayImpl();
    Set set;
    Object o;
    for(int i=1;i<=len;i++) {
     
      // decimal digits
      o=qry.getAt(DECIMAL_DIGITS, i,null);
      if(o==null)qry.setAtEL(DECIMAL_DIGITS, i,railo.runtime.op.Constants.DOUBLE_ZERO);
     
      set=(Set) primaries.get(tblName=(String) qry.getAt(TABLE_NAME, i));
      if(set==null) {
        set=toSet(metaData.getPrimaryKeys(dbname, null, tblName),true,"COLUMN_NAME");
        primaries.put(tblName,set);
      }
      isPrimary.append(set.contains(qry.getAt(COLUMN_NAME, i))?"YES":"NO");
    }
    qry.addColumn(IS_PRIMARYKEY, isPrimary);
   
    // add is foreignkey
    Map foreigns = new HashMap();
    Array isForeign=new ArrayImpl();
    Array refPrim=new ArrayImpl();
    Array refPrimTbl=new ArrayImpl();
    //Map map,inner;
    Map<String, Map<String, SVArray>> map;
    Map<String, SVArray> inner;
    for(int i=1;i<=len;i++) {
      map=(Map) foreigns.get(tblName=(String) qry.getAt(TABLE_NAME, i));
      if(map==null) {
        map=toMap(
            metaData.getImportedKeys(dbname, schema, table),
            true,
            "FKCOLUMN_NAME",
            new String[]{"PKCOLUMN_NAME","PKTABLE_NAME"});
        foreigns.put(tblName, map);
      }
      inner = map.get(qry.getAt(COLUMN_NAME, i));
      if(inner!=null) {
        isForeign.append("YES");
        refPrim.append(inner.get("PKCOLUMN_NAME"));
        refPrimTbl.append(inner.get("PKTABLE_NAME"));
      }
      else {
        isForeign.append("NO");
        refPrim.append("N/A");
        refPrimTbl.append("N/A");     
      }
    }
    qry.addColumn(IS_FOREIGNKEY, isForeign);
    qry.addColumn(REFERENCED_PRIMARYKEY, refPrim);
    qry.addColumn(REFERENCED_PRIMARYKEY_TABLE, refPrimTbl);
View Full Code Here


      }
     
      // sqlparameters
      SQLItem[] params = sql.getItems();
      if(params!=null && params.length>0) {
        Array arr=new ArrayImpl();
        sct.setEL(SQL_PARAMETERS, arr);
        for(int i=0;i<params.length;i++) {
          arr.append(params[i].getValue());
         
        }
      }
      pageContext.setVariable(result, sct);
    }
View Full Code Here

  private Object executeORM(SQL sql, int returnType, Struct ormoptions) throws PageException {
    ORMSession session=ORMUtil.getSession(pageContext);
   
    // params
    SQLItem[] _items = sql.getItems();
    Array params=new ArrayImpl();
    for(int i=0;i<_items.length;i++){
      params.appendEL(_items[i]);
    }
   
    // query options
    if(maxrows!=-1 && !ormoptions.containsKey(MAX_RESULTS)) ormoptions.setEL(MAX_RESULTS, new Double(maxrows));
    if(timeout!=-1 && !ormoptions.containsKey(TIMEOUT)) ormoptions.setEL(TIMEOUT, new Double(timeout));
View Full Code Here

  public static Array call(PageContext pc, Query query, String strColumn) throws PageException {
        return toArray(query.removeColumn(KeyImpl.init(strColumn)));
    }
   
    public static Array toArray(QueryColumn column) throws PageException {
        Array clone=new ArrayImpl();
        int len=column.size();
        clone.resize(len);
       
        for(int i=1;i<=len;i++) {
            clone.setE(i,QueryUtil.getValue(column,i));
        }
        return clone;
    }
View Full Code Here

public class ValueArray extends BIF {
 
  private static final long serialVersionUID = -1810991362001086246L;

  public static Array call(PageContext pc , QueryColumn column) throws PageException {
    Array arr=new ArrayImpl();
      int size=column.size();
    for(int i=1;i<=size;i++) {
      arr.append(Caster.toString(column.get(i,null)));
    }
    return arr; 
  }
View Full Code Here

public final class QueryAddColumn extends BIF {

  private static final long serialVersionUID = -242783888553490683L;

  public static double call(PageContext pc , Query query, String string) throws PageException {
    return call(pc, query, string,new ArrayImpl());
  }
View Full Code Here

    while(it.hasNext()){
      e = it.next();
      if(qry.getColumn(e.getKey(),null)!=null) {
        v=e.getValue();
        arr = Caster.toArray(v,null);
        if(arr==null) arr=new ArrayImpl(new Object[]{v});
        populateColumn(qry,e.getKey(),arr,rows);
      }
    }
    return qry;
  }
View Full Code Here

        o=it.next();
        qry.addRow();
        if(Decision.isStruct(o))populateRow(qry,Caster.toStruct(o));
        else if(Decision.isArray(o))populateRow(qry,Caster.toArray(o));
        else {
          populateRow(qry,new ArrayImpl(new Object[]{o}));
        }
      }
    }
    return qry;
  }
View Full Code Here

   
    Query qp = Caster.toQuery(query,null);
    if(qp!=null) qp.rename(src, trg);
    else {
      QueryColumn qc = query.removeColumn(src);
      Array content=new ArrayImpl();
      int len=qc.size();
      for(int i=1;i<=len;i++){
        content.setE(i, qc.get(i,null));
      }
      query.addColumn(trg, content, qc.getType());
    }
    return null;
  }
View Full Code Here

public final class QueryColumnArray extends BIF {
  private static final long serialVersionUID = 8166886589713144047L;

  public static Array call(PageContext pc , Query qry) {
        return new ArrayImpl(qry.getColumnNamesAsString());
    }
View Full Code Here

TOP

Related Classes of railo.runtime.type.ArrayImpl

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.