serialize a Query

@param query Query to serialize
@param sb
@param done
@throws ConverterException
436450
private void _serializeQuery(Query query, StringBuilder sb, Set<Object> done) throws ConverterException {

	// Collection.Key[] keys = query.keys();
	Iterator<Key> it = query.keyIterator();
	Key k;
	sb.append(goIn());
	sb.append("query(");

	deep++;
	boolean oDoIt = false;
	int len = query.getRecordcount();
	while (it.hasNext()) {
	    k = it.next();
	    if (oDoIt) sb.append(',');
	    oDoIt = true;
	    sb.append(goIn());
	    sb.append(QUOTE_CHR);
	    sb.append(escape(k.getString()));
	    sb.append(QUOTE_CHR);
	    sb.append(":[");
	    boolean doIt = false;
	    for (int y = 1; y <= len; y++) {
		if (doIt) sb.append(',');
		doIt = true;
		try {
		    _serialize(query.getAt(k, y), sb, done);
		}
		catch (PageException e) {
		    _serialize(e.getMessage(), sb, done);
		}
	    }
	    sb.append(']');
	}
	deep--;

	sb.append(')');

    }
1068726
public JsonObject sendQuery(Map<String, Object> query)
      throws ExecutionException, InterruptedException, IOException {
    return sendQuery(sendQueryAsFuture(query));
  }
1127696
private void _serializeSerializable(Serializable serializable, StringBuilder sb) throws ConverterException {

	sb.append(goIn());
	sb.append("evaluateJava(").append(QUOTE_CHR);
	try {
	    sb.append(JavaConverter.serialize(serializable));
	}
	catch (IOException e) {
	    throw toConverterException(e);
	}
	sb.append(QUOTE_CHR).append(')');
    }
1061083
private <T> void submitQuery(Query<T> query, CompletableFuture<T> future) {
    QueryRequest request = QueryRequest.builder()
      .withSession(state.getSessionId())
      .withSequence(state.getCommandRequest())
      .withIndex(state.getResponseIndex())
      .withQuery(query)
      .build();
    submitQuery(request, future);
  }
640373
protected String transformQuery(String query, QueryTransformer ... qts) {
        String result = query;
        for (QueryTransformer qt : qts) {
            result = transformQuery(result, qt);
        }
        return result;
    }
650272
public static Query create(String query) 
		throws QueryParserException
	{
		QueryTokenizer tokenizer = new QueryTokenizerImpl();
		QueryParser parser = new QueryParserImpl();

		return parser.parse(tokenizer.tokenize(query));
	}
911355
public CqlQuery<K, N, V> setQuery(String query) {
    this.query = StringSerializer.get().toByteBuffer(query);
    return this;
  }
1293204
public static void serializePublishCommands(State state, QueryBasedHivePublishEntity queryBasedHivePublishEntity) {
    state.setProp(HiveAvroORCQueryGenerator.SERIALIZED_PUBLISH_TABLE_COMMANDS,
        GSON.toJson(queryBasedHivePublishEntity));
  }
763629
private String _serializeArray(Array array, Map<Object, String> done, String id) throws ConverterException {
	return _serializeList(array.toList(), done, id);
    }
