• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ query类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中query的典型用法代码示例。如果您正苦于以下问题:C++ query类的具体用法?C++ query怎么用?C++ query使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了query类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: features

featureset_ptr shape_datasource::features(query const& q) const
{
#ifdef MAPNIK_STATS
    mapnik::progress_timer __stats__(std::clog, "shape_datasource::features");
#endif

    filter_in_box filter(q.get_bbox());
    if (indexed_)
    {
        std::unique_ptr<shape_io> shape_ptr = std::make_unique<shape_io>(shape_name_);
        return featureset_ptr
            (new shape_index_featureset<filter_in_box>(filter,
                                                       std::move(shape_ptr),
                                                       q.property_names(),
                                                       desc_.get_encoding(),
                                                       shape_name_,
                                                       row_limit_));
    }
    else
    {
        return std::make_shared<shape_featureset<filter_in_box> >(filter,
                                                                  shape_name_,
                                                                  q.property_names(),
                                                                  desc_.get_encoding(),
                                                                  file_length_,
                                                                  row_limit_);
    }
}
开发者ID:Andrey-VI,项目名称:mapnik,代码行数:28,代码来源:shape_datasource.cpp


示例2: features

featureset_ptr shape_datasource::features(const query& q) const
{
    if (!is_bound_) bind();

    filter_in_box filter(q.get_bbox());
    if (indexed_)
    {
        shape_->shp().seek(0);
        // TODO - use boost::make_shared - #760
        return featureset_ptr
            (new shape_index_featureset<filter_in_box>(filter,
                                                       *shape_,
                                                       q.property_names(),
                                                       desc_.get_encoding(),
                                                       shape_name_,
                                                       row_limit_));
    }
    else
    {
        return boost::make_shared<shape_featureset<filter_in_box> >(filter,
                                                                    shape_name_,
                                                                    q.property_names(),
                                                                    desc_.get_encoding(),
                                                                    file_length_,
                                                                    row_limit_);
    }
}
开发者ID:novldp,项目名称:mapnik,代码行数:27,代码来源:shape_datasource.cpp


示例3: features

featureset_ptr shape_datasource::features(const query& q) const
{
#ifdef MAPNIK_STATS
    mapnik::progress_timer __stats__(std::clog, "shape_datasource::features");
#endif

    filter_in_box filter(q.get_bbox());
    if (indexed_)
    {
        shape_->shp().seek(0);
        // TODO - use std::make_shared - #760
        return featureset_ptr
            (new shape_index_featureset<filter_in_box>(filter,
                                                       *shape_,
                                                       q.property_names(),
                                                       desc_.get_encoding(),
                                                       shape_name_,
                                                       row_limit_));
    }
    else
    {
        return std::make_shared<shape_featureset<filter_in_box> >(filter,
                                                                    shape_name_,
                                                                    q.property_names(),
                                                                    desc_.get_encoding(),
                                                                    file_length_,
                                                                    row_limit_);
    }
}
开发者ID:FlavioFalcao,项目名称:mapnik,代码行数:29,代码来源:shape_datasource.cpp


示例4: features

featureset_ptr ogr_datasource::features(query const& q) const
{
    if (! is_bound_) bind();
   
    if (dataset_ && layer_.is_valid())
    {
        OGRLayer* layer = layer_.layer();

        if (indexed_)
        {
            filter_in_box filter(q.get_bbox());
            
            return featureset_ptr(new ogr_index_featureset<filter_in_box>(*dataset_,
                                                                          *layer,
                                                                          filter,
                                                                          index_name_,
                                                                          desc_.get_encoding(),
                                                                          multiple_geometries_));
        }
        else
        {
            return featureset_ptr(new ogr_featureset (*dataset_,
                                                      *layer,
                                                      q.get_bbox(),
                                                      desc_.get_encoding(),
                                                      multiple_geometries_));
        }
    }

    return featureset_ptr();
}
开发者ID:ParveenArora,项目名称:mapnik,代码行数:31,代码来源:ogr_datasource.cpp


