com.gemstone.gemfire.cache.query.Query.getQueryString()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(9.1k)|赞(0)|评价(0)|浏览(154)

本文整理了Java中com.gemstone.gemfire.cache.query.Query.getQueryString方法的一些代码示例,展示了Query.getQueryString的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getQueryString方法的具体详情如下:
包路径:com.gemstone.gemfire.cache.query.Query
类名称:Query
方法名:getQueryString

Query.getQueryString介绍

[英]Return the original query string that was specified in the constructor.
[中]返回构造函数中指定的原始查询字符串。

代码示例

代码示例来源:origin: org.apache.geode/gemfire-core

@Override
public String toString(){
 return new StringBuffer()
 .append("QueryThreadTask[StartTime:").append(this.StartTime)
 .append(", queryThread:").append(this.queryThread)
 .append(", threadId:").append(this.queryThread.getId())
 .append(", query:").append(this.query.getQueryString())
 .append(", queryExecutionStatus:").append(this.queryExecutionStatus)
 .append("]").toString();
}

代码示例来源:origin: io.snappydata/gemfire-core

@Override
public String toString(){
 return new StringBuffer()
 .append("QueryThreadTask[StartTime:").append(this.StartTime)
 .append(", queryThread:").append(this.queryThread)
 .append(", threadId:").append(this.queryThread.getId())
 .append(", query:").append(this.query.getQueryString())
 .append(", queryExecutionStatus:").append(this.queryExecutionStatus)
 .append("]").toString();
}

代码示例来源:origin: org.apache.apex/malhar-contrib

public List<String> queryIds(int operatorId) throws IOException
{
 List<String> ids = new ArrayList<>();
 try {
  QueryService queryService = clientCache.getQueryService();
  Query query = queryService.newQuery(
    GET_KEYS_QUERY.replace("$[region}", geodeRegionName).replace("${operator.id}", String.valueOf(operatorId)));
  logger.debug("executing query {} ", query.getQueryString());
  SelectResults results = (SelectResults)query.execute();
  for (Iterator iterator = results.iterator(); iterator.hasNext();) {
   ids.add(String.valueOf(iterator.next()));
  }
 } catch (Exception e) {
  throw new RuntimeException(e);
 }
 return ids;
}

代码示例来源:origin: io.snappydata/gemfire-junit

public void test000GetQueryString() {
 System.out.println("testGetQueryString");
 String queryStr = "SELECT DISTINCT * FROM /root";
 Query q = CacheUtils.getQueryService().newQuery(queryStr);
 if(!queryStr.equals(q.getQueryString())){
  fail("Query.getQueryString() returns different query string");
 }
}

代码示例来源:origin: io.snappydata/gemfire-junit

public void testBug35905KeySet() throws Exception{
 Query query = CacheUtils.getQueryService().newQuery("select distinct * from /Portfolios.keySet where toString = '1'");
 Collection result = (Collection)query.execute();
 if(!result.iterator().next().equals("1"))
  fail(query.getQueryString());
}

代码示例来源:origin: io.snappydata/gemfire-junit

public void testBug35905EntrySet() throws Exception{
 Query query = CacheUtils.getQueryService().newQuery("select distinct key from /Portfolios.entrySet , value.positions.values   where value.ID = 1 and key = '1'");
 Collection result = (Collection)query.execute();
 if(!result.iterator().next().equals("1"))
  fail(query.getQueryString());
}

代码示例来源:origin: io.snappydata/gemfire-junit

public void testGetKeys() throws Exception{
 Query query = CacheUtils.getQueryService().newQuery("select distinct * from /Portfolios.keys where toString = '1'");
 Collection result = (Collection)query.execute();
 if(!result.iterator().next().equals("1"))
  fail(query.getQueryString());
}

代码示例来源:origin: io.snappydata/gemfire-junit

public void testMiscQueries() throws Exception{
 String testData[][] ={
  {"/Portfolios.fullPath","/Portfolios"},
  {"/Portfolios.size","4"},
  {"/Portfolios.size > 0","true"},
 };
 for(int i=0;i<testData.length;i++){
  Query query = CacheUtils.getQueryService().newQuery(testData[i][0]);
  String result = query.execute().toString();
  if(!result.equals(testData[i][1]))
   fail(query.getQueryString());
 }
}

代码示例来源:origin: io.snappydata/gemfire-junit

public void testGetValues() throws Exception{
 Query query = CacheUtils.getQueryService().newQuery("select distinct * from /Portfolios.values where ID = 1");
 Collection result = (Collection)query.execute();
 Portfolio p = (Portfolio)result.iterator().next();
 if(p.getID() != 1)
  fail(query.getQueryString());
}

代码示例来源:origin: io.snappydata/gemfire-junit

public void testFALSE() throws Exception{
 Query query = CacheUtils.getQueryService().newQuery("SELECT DISTINCT * FROM /Portfolios where FALSE");
 Object result = query.execute();
 if(!(result instanceof Collection) || ((Collection)result).size() != 0)
  fail(query.getQueryString());
}

代码示例来源:origin: io.snappydata/gemfire-junit

