Package com.esri.gpt.framework.sql

Examples of com.esri.gpt.framework.sql.HttpExpressionBinder


     
      String[] columnTags = {"id","uuid","protocol","name","url"};
      sql.append("SELECT ID,DOCUUID,PROTOCOL_TYPE,TITLE,HOST_URL FROM "+table);
     
      // build the bound query expression based upon HTTP parameter input
      HttpExpressionBinder binder = new HttpExpressionBinder(request);
      binder.parse("id","ID","=",",",HttpExpressionBinder.PARAMETERTYPE_INTEGER);
      binder.parse("uuid","DOCUUID",",",false,false);
     
      if(protocol.toLowerCase().equals("all")) {
        binder.parse("","PROTOCOL_TYPE",",",true,false);
      } else {
        binder.parse("protocol","PROTOCOL_TYPE",",",true,false);
      }
      binder.parse("name","TITLE",null,true,true);
      binder.parse("url","HOST_URL",null,true,true);
           
      // append the bound where clause,
      // create the prepared statement and apply bindings,
      // exexute the query and write the response
      sql.append(" ").append(binder.getExpression(true));
      if(sql.toString().toLowerCase().contains(" where ")) {
        sql.append(" AND ");
      } else {
        sql.append(" WHERE ");
      }
      sql.append(" ((APPROVALSTATUS = 'approved') ")
      .append(" OR  (APPROVALSTATUS = 'reviewed')) ");
      sql.append(" AND SEARCHABLE = 'true'");
      sql.append(" ORDER BY UPPER(TITLE) ASC");
     
      mCon = context.getConnectionBroker().returnConnection("");
      con = mCon.getJdbcConnection();
      st = con.prepareStatement(sql.toString());
      binder.applyBindings(st,1);
      //rs = new RepositoriesResultSetWrapper(st.executeQuery());
      if(protocol.toLowerCase().equals("all") != true) {
        rs = st.executeQuery();
      } else {
        rs = new RepositoriesResultSetWrapper(st.executeQuery());
View Full Code Here

TOP

Related Classes of com.esri.gpt.framework.sql.HttpExpressionBinder

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.