273955
private String _serializeComponent(Component component, Map<Object, String> done) throws ConverterException {
	StringBuilder sb = new StringBuilder();
	Component ca;
	component = new ComponentSpecificAccess(Component.ACCESS_PRIVATE, ca = component);
	boolean isPeristent = ca.isPersistent();

	deep++;
	Object member;
	Iterator<Key> it = component.keyIterator();
	Collection.Key key;
	while (it.hasNext()) {
	    key = it.next();
	    member = component.get(key, null);
	    if (member instanceof UDF) continue;
	    sb.append(goIn() + "<var scope=\"this\" name=" + del + key.toString() + del + ">");
	    sb.append(_serialize(member, done));
	    sb.append(goIn() + "</var>");
	}

	Property p;
	Boolean remotingFetch;
	Struct props = ignoreRemotingFetch ? null : ComponentUtil.getPropertiesAsStruct(ca, false);
	ComponentScope scope = ca.getComponentScope();
	it = scope.keyIterator();
	while (it.hasNext()) {
	    key = Caster.toKey(it.next(), null);
	    if (!ignoreRemotingFetch) {
		p = (Property) props.get(key, null);
		if (p != null) {
		    remotingFetch = Caster.toBoolean(p.getDynamicAttributes().get(REMOTING_FETCH, null), null);
		    if (remotingFetch == null) {
			if (isPeristent && ORMUtil.isRelated(p)) continue;
		    }
		    else if (!remotingFetch.booleanValue()) continue;
		}
	    }

	    member = scope.get(key, null);
	    if (member instanceof UDF || key.equals(KeyConstants._this)) continue;
	    sb.append(goIn() + "<var scope=\"variables\" name=" + del + key.toString() + del + ">");
	    sb.append(_serialize(member, done));
	    sb.append(goIn() + "</var>");
	}

	deep--;
	try {
	    // return goIn()+"<struct>"+sb+"</struct>";
	    return goIn() + "<component md5=\"" + ComponentUtil.md5(component) + "\" name=\"" + component.getAbsName() + "\">" + sb + "</component>";
	}
	catch (Exception e) {
	    throw toConverterException(e);
	}
    }
499742
private void _serializeDateTime(DateTime dateTime, StringBuilder sb) throws ConverterException {

	try {
	    TimeZone tz = ThreadLocalPageContext.getTimeZone();
	    sb.append(goIn());
	    sb.append("createDateTime(");
	    sb.append(DateFormat.call(null, dateTime, "yyyy,m,d", tz));
	    sb.append(',');
	    sb.append(TimeFormat.call(null, dateTime, "H,m,s,l,", tz));
	    sb.append('"').append(tz.getID()).append('"');
	    sb.append(')');
	}
	catch (PageException e) {
	    throw toConverterException(e);
	}
    }
919041
function serializeQuery(paramsObj) {
    var k, params = [];
    for (k in paramsObj) {
      if (paramsObj.hasOwnProperty(k) && paramsObj[k] !== undefined) {
        params.push(encodeURIComponent(k) + "=" + encodeURIComponent(paramsObj[k]));
      }
    }
    return params.join("&");
  }
30882
protected void writeQueriesEntry(StringBuilder sb, ExecutionInfo execInfo, List<QueryInfo> queryInfoList) {
        sb.append("\"query\":[");
        for (QueryInfo queryInfo : queryInfoList) {
            sb.append("\"");
            sb.append(escapeSpecialCharacter(queryInfo.getQuery()));
            sb.append("\",");
        }
        chompIfEndWith(sb, ',');
        sb.append("], ");
    }
845817
@Override
	protected void serializeTo(RawDataBuffer out)
    {
        super.serializeTo(out);
        out.writeInt(sessionId.asInt());
        out.writeBoolean(transacted);
        out.writeInt(acknowledgeMode);
    }
456518
private void _serializeMap(Map map, StringBuilder sb, Set<Object> done) throws ConverterException {
	if (map instanceof Serializable) {
	    _serializeSerializable((Serializable) map, sb);
	    return;
	}
	sb.append(goIn());
	sb.append("{");

	Iterator it = map.keySet().iterator();
	boolean doIt = false;
	deep++;
	while (it.hasNext()) {
	    Object key = it.next();
	    if (doIt) sb.append(',');
	    doIt = true;
	    sb.append(QUOTE_CHR);
	    sb.append(escape(key.toString()));
	    sb.append(QUOTE_CHR);
	    sb.append(':');
	    _serialize(map.get(key), sb, done);
	}
	deep--;

	sb.append('}');
    }
575833
public function serialyse() {
        
        $this->query = $this->queryPrefix;
        
        foreach ($this->criteriaList->getStoredQueries() as $query) {
            $this->setNextSeparator(false);
            $this->parseQuery($query);
            
        }
        
        $this->finishQuery();
        return $this->query;
    }
246826
public static String encodeQuery(String query, String encoding) throws UnsupportedEncodingException {
		return HierarchicalUriComponents.encodeUriComponent(query, encoding, HierarchicalUriComponents.Type.QUERY);
	}