Package tools.util

Examples of tools.util.EZArrayList


        }
       
        Hashtable h = Gateway.get(connection.getProperties()).readTableValue(sqp.getTable(),sqp.getIncludeAllList(),sqp.getSelectList(),sqp.getEitherOrAllList(),sqp.isDistinct(),sqp);
    if (h == null) return true;
    Vector r = new EZArrayList(h.elements());
   
    Enumeration en = h.keys();
    String rid = null;
    Vector ul = null;
    NameValue nv = null;
View Full Code Here


      //nvp.put("count(*)",h.size());
      if (h.get("jiql_row_count") == null)
      nvp.put("count(*)",h.size());
      else
        nvp.put("count(*)",h.get("jiql_row_count"));
      r = new EZArrayList();
      r.add(nvp);
    }
    else
    r = new EZArrayList(h.elements());
    //union. (r);

    sqp.setResults(r);
    jiqlDBMgr.get(sqp.getProperties()).getCommand("SortResult").execute(sqp);

View Full Code Here


  public static int countWhere(String table,String field,Object value,Query.FilterOperator qf)throws SQLException
  {
    checkThread();
    EZArrayList ez = new EZArrayList();
    //(" listWhere: " + ":" + qf + ":" + field + ":" + value + ":" + value.getClass().getName());


    Query q = new Query(table);
    q = q.addFilter(field,qf,value);
View Full Code Here

        }

  public static Vector listWhere(String table,String field,Object value,Query.FilterOperator qf)throws SQLException
  {
    checkThread();
    EZArrayList ez = new EZArrayList();
    //(" listWhere: " + ":" + qf + ":" + field + ":" + value + ":" + value.getClass().getName());


    Query q = new Query(table);
    q = q.addFilter(field,qf,convert(value));
     DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
        PreparedQuery pq = datastore.prepare(q) ;
    int ezt = pq.countEntities();
    if (ezt > fLimit)
      throw JGException.get("result_too_large",table + " Result too LARGE. Try narrowing query by adding more filters: " + ezt + ":" + qf + ":" + field + ":" + value + ":" + value.getClass().getName());

    Iterator lst = pq.asIterator();
         //if (lst == null || !lst.hasNext())
         //  break;


    Entity entity = null;
    JGNameValuePairs jn = null;
    int ctl = 0;
                    Throwable ex = null;  
   for (int ct = 0; ct < readTries;ct++)
{
try{
   
    while (lst.hasNext())
    {
      ctl = ctl + 1;
      checkThread(ctl);
      entity = (Entity)lst.next();
      jn = new JGNameValuePairs(new Hashtable(entity.getProperties()));
      jn.setKeyName(entity.getKey().getName());
      jn.setKeyId(entity.getKey().getId());
      jn.setTableName(table);
      ez.add(jn);

    }
    return ez;
   
   
View Full Code Here




    Vector reso = sqp.getResults();
    Object[] sR = new EZArrayList(reso.elements()).toArray();
   

/*  int cto = 0;
    while (en.hasMoreElements())
      {
View Full Code Here

{
public Object execute(SQLParser sqp)throws SQLException{
      Gateway cgw = Gateway.get(sqp.getProperties());
      //if(cgw.readTableInfo(,sqp.getTable()).size() <1)
      //  throw JGException.get("table_does_not_exists","Table does NOT Exists");
      EZArrayList pk = sqp.getPrimaryKeys();
      if (pk.size() < 1)return null;
      //cgw.addPrimaryKeys(,sqp.getTable(),pk);
      jiqlTableInfo ti = sqp.getJiqlTableInfo();
      //jiqlDBMgr.get(sqp.getProperties()).getTableInfo(sqp.getTable(),true);
      ti.setPrimaryKeys(pk);
      jiqlDBMgr.get(sqp.getProperties()).saveTableInfo(sqp.getTable(),ti);
View Full Code Here

    else if (nv.name.equals("prefix"))
      prefix = new Boolean(nv.value).booleanValue();
    else if (nv.name.equals("tableleafs"))
      tableleafs = new Boolean(nv.value).booleanValue();
    else if (nv.name.equals("fieldList"))
      fieldList = new EZArrayList(new StringTokenizer(nv.value,";"));


    else if (nv.name.equals("primarykeys"))
      primarykeys = new EZArrayList(new StringTokenizer(nv.value,";"));
    else if (nv.name.equals("autoincrements"))
      autoincrement = new EZArrayList(new StringTokenizer(nv.value,";"));

    else if (nv.name.equals("notnulls"))
      notnulls = new EZArrayList(new StringTokenizer(nv.value,";"));
    else if (nv.name.equals("constraints"))
    {
       Enumeration enc = sexp.parse(nv.value);
      while (enc.hasMoreElements())
      {
        nv = (NameValue)enc.nextElement();
        Hashtable ch = sexp.parseToHash(nv.value);
        //(nv.name + " connFROM NV " + ch);
        jiqlConstraint jc = new jiqlConstraint();
        String cn = (String)ch.get("name");
        jc.setName(cn);
        String ty = (String)ch.get("type");
        jc.setType(Integer.parseInt(ty));
        String tar = (String)ch.get("target");
        EZArrayList tarv = new EZArrayList(new StringTokenizer(tar,";"));
        jc.addEnumeration(tarv.iterator());
        Hashtable rh = (Hashtable)ch.get("references");
        if (rh != null)
        {
        jiqlFunction jfr = new jiqlFunction();
        String rn = (String)rh.get("name");
        jfr.setName(rn);
        String rtar = (String)rh.get("target");
        EZArrayList rtarv = new EZArrayList(new StringTokenizer(rtar,";"));
        jfr.addEnumeration(rtarv.iterator());
        jc.setReference(jfr);
         
        }
        addConstraint(jc);
      }
View Full Code Here

    StringBuffer selsb = new StringBuffer(sels);
    selsb = SharedMethods.replaceSubstringBuffer(selsb,"\"","");
    selsb = SharedMethods.replaceSubstringBuffer(selsb,"'","");
    selsb = SharedMethods.replaceSubstringBuffer(selsb,"`","");

    selectList = new EZArrayList(new StringTokenizer(selsb.toString(),","));
    ////();
    if (sels.toLowerCase().startsWith("count(") && sels.endsWith(")"))
    {
      count = true;
      selectList = new EZArrayList();
      selectList.add("*");
      //("SC 1" + this);
    }
    //origSelectL = (Vector)selectList.clone();
    setOriginalSelectList(selectList);

    tok = tok.substring(si + " from ".length(),tok.length());
    tok = tok.trim();
    tok2 = tok.toLowerCase();

    int i = tok.indexOf(" ");
    if (i < 0)
    {

      table = tok.substring(0,tok.length());
      table = parseTable(table);
      setTable(table);
      parseSelectAS();

      return;
    }

    String jtl = "";
    while (true){
      tok = parseTableAlias(tok);
     
      int i3 = tok.toLowerCase().indexOf(" as ");
      if (i3 > 0){
        jtl = jtl + tok.substring(0,i3 + " as ".length());

        tok = tok.substring(i3 + " as ".length(),tok.length());
        tok = StringUtil.getTrimmedValue(tok);
       
      }
      i = tok.indexOf(" ");
     
      int i2 = tok.indexOf(" ,");
      if (i2 > 0 && i2 <= i)
        i = i+ 1;
      i2 = tok.indexOf(",");

      if (i2 > 0 && i2 < i)
        i = i2;
        if (i < 1)
        {
          jtl = jtl + tok;
          break;
        }
        table = tok.substring(0,i + 1);
        jtl = jtl + table;
          int ji = table.indexOf(",");
      if (ji > 0){
              //jtl = jtl + table;

        tok = tok.substring(i + 1,tok.length());
        tok = tok.trim();
      }
      else break;
    }
    table = jtl;
   
    int ji = table.indexOf(",");
    //(ji + " PSTBL2 : " + table);

    if (ji > 0){
      getUnion().parseTables(table.substring(ji + 1,table.length()).trim());
      table = table.substring(0,ji).trim();
    }
    table = table.trim();
    table = parseTableAlias(table);
    int tas = table.toLowerCase().indexOf(" as ");
    if (tas > 0)
    {
      String al = table.substring(tas + " as ".length(),table.length());
      table = table.substring(0,tas);
      al = StringUtil.getTrimmedValue(al);
      table = StringUtil.getTrimmedValue(table);

      if (StringUtil.isRealString(al))
      aliases.put(al,table);
     
    }
    setTable(table);
    parseSelectAS();

    tok = tok.substring(i + 1,tok.length());
    tok = tok.trim();
    tok = groupby.parse(tok);
    tok2 = tok.toLowerCase();
    //i = tok2.indexOf("   ");
    //("OBY b " + tok2);

    //if (i > -1)
    i = tok2.indexOf(" order by ");
    if (i < 0)
      i = tok2.indexOf("order by ");

    if (i > -1)
    {
    String oby = tok.substring(i + "order by ".length(),tok.length() );
    tok = tok.substring(0,i);
    tok = tok.trim();
    tok2 = oby.toLowerCase();

    i = tok2.indexOf(" desc");
    if (i > 0){
     
      oby = oby.substring(0,i);
      desc = true;
    }

    i = tok2.indexOf(" asc");
    if (i > 0){
     
      oby = oby.substring(0,i);
    }
    oby = oby.trim();
    //("OBY a " + oby);
    sortList = new EZArrayList(new StringTokenizer(oby,","));



    tok2 = tok.toLowerCase();

    }
    if (tok2.startsWith("where "))
    {
      tok2 = " " + tok2;
      tok = " " + tok;
    }
    //("HELLO " + tok);
    i = tok2.indexOf(" where ");
    if (i > -1){
    String al = tok.substring(0,i);
    al = al.trim();
    if (al.toLowerCase().startsWith("as "))
    {
      al = al.substring(3,al.length());
      al = al.trim();
    }
    ji = al.indexOf(",");
      //(ji + " PSTBL3 : " + al);

    if (ji > 0){
      getUnion().parseTables(al.substring(ji + 1,al.length()).trim());
      al = al.substring(0,ji).trim();
    }
    if (StringUtil.isRealString(al))
    aliases.put(al,table);
    tok = tok.substring(i + 1,tok.length());
    tok = tok.trim();
    tok2 = tok.toLowerCase();

    if (selectList.size() > 0)
      for (int ct = 0;ct < selectList.size();ct++)
      {
        String se = selectList.elementAt(ct).toString();
        if (se.equals(al))
          selectList.setElementAt("*",ct);
        else if (se.startsWith(al + ".") && StringUtil.isRealString(se.substring(al.length() + 1,se.length()))){
          String cn = se.substring(al.length() + 1,se.length());
          //(se + " SELECTSSS " + cn);
          updateSelectAS(se,cn);
          selectList.setElementAt(cn,ct);
        }
         
      }

     
    }else if (tok2.trim().length() > 0)
    {
    tok = tok.trim();
    String al = tok;
    al = al.trim();
    if (al.toLowerCase().startsWith("as "))
    {
      al = al.substring(3,al.length());
      al = al.trim();
    }
    if (StringUtil.isRealString(al))
    aliases.put(al,table);     
    }
   
    i = tok2.indexOf("where ");
    if (i > -1){
    tok = tok.substring(i + "where ".length(),tok.length());
    tok = tok.trim();
    tok2 = tok.toLowerCase();
    String lc = null;
    //("SEL 1 " + tok);
      while (true){
       
        if (tok.length() < 1)break;
        i = tok2.indexOf(" and ");
        if (i > -1){
    tok2 = tok.substring(0,i);
    tok2 = tok2.trim();
    Criteria cr = parseCriteria(tok2);
    if (lc == null || lc.equals("and")){
    if (!getUnion().addToIncludeList(table,getTAlias(table),getSAlias(cr.getName()),getSAlias(cr.getValueString()),cr))
    includealllist.add(cr);
    }
    else{
    if (!getUnion().addToEitherOrList(table,getTAlias(table),getSAlias(cr.getName()),getSAlias(cr.getValueString()),cr))
    eitheroralllist.add(cr);
    }
    tok = tok.substring(i + " and ".length(),tok.length());
    tok = tok.trim();
    tok2 = tok.toLowerCase();
    lc = "and";

        }

        else if( tok2.indexOf(" or ") > -1){
i = tok2.indexOf(" or ");
    tok2 = tok.substring(0,i);
    tok2 = tok2.trim();
    //eitheroralllist.add(parseCriteria(tok2));
    Criteria cr = parseCriteria(tok2);

    if (lc == null || lc.equals("or"))
    {
    if (!getUnion().addToEitherOrList(table,getTAlias(table),getSAlias(cr.getName()),getSAlias(cr.getValueString()),cr))
    eitheroralllist.add(cr);
    }    else
    {
    if (!getUnion().addToIncludeList(table,getTAlias(table),getSAlias(cr.getName()),getSAlias(cr.getValueString()),cr))
    includealllist.add(cr);
    }         
    tok = tok.substring(i + " or ".length(),tok.length());
    tok = tok.trim();
    tok2 = tok.toLowerCase();
    lc = "or";


        }
        else{
        Criteria cr = parseCriteria(tok);
     
          if (lc == null || lc.equals("and"))
    {
    if (!getUnion().addToIncludeList(table,getTAlias(table),getSAlias(cr.getName()),getSAlias(cr.getValueString()),cr))
    includealllist.add(cr);
    }          else
    {
    if (!getUnion().addToEitherOrList(table,getTAlias(table),getSAlias(cr.getName()),getSAlias(cr.getValueString()),cr))
    eitheroralllist.add(cr);
    }          break;
        }
       
      }
     
    }



    return;
    }
    else if (tok2.startsWith("delete ")){
    action = "delete";
    tok = tok.substring("delete ".length(),tok.length());
    tok = tok.trim();
    tok2 = tok.toLowerCase();

    int si = tok2.indexOf("from ");
    tok = tok.substring(si + "from ".length(),tok.length());
    tok = tok.trim();
    tok2 = tok.toLowerCase();

    int i = tok.indexOf(" ");
        if (i < 0)
    {
      table = tok.substring(0,tok.length());
      setTable(table);
      return;
    }

    table = tok.substring(0,i);
    setTable(table);
    tok = tok.substring(i + 1,tok.length());
    tok = tok.trim();
    tok2 = tok.toLowerCase();
   
    i = tok2.indexOf("where ");
    if (i > -1){
    tok = tok.substring(i + "where ".length(),tok.length());
    tok = tok.trim();
    tok2 = tok.toLowerCase();
      while (true){
       
        if (tok.length() < 1)break;
        i = tok2.indexOf(" and ");
        if (i > -1){
    tok2 = tok.substring(0,i);
    tok2 = tok2.trim();
    Criteria cr = parseCriteria(tok2);
    if (!getUnion().addToIncludeList(table,getTAlias(table),getSAlias(cr.getName()),getSAlias(cr.getValueString()),cr))
      includealllist.add(cr);
    tok = tok.substring(i + " and ".length(),tok.length());
    tok = tok.trim();
    tok2 = tok.toLowerCase();

        }
        else if( tok2.indexOf(" or ") > -1){
        }
        else{
         
    Criteria cr = parseCriteria(tok);
    if (!getUnion().addToIncludeList(table,getTAlias(table),getSAlias(cr.getName()),getSAlias(cr.getValueString()),cr))
      includealllist.add(cr);
                break;
        }
       
      }
     
    }



    return;
    }
   
   
    else if (tok2.startsWith("update ")){

 
    action = "update";
    tok = tok.substring("update ".length(),tok.length());
    tok = tok.trim();
    tok2 = tok.toLowerCase();


    int i = tok.indexOf(" ");
        if (i < 0)
      i = tok.length();

    table = tok.substring(0,i);
    setTable(table);
    tok = tok.substring(i + 1,tok.length());
    tok = tok.trim();
    tok2 = tok.toLowerCase();

    tok = tok.substring("set ".length(),tok.length());
    tok = tok.trim();
    tok2 = tok.toLowerCase();

   
    int si = tok2.indexOf(" where ");
    if (si < 0)
      si = tok2.length();
    String ups = tok.substring(0,si);
    ups = ups.trim();

    //tok = encode(ups);
    EZArrayList uv = new EZArrayList(new StringTokenizer(ups,","));
      String upstr = null;
      for (int ct = 0;ct < uv.size();ct++){
      upstr = uv.elementAt(ct).toString();
      updatelist.add(parseUpdate(upstr));

       
      }
 


si = tok2.indexOf(" where ");
if (si < 0)return;

    tok = tok.substring(si + " where ".length(),tok.length());
    tok = tok.trim();
    tok2 = tok.toLowerCase();

    /*int i = tok.indexOf(" ");
    table = tok.substring(0,i);
    tok = tok.substring(i + 1,tok.length());
    tok = tok.trim();
    tok2 = tok.toLowerCase();*/
   
  //  i = tok2.indexOf("where ");
  //  if (i > -1){
    //tok = tok.substring(i + "where ".length(),tok.length());
    //tok = tok.trim();
    //tok2 = tok.toLowerCase();
      while (true){
        i = tok2.indexOf(" and ");
        if (i > -1){
      tok2 = tok.substring(0,i);
    tok2 = tok2.trim();
    Criteria cr = parseCriteria(tok2);
    if (!getUnion().addToIncludeList(table,getTAlias(table),getSAlias(cr.getName()),getSAlias(cr.getValueString()),cr))
      includealllist.add(cr);
    tok = tok.substring(i + " and ".length(),tok.length());
    tok = tok.trim();
    tok2 = tok.toLowerCase();

        }
        else if( tok2.indexOf(" or ") > -1){
        }
        else{
         
    Criteria cr = parseCriteria(tok);
    if (!getUnion().addToIncludeList(table,getTAlias(table),getSAlias(cr.getName()),getSAlias(cr.getValueString()),cr))
      includealllist.add(cr);
                break;
        }
       
      }
     
  //  }



    return;
    }else if (SpecialCommandParser.parse(this,firstToken)){
      return;
    } else if (tok2.startsWith("show tables")){
      action = "showTables";
      return;
    }
    else if (tok2.startsWith("describe ")){
      action = "describeTable";
      tok2 = tok.substring("describe ".length(),tok2.length()).trim();
      setTable(tok2);
      return;
    }
    else if (tok2.startsWith("getcolumns ")){
      action = "getColumns";
      tok2 = tok.substring("getcolumns ".length(),tok2.length()).trim();
      setTable(tok2);
      return;
    }
    else if (tok2.startsWith("getprimarykeys ")){
      action = "getPrimaryKeys";
      tok2 = tok.substring("getprimarykeys ".length(),tok2.length()).trim();
      setTable(tok2);
      return;
    }//special = true;
    else if (tok2.startsWith("getindex ")){
      action = "getIndex";
      tok2 = tok.substring("getindex ".length(),tok2.length()).trim();
      setTable(tok2);
      special = true;
      return;
    }
    else if (tok2.startsWith("getexportedkeys ")){
      action = "getExportedKeys";
      tok2 = tok.substring("getexportedkeys ".length(),tok2.length()).trim();
      setTable(tok2);
      return;
    }
        else if (tok2.startsWith("gettypeinfo")){
    special = true;
    setAction("getTypeInfo");
    //local = true;
    return;

    }
    else if (tok2.startsWith("getimportedkeys ")){
      action = "getImportedKeys";
      tok2 = tok.substring("getimportedkeys ".length(),tok2.length()).trim();
      setTable(tok2);
      return;
    }
    else if (tok2.startsWith("jiqldescribe ")){
      action = "jiqldescribeTable";
      tok2 = tok.substring("jiqldescribe ".length(),tok2.length()).trim();
      setTable(tok2);
      return;
    }
    ti = tok2.indexOf(" index ");

    if (tok2.startsWith("create ") && ti > 0)
    {
      action = "createIndex";
      return;
    }

    ti = tok2.indexOf(" table ");
    if (tok2.startsWith("create ") && ti > 0){
      action = "createTable";
      tok = tok.substring(ti + " table ".length(),tok.length());
      tok = tok.trim();
      if (tok.toUpperCase().startsWith("IF NOT EXISTS"))
      {
        tok = tok.substring(14,tok.length());
        tok = tok.trim();
        getCreateParser().setIfNotExists(true);
       
      }
      int i = tok.indexOf(" ");
          if (i < 0)
      i = tok.length();

      table = tok.substring(0,i);
      setTable(table);
      if (!AlphaNumeric.isAlphaNumeric(table,"_"))
        throw JGException.get("invalid_table_name", table + " Invalid Create Table name");
      tok = tok.substring(i + 1,tok.length());
      tok = tok.trim();
      //(tok + ":" + table + ":REDBEAN");

      if (tok.startsWith("("))
      {
        tok = tok.substring(1,tok.length());
        tok = tok.trim();

      if (tok.endsWith(")"))
      {
        tok = tok.substring(0,tok.length() - 1);
        tok = tok.trim();
      }
      }
      parseCreateTableParams();
      return;
    }
    else if (tok2.startsWith("drop ") && ti > 0){
      action = "dropTable";
      tok = tok.substring(ti + " table ".length(),tok.length());
      tok = tok.trim();
      int i = tok.indexOf(" ");
          if (i < 0)
      i = tok.length();

      table = tok.substring(0,i);
      setTable(table);
      return;
    }
    else if (tok2.startsWith("set "))
    {
      action = "setOperation";
      return;
    }
    else if (tok2.startsWith("load ")){
      action = "loadTable";
      getLoadTable();
      return;
    }
    else if (tok2.startsWith("insert ")){
      action = "sqlInsert";
      getInsertIntoTable();
      return;
    }
    else if (tok2.startsWith("alter ") && ti > 0){
      parseAlter(ti);
      /*action = "dropTable";
      tok = tok.substring(ti + " table ".length(),tok.length());
      tok = tok.trim();
      int i = tok.indexOf(" ");
          if (i < 0)
      i = tok.length();

      table = tok.substring(0,i);
      return;*/
    }
    ti = tok2.indexOf(" user ");
        if (tok2.startsWith("drop ") && ti > 0)
      {
      action = "dropUser";
      tok = tok.substring(ti + " user ".length(),tok.length());
      tok = tok.trim();

      return;
      }
    else if (tok2.startsWith("create ") && ti > 0)
      {
      /*action = "createUser";
      tok = tok.substring(ti + " user ".length(),tok.length());
      tok = tok.trim();
      //create user DB_NAME identified by PASSWORD role user|admin

      int i = tok.indexOf(" ");
      String nuser = tok.substring(0,i);
      tok = tok.substring(i + 1,tok.length());
      tok = tok.trim();
      //(tok + ":" + nuser + ":create suser");
       ("nuser",nuser);
      //identified by PASSWORD role user|admin
      //PASSWORD role user|admin

        tok = tok.substring("identified".length(),tok.length());
        tok = tok.trim();
        tok = tok.substring("by".length(),tok.length());
        tok = tok.trim();
        String d = JGProperties.get().getProperty("digest");

       ("nupassword",tok);
        if (StringUtil.isRealString(d) && !d.equals("PLAIN"))
         ("nupassword",Crypto.digest(tok,d));
      i = tok.indexOf(" ");
      if (i > 0)
      {
        if (StringUtil.isRealString(d) && !d.equals("PLAIN"))
         ("nupassword",Crypto.digest(tok.substring(0,i).trim(),d));
        else
         ("nupassword",tok.substring(0,i).trim());


        tok = tok.substring(i+1,tok.length());
        tok = tok.trim();
        if (tok.startsWith("role "))
        {
        tok = tok.substring("role ".length(),tok.length());
        tok = tok.trim();
        if (!tok.equalsIgnoreCase("admin") && !tok.equalsIgnoreCase("user"))
          throw JGException.get("invalid_role Invalid Role! Should be admin or user");
         ("role",tok);
        }


      }
      return;*/
      }

    ti = tok2.indexOf(" into ");
    if (tok2.startsWith("jiqlinsert ") && ti > 0)
      {
      action = "writeTableRow";
      tok = tok.substring(ti + " into ".length(),tok.length());
      tok = tok.trim();
      int i = tok.indexOf(" ");
        int i2 = tok.indexOf("(");
      if (i > i2)
        i = i2;
          if (i < 0)
      i = tok.length();

      table = tok.substring(0,i);
      setTable(table);
      if (i == i2)
      tok = tok.substring(i,tok.length());
      else
      tok = tok.substring(i + 1,tok.length());
      tok = tok.trim();
      boolean checkfl = false;

      if (tok.toLowerCase().startsWith("valjiqlues"))
      {
      checkfl = true;
      StringBuffer sbf = new StringBuffer("(");
      EZArrayList fv = getJiqlTableInfo().getFieldList();
      sbf.append(fv.toDelimitedString(","));
      sbf.append(") values ");
      //tok = tok.substring("values".length(),tok.length());
      //tok = tok.trim();
      tok = sbf.toString() + tok.substring(10,tok.length());

      }
      if (tok.toLowerCase().startsWith("values"))
      {
      /*checkfl = true;
      StringBuffer sbf = new StringBuffer("(");
      EZArrayList fv = getJiqlTableInfo().getFieldList();
      sbf.append(fv.toDelimitedString(","));
      sbf.append(") ");*/
      tok = tok.substring("values".length(),tok.length());
      tok = tok.trim();
      //tok = sbf.toString() + tok;

      }
      //("INSERT 1 " + tok);
      tok = tok.substring(1,tok.length());
      tok = tok.trim();
      //tok = encode(tok);
      i = tok.indexOf(")");
      String tokf = tok.substring(0,i);

      tok = tok.substring(i+ 1,tok.length());
      tok = tok.trim();
     
      Vector v = null;
      if (tok.toLowerCase().startsWith("values"))
      {
      tokf = tokf.trim();
      tok = tok.substring("values".length(),tok.length());
      tok = tok.trim();
      tok = tok.substring(1,tok.length());
      tok = tok.trim();
      tok = tok.substring(0,tok.length() -1);
      tok = tok.trim();
       v = new EZArrayList(new StringTokenizer(tokf,","));
   
      }
      else
      {
        tok = tokf;
        v = getJiqlTableInfo().getFieldList();

      /*Vector r = Gateway.get(getProperties()).describeTable(this);
      v = new Vector();
      NameValuePairs row= null;
      for (int ct = 0;ct < r.size();ct++){
        row = (NameValuePairs)r.elementAt(ct);
        v.add(row.getString("Field"));
      }*/

      }
     


    EZArrayList vv = new EZArrayList(new StringTokenizer(tok,","));
    String n = null;
    String va = null;
    for (int ct = 0;ct < v.size();ct++)
    {
      n = v.elementAt(ct).toString();
      n = n.trim();
      n= StringUtil.getTrimmedValue(n);
      try{
     
      va = vv.elementAt(ct).toString();
      }catch (ArrayIndexOutOfBoundsException e){
      throw JGException.get("missing_column_value",n + " Missing Column Value! ");
     
      }
          //(n + "   TOKO b " + va);
View Full Code Here

          String n = tok.substring(0,i);
          n = n.trim();
          tok =   tok.substring(i + 1,tok.length() -1);
          tok = tok.trim();
         
          EZArrayList v = new EZArrayList(new StringTokenizer(tok,","));
          jiqlFunction p = new jiqlFunction();
          for (int ct = 0;ct < v.size(); ct++)
          {
            tok = v.elementAt(ct).toString();
            if (tok.indexOf("(") > 0 && tok.indexOf(")") > 0)
              tok = tok.substring(0,tok.indexOf("("));
            p.add(tok);
          }
          p.setName(n);
View Full Code Here

            }
           
          }
          tok = tok.substring(1,tok.length() -1);
          tok = tok.trim();
          EZArrayList v = new EZArrayList(new StringTokenizer(tok,","));
          jConstraint = new jiqlConstraint();
          for (int ct = 0;ct < v.size(); ct++)
          {
            tok = v.elementAt(ct).toString();
            if (tok.indexOf("(") > 0 && tok.indexOf(")") > 0)
              tok = tok.substring(0,tok.indexOf("("));
            jConstraint.add(tok);
          }
          jConstraint.setType(ty);
View Full Code Here

TOP

Related Classes of tools.util.EZArrayList

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.