示例5: main

int main(int argc, char *argv[])
{
	if(argc < 2)
	{
		puts("Usage : ./megatron201001015 schema.txt");
		return 0;
	}

	D.load_schema(argv[1]);
	//D.print_schema();
	D.load_data();
	//D.save_data();

	int b1,b2,b3;
	while(printf("\n$"))
	{
		cin.getline(inp_query, MAX_QSZ);
		if(strcasecmp(inp_query, "quit") == 0)
			break;

		if((b1=Q.syntax_check(inp_query)) && (b2=Q.valid()) && (b3=Q.parse_condition()))
			Q.process_query();
		else
		{
			puts("Query not processed");
			printf("%d%d%d\n",b1,b2,b3);
			//Q.print_debug();
		}
	}
	return 0;
}
开发者ID:yashdv,项目名称:DBMS-Algorithms,代码行数:31,代码来源:megatron201001015.cpp


示例6: policy_

raster_featureset<LookupPolicy>::raster_featureset(LookupPolicy const& policy,query const& q)
    : policy_(policy),
      id_(1),
      extent_(q.get_bbox()),
      t_(q.get_width(),q.get_height(),extent_),
      curIter_(policy_.query(extent_)),
      endIter_(policy_.end()) 

{}
开发者ID:BackupTheBerlios,项目名称:mapnik-svn,代码行数:9,代码来源:raster_featureset.cpp


示例7: features

featureset_ptr shape_datasource::features(const query& q) const
{
    filter_in_box filter(q.get_bbox());
    if (indexed_)
    {
        return featureset_ptr(new shape_index_featureset<filter_in_box>(filter,shape_name_,q.property_names()));
    }
    return featureset_ptr(new shape_featureset<filter_in_box>(filter,shape_name_,q.property_names(),file_length_));
}
开发者ID:BackupTheBerlios,项目名称:mapnik-svn,代码行数:9,代码来源:shape.cpp


示例8: features

featureset_ptr osm_datasource::features(const query& q) const
{
    filter_in_box filter(q.get_bbox());
    // so we need to filter osm features by bbox here...

    return std::make_shared<osm_featureset<filter_in_box> >(filter,
                                                              osm_data_,
                                                              q.property_names(),
                                                              desc_.get_encoding());
}
开发者ID:Andrey-VI,项目名称:mapnik,代码行数:10,代码来源:osm_datasource.cpp


示例9: features

featureset_ptr ogr_datasource::features(query const& q) const
{
   if (!is_bound_) bind();
   
   if (dataset_ && layer_)
   {

        // TODO - actually filter fields!
        // http://trac.osgeo.org/gdal/wiki/rfc29_desired_fields
        // http://trac.osgeo.org/gdal/wiki/rfc28_sqlfunc
#if 0
        std::ostringstream s;
            
        s << "select ";
        std::set<std::string> const& props=q.property_names();
        std::set<std::string>::const_iterator pos=props.begin();
        std::set<std::string>::const_iterator end=props.end();
        while (pos != end)
        {
           s <<",\""<<*pos<<"\"";
           ++pos;
        }   
        s << " from " << layerName_ ;

        // execute existing SQL
        OGRLayer* layer = dataset_->ExecuteSQL (s.str(), poly);

        // layer must be freed
        dataset_->ReleaseResultSet (layer);
#endif

        if (indexed_)
        {
            filter_in_box filter(q.get_bbox());
            
            return featureset_ptr(new ogr_index_featureset<filter_in_box> (*dataset_,
                                                                           *layer_,
                                                                           filter,
                                                                           index_name_,
                                                                           desc_.get_encoding(),
                                                                           multiple_geometries_));
        }
        else
        {
            return featureset_ptr(new ogr_featureset (*dataset_,
                                                      *layer_,
                                                      q.get_bbox(),
                                                      desc_.get_encoding(),
                                                      multiple_geometries_));
        }
   }
   return featureset_ptr();
}
开发者ID:dpaleino,项目名称:mapnik,代码行数:53,代码来源:ogr_datasource.cpp