public void testNULL() throws Exception{
  Query query = CacheUtils.getQueryService().newQuery("SELECT DISTINCT * FROM /Portfolios where NULL");
  Object result = query.execute();
  if(!(result instanceof Collection) || ((Collection)result).size() != 0)
   fail(query.getQueryString());
  
  query = CacheUtils.getQueryService().newQuery("SELECT DISTINCT * FROM NULL");
  result = query.execute();
  if(!result.equals(QueryService.UNDEFINED))
   fail(query.getQueryString());
 }
}

代码示例来源:origin: io.snappydata/gemfire-junit

public void testTRUE() throws Exception{
 Query query = CacheUtils.getQueryService().newQuery("SELECT DISTINCT * FROM /Portfolios where TRUE");
 Object result = query.execute();
 if(!(result instanceof Collection) || ((Collection)result).size() != 4)
  fail(query.getQueryString());
}

代码示例来源:origin: io.snappydata/gemfire-junit

public void testUNDEFINED() throws Exception{
 Query query = CacheUtils.getQueryService().newQuery("SELECT DISTINCT * FROM /Portfolios where UNDEFINED");
 Object result = query.execute();
 if(!(result instanceof Collection) || ((Collection)result).size() != 0)
  fail(query.getQueryString());
 
 query = CacheUtils.getQueryService().newQuery("SELECT DISTINCT * FROM UNDEFINED");
 result = query.execute();
 if(!result.equals(QueryService.UNDEFINED))
  fail(query.getQueryString());
}

代码示例来源:origin: io.snappydata/gemfire-junit

public void xtestMiscQueries() throws Exception {
 String testData[] = { "NULL", "UNDEFINED"};
 for (int i = 0; i < testData.length; i++) {
  Query query = CacheUtils.getQueryService().newQuery("SELECT DISTINCT * FROM " + testData[i]);
  Object result = query.execute();
  if (!result.equals(QueryService.UNDEFINED)) fail(query.getQueryString());
 }
}

代码示例来源:origin: io.snappydata/gemfire-junit

public void testELEMENT() throws Exception {
 Query query = CacheUtils.getQueryService().newQuery("ELEMENT(SELECT DISTINCT * FROM /Portfolios where ID =1).status");
 Object result = query.execute();
 if(!result.equals("inactive"))
  fail(query.getQueryString());
 try{
  query = CacheUtils.getQueryService().newQuery("ELEMENT(SELECT DISTINCT * FROM /Portfolios where ID <= 1).status");
  result = query.execute();
  fail(query.getQueryString());
 }catch(FunctionDomainException e){
 }
}

代码示例来源:origin: io.snappydata/gemfire-junit

public void testBug35905ContainsValue() throws Exception{
 String testData[][] ={       
   {"/Portfolios.containsValue($1)","true"},
  };
  for(int i=0;i<testData.length;i++){
   Query query = CacheUtils.getQueryService().newQuery(testData[i][0]);
   String result = query.execute(new Object[]{CacheUtils.getRegion("/Portfolios").get("1")}).toString();
   if(!result.equals(testData[i][1]))
    fail(query.getQueryString());
  }
}

代码示例来源:origin: io.snappydata/gemfire-junit

public void testGetEntries() throws Exception{
 Query query = CacheUtils.getQueryService().newQuery("select distinct * from /Portfolios.entries where value.ID = 1 and key = '1'");
 Collection result = (Collection)query.execute();
 Region.Entry entry = (Region.Entry)result.iterator().next();
 if(!entry.getKey().equals("1") || ((Portfolio)entry.getValue()).getID() != 1)
  fail(query.getQueryString());
}

代码示例来源:origin: io.snappydata/gemfire-junit

public void xtestVoidMethods() throws Exception {
 Region region = CacheUtils.createRegion("Data", Data.class);
 region.put("0", new Data());
 Query query = CacheUtils.getQueryService().newQuery("SELECT DISTINCT * FROM /Data where voidMethod");
 Collection result = (Collection) query.execute();
 if (result.size() != 0) fail(query.getQueryString());
 query = CacheUtils.getQueryService().newQuery("SELECT DISTINCT * FROM /Data where voidMethod = null ");
 result = (Collection) query.execute();
 if (result.size() != 1) fail(query.getQueryString());
}

代码示例来源:origin: io.snappydata/gemfire-junit

public void testMisc() throws Exception {
 QueryService qs = CacheUtils.getQueryService();
 for(int i =0;i<miscQueries.length;++i) {
  String qStr = miscQueries[i];
  Query q = qs.newQuery(qStr);
  Object r = q.execute();
  if(r != QueryService.UNDEFINED)
   fail(q.getQueryString());
 }
}

代码示例来源:origin: io.snappydata/gemfire-junit

public void xtestNestQueryInFromClause() throws Exception {
 Region region = CacheUtils.createRegion("Portfolios", Portfolio.class);
 region.put("0", new Portfolio(0));
 region.put("1", new Portfolio(1));
 region.put("2", new Portfolio(2));
 region.put("3", new Portfolio(3));
 Query query = CacheUtils.getQueryService().newQuery(
   "SELECT DISTINCT * FROM (SELECT DISTINCT * FROM /Portfolios where status = 'active') p  where p.ID = 0");
 //    DebuggerSupport.waitForJavaDebugger(CacheUtils.getLogger());
 Collection result = (Collection) query.execute();
 Portfolio p = (Portfolio) (result.iterator().next());
 if (!p.status.equals("active") || p.getID() != 0) fail(query.getQueryString());
}

相关文章