Package railo.runtime.type.scope

Examples of railo.runtime.type.scope.Form


   * @return return SQL String for insert
     * @throws PageException
     */
    private SQL createSQL(Struct meta) throws PageException {
        String[] fields=null;
        Form form = pageContext.formScope();
        if(formfields!=null) fields=ListUtil.toStringArray(ListUtil.listToArrayRemoveEmpty(formfields,','));
        else fields=CollectionUtil.keysAsString(pageContext.formScope());
       
        StringBuffer names=new StringBuffer();
        StringBuffer values=new StringBuffer();
        ArrayList items=new ArrayList();
        String field;
        for(int i=0;i<fields.length;i++) {
            field = StringUtil.trim(fields[i],null);
            if(StringUtil.startsWithIgnoreCase(field, "form."))
              field=field.substring(5);
           
            if(!field.equalsIgnoreCase("fieldnames")) {
                if(names.length()>0) {
                    names.append(',');
                    values.append(',');
                }
                names.append(field);
                values.append('?');
                ColumnInfo ci=(ColumnInfo) meta.get(field,null);
                if(ci!=null)items.add(new SQLItemImpl(form.get(field,null),ci.getType()));
                else items.add(new SQLItemImpl(form.get(field,null)));
            }
        }
        if(items.size()==0) return null;
       
        StringBuffer sql=new StringBuffer();
View Full Code Here


     * @return return SQL String for update
     * @throws PageException
     */
    private SQL createSQL(DatasourceConnection dc,String[] keys, Struct meta) throws PageException {
        String[] fields=null;
        Form form = pageContext.formScope();
        if(formfields!=null) fields=ListUtil.toStringArray(ListUtil.listToArrayRemoveEmpty(formfields,','));
        else fields=CollectionUtil.keysAsString(pageContext.formScope());
       
        StringBuffer set=new StringBuffer();
        StringBuffer where=new StringBuffer();
        ArrayList setItems=new ArrayList();
        ArrayList whereItems=new ArrayList();
        String field;
        for(int i=0;i<fields.length;i++) {
            field = StringUtil.trim(fields[i],null);
            if(StringUtil.startsWithIgnoreCase(field, "form."))
              field=field.substring(5);
           
            if(!field.equalsIgnoreCase("fieldnames")) {
                if(ArrayUtil.indexOfIgnoreCase(keys,field)==-1) {
                  if(set.length()==0) set.append(" set ");
                  else set.append(",");
                  set.append(field);
                  set.append("=?");
                  ColumnInfo ci=(ColumnInfo) meta.get(field);
                  if(ci!=null)setItems.add(new SQLItemImpl(form.get(field,null),ci.getType()));
                  else setItems.add(new SQLItemImpl(form.get(field,null)));
                }
                else {
                  if(where.length()==0) where.append(" where ");
                  else where.append(" and ");
                  where.append(field);
                  where.append("=?");
                  whereItems.add(new SQLItemImpl(form.get(field,null)));
                }
            }
        }
        if((setItems.size()+whereItems.size())==0) return null;
       
View Full Code Here

    }
    return (URLImpl) u;
  }

  private static FormImpl _form(PageContext pc) {
    Form f = pc.formScope();
    if(f instanceof UrlFormImpl) {
      return ((UrlFormImpl) f).getForm();
    }
    return (FormImpl) f;
  }
View Full Code Here

 
  private static FormItem[] getFormItems(PageContext pageContext) throws PageException {
    PageException pe = pageContext.formScope().getInitException();
    if(pe!=null) throw pe;
   
    Form scope = pageContext.formScope();
    return scope.getFileItems();
  }
View Full Code Here

TOP

Related Classes of railo.runtime.type.scope.Form

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.