示例10:

raster_featureset<LookupPolicy>::raster_featureset(LookupPolicy const& policy,
                                                   box2d<double> const& extent,
                                                   query const& q)
    : policy_(policy),
      feature_id_(1),
      ctx_(std::make_shared<mapnik::context_type>()),
      extent_(extent),
      bbox_(q.get_bbox()),
      curIter_(policy_.begin()),
      endIter_(policy_.end()),
      filter_factor_(q.get_filter_factor())
{
}
开发者ID:mapycz,项目名称:mapnik,代码行数:13,代码来源:raster_featureset.cpp


示例11: validate_attribute_names

void validate_attribute_names(query const& q, std::vector<attribute_descriptor> const& names )
{
    std::set<std::string> const& attribute_names = q.property_names();
    std::set<std::string>::const_iterator pos = attribute_names.begin();
    std::set<std::string>::const_iterator end_names = attribute_names.end();

    for ( ;pos != end_names; ++pos)
    {
        bool found_name = false;

        for (auto const& attr_info : names)
        {
            if (attr_info.get_name() == *pos)
            {
                found_name = true;
                break;
            }
        }

        if (! found_name)
        {
            std::ostringstream s;
            s << "OGR Plugin: no attribute named '" << *pos << "'. Valid attributes are: ";
            for (auto const& attr_info2 : names)
            {
                s << attr_info2.get_name() << std::endl;
            }
            throw mapnik::datasource_exception(s.str());
        }
    }
}
开发者ID:DavidLiuGitHub,项目名称:mapnik,代码行数:31,代码来源:ogr_datasource.cpp


示例12: features

featureset_ptr geos_datasource::features(query const& q) const
{
    if (!is_bound_) bind();

    const mapnik::box2d<double> extent = q.get_bbox();

    std::ostringstream s;
    s << "POLYGON(("
      << extent.minx() << " " << extent.miny() << ","
      << extent.maxx() << " " << extent.miny() << ","
      << extent.maxx() << " " << extent.maxy() << ","
      << extent.minx() << " " << extent.maxy() << ","
      << extent.minx() << " " << extent.miny()
      << "))";

#ifdef MAPNIK_DEBUG
    clog << "GEOS Plugin: using extent: " << s.str() << endl;
#endif

    return boost::make_shared<geos_featureset>(*geometry_,
                                               GEOSGeomFromWKT(s.str().c_str()),
                                               geometry_id_,
                                               geometry_data_,
                                               geometry_data_name_,
                                               desc_.get_encoding(),
                                               multiple_geometries_);
}
开发者ID:dpaleino,项目名称:mapnik,代码行数:27,代码来源:geos_datasource.cpp


示例13: features

featureset_ptr raster_datasource::features(query const& q) const
{
    if (! is_bound_) bind();

    mapnik::CoordTransform t(width_, height_, extent_, 0, 0);
    mapnik::box2d<double> intersect = extent_.intersect(q.get_bbox());
    mapnik::box2d<double> ext = t.forward(intersect);

    const int width  = int(ext.maxx() + 0.5) - int(ext.minx() + 0.5);
    const int height = int(ext.maxy() + 0.5) - int(ext.miny() + 0.5);

#ifdef MAPNIK_DEBUG
    std::clog << "Raster Plugin: BOX SIZE(" << width << " " << height << ")" << std::endl;
#endif

    if (multi_tiles_)
    {
#ifdef MAPNIK_DEBUG
        std::clog << "Raster Plugin: MULTI-TILED policy" << std::endl;
#endif

        tiled_multi_file_policy policy(filename_, format_, tile_size_, extent_, q.get_bbox(), width_, height_, tile_stride_);

        return boost::make_shared<raster_featureset<tiled_multi_file_policy> >(policy, extent_, q);
    }
    else if (width * height > 512*512)
    {
#ifdef MAPNIK_DEBUG
        std::clog << "Raster Plugin: TILED policy" << std::endl;
#endif

        tiled_file_policy policy(filename_, format_, 256, extent_, q.get_bbox(), width_, height_);

        return boost::make_shared<raster_featureset<tiled_file_policy> >(policy, extent_, q);
    }
    else
    {
#ifdef MAPNIK_DEBUG
        std::clog << "Raster Plugin: SINGLE FILE" << std::endl;
#endif

        raster_info info(filename_, format_, extent_, width_, height_);
        single_file_policy policy(info);

        return boost::make_shared<raster_featureset<single_file_policy> >(policy, extent_, q);
    }
}
开发者ID:bygreencn,项目名称:mapnik,代码行数:47,代码来源:raster_datasource.cpp


示例14: __stats__

featureset_ptr ogr_datasource::features(query const& q) const
{
    if (! is_bound_) bind();

#ifdef MAPNIK_STATS
    mapnik::progress_timer __stats__(std::clog, "ogr_datasource::features");
#endif

    if (dataset_ && layer_.is_valid())
    {
        // First we validate query fields: https://github.com/mapnik/mapnik/issues/792

        std::vector<attribute_descriptor> const& desc_ar = desc_.get_descriptors();
        // feature context (schema)
        mapnik::context_ptr ctx = boost::make_shared<mapnik::context_type>();

        std::vector<attribute_descriptor>::const_iterator itr = desc_ar.begin();
        std::vector<attribute_descriptor>::const_iterator end = desc_ar.end();

        for (; itr!=end; ++itr) ctx->push(itr->get_name()); // TODO only push query attributes

        validate_attribute_names(q, desc_ar);

        OGRLayer* layer = layer_.layer();

        if (indexed_)
        {
            filter_in_box filter(q.get_bbox());

            return featureset_ptr(new ogr_index_featureset<filter_in_box>(ctx,
                                                                          *layer,
                                                                          filter,
                                                                          index_name_,
                                                                          desc_.get_encoding()));
        }
        else
        {
            return featureset_ptr(new ogr_featureset(ctx,
                                                      *layer,
                                                      q.get_bbox(),
                                                      desc_.get_encoding()));
        }
    }

    return featureset_ptr();
}
开发者ID:PaulWagener,项目名称:mapnik,代码行数:46,代码来源:ogr_datasource.cpp


示例15: reduce_and_sort

/**< select best result of each files and sort all of them by ranker */
void reduce_and_sort(query &result,unordered_map<string,int> &ranker)
{
    vector<word_position*> vals;

    result.for_each([&vals](word_position* p) mutable
    {
        if(none_of(vals.begin(),vals.end(),[p](word_position* pos) {
        return pos->document==p->document;
    }))
        vals.push_back(p);
    });

    sort(vals.begin(),vals.end(),[&ranker](word_position *i,word_position *j) {
        return ranker[i->document]>ranker[j->document];
    });

    result=query(vals,result.get_query_words());
}
开发者ID:jeffreye,项目名称:wlgq,代码行数:19,代码来源:quester.cpp


示例16:

vector<row> database::refine(const query &q, const vector<row> &rows) {
  vector<row> results;

  for (int i=0;i<rows.size();i++) {
    if (q.eval(rows[i]) && !rows[i].is_empty()) results.push_back(rows[i]);
  }

  return results;
}
开发者ID:joshmg,项目名称:db2,代码行数:9,代码来源:db.cpp


示例17:

vector<row> table::select(const query &q) {
  vector<row> results;

  row temp_row;
  // perform key-search
  if (q.singularity(_key)) {
    for (int i=0;i<_keys.size();i++) {
      temp_row.add((*_keys[i].col), _keys[i].data);
      if (q.partial_eval(_key, temp_row)) {
        results.push_back(read_row(_keys[i].fpos/_row_size));
        //if (results.back().is_empty()) results.pop_back();
        if (results.back().is_empty() || !q.eval(results.back())) {
          results.erase(results.end()-1);
        }
      }
      temp_row.clear();
      if (q._limit > -1 && results.size() >= q._limit) break; //results.erase(results.end()-1);
    }
    
/*    for (int i=0;i<results.size();i++) {
      if (results[i].is_empty() || !q.eval(results[i])) {
        results.erase(results.begin()+i);
        --i;
      }
    }*/
    
    // truncate results to q._limit
    /*if (q._limit > -1) while (results.size() > q._limit) {
      if (results.size() == 0) break;
      results.erase(results.end()-1);
    }*/
  }
  // perform full search:
  else {
    for (int i=0;i<_row_count;i++) {
      results.push_back(read_row(i));
      if (results.back().is_empty() || !q.eval(results.back())) results.pop_back();
      // limit results size to q._limit
      if (results.size() >= q._limit) break;
    }
  }

  return results;
}
开发者ID:joshmg,项目名称:db2,代码行数:44,代码来源:table.cpp


示例18:

raster_featureset<LookupPolicy>::raster_featureset(LookupPolicy const& policy,
                                                   box2d<double> const& extent,
                                                   query const& q)
  : policy_(policy),
    feature_id_(1),
    extent_(extent),
    bbox_(q.get_bbox()),
    curIter_(policy_.begin()),
    endIter_(policy_.end())
{
}
开发者ID:ParveenArora,项目名称:mapnik,代码行数:11,代码来源:raster_featureset.cpp


示例19: owner

    resultSet::resultSet(connection &c, const query &q) : owner(c) {
        ZOOM_connection yazc = c._getYazConnection();
        rs = ZOOM_connection_search(yazc, q._getYazQuery());
        int errcode;
        const char *errmsg;     // unused: carries same info as `errcode'
        const char *addinfo;

        if ((errcode = ZOOM_connection_error(yazc, &errmsg, &addinfo)) != 0) {
            ZOOM_resultset_destroy(rs);
            throw bib1Exception(errcode, addinfo);
        }
    }
开发者ID:dcrossleyau,项目名称:yazpp,代码行数:12,代码来源:zrs.cpp


示例20: features

featureset_ptr raster_datasource::features(query const& q) const
{
    if (! is_bound_) bind();

    mapnik::CoordTransform t(width_, height_, extent_, 0, 0);
    mapnik::box2d<double> intersect = extent_.intersect(q.get_bbox());
    mapnik::box2d<double> ext = t.forward(intersect);

    const int width  = int(ext.maxx() + 0.5) - int(ext.minx() + 0.5);
    const int height = int(ext.maxy() + 0.5) - int(ext.miny() + 0.5);

    MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Box size=" << width << "," << height;

    if (multi_tiles_)
    {
        MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Multi-Tiled policy";

        tiled_multi_file_policy policy(filename_, format_, tile_size_, extent_, q.get_bbox(), width_, height_, tile_stride_);

        return boost::make_shared<raster_featureset<tiled_multi_file_policy> >(policy, extent_, q);
    }
    else if (width * height > (tile_size_ * tile_size_ << 2))
    {
        MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Tiled policy";

        tiled_file_policy policy(filename_, format_, tile_size_, extent_, q.get_bbox(), width_, height_);

        return boost::make_shared<raster_featureset<tiled_file_policy> >(policy, extent_, q);
    }
    else
    {
        MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Single file";

        raster_info info(filename_, format_, extent_, width_, height_);
        single_file_policy policy(info);

        return boost::make_shared<raster_featureset<single_file_policy> >(policy, extent_, q);
    }
}
开发者ID:LeadsPlus,项目名称:mapnik,代码行数:39,代码来源:raster_datasource.cpp



注:本文中的query类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ query_ptr类代码示例发布时间:2022-05-31
下一篇:
C++ quaternion类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap