当前位置: 首页>>代码示例>>C++>>正文


C++ MetaData::getString方法代码示例

本文整理汇总了C++中MetaData::getString方法的典型用法代码示例。如果您正苦于以下问题:C++ MetaData::getString方法的具体用法?C++ MetaData::getString怎么用?C++ MetaData::getString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MetaData的用法示例。


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

示例1: next

feature_ptr occi_featureset::next()
{
    while (rs_ != nullptr && rs_->next() == oracle::occi::ResultSet::DATA_AVAILABLE)
    {
        feature_ptr feature(feature_factory::create(ctx_, feature_id_));

        if (use_wkb_)
        {
            Blob blob = rs_->getBlob(1);
            blob.open(oracle::occi::OCCI_LOB_READONLY);

            unsigned int size = blob.length();
            if (buffer_.size() < size)
            {
                buffer_.resize(size);
            }

            oracle::occi::Stream* instream = blob.getStream(1, 0);
            instream->readBuffer(buffer_.data(), size);
            blob.closeStream(instream);
            blob.close();

            if (! geometry_utils::from_wkb(feature->paths(), buffer_.data(), size))
            {
                continue;
            }
        }
        else
        {
            const std::unique_ptr<SDOGeometry> geom(dynamic_cast<SDOGeometry*>(rs_->getObject(1)));
            if (geom.get())
            {
                convert_geometry(geom.get(), feature);
            }
            else
            {
                continue;
            }
        }

        std::vector<MetaData> listOfColumns = rs_->getColumnListMetaData();

        for (unsigned int i = 1; i < listOfColumns.size(); ++i)
        {
            MetaData columnObj = listOfColumns[i];

            std::string fld_name = columnObj.getString(MetaData::ATTR_NAME);
            int type_oid = columnObj.getInt(MetaData::ATTR_DATA_TYPE);

            /*
              int type_code = columnObj.getInt(MetaData::ATTR_TYPECODE);
              if (type_code == OCCI_TYPECODE_OBJECT)
              {
              continue;
              }
            */

            switch (type_oid)
            {
            case oracle::occi::OCCIBOOL:
                feature->put(fld_name, (rs_->getInt(i + 1) != 0));
                break;
            case oracle::occi::OCCIINT:
            case oracle::occi::OCCIUNSIGNED_INT:
                feature->put(fld_name, static_cast<mapnik::value_integer>(rs_->getInt(i + 1)));
                break;
            case oracle::occi::OCCIFLOAT:
            case oracle::occi::OCCIBFLOAT:
                feature->put(fld_name, (double)rs_->getFloat(i + 1));
                break;
            case oracle::occi::OCCIDOUBLE:
            case oracle::occi::OCCIBDOUBLE:
            case oracle::occi::OCCINUMBER:
            case oracle::occi::OCCI_SQLT_NUM:
                feature->put(fld_name, rs_->getDouble(i + 1));
                break;
            case oracle::occi::OCCICHAR:
            case oracle::occi::OCCISTRING:
            case oracle::occi::OCCI_SQLT_AFC:
            case oracle::occi::OCCI_SQLT_AVC:
            case oracle::occi::OCCI_SQLT_CHR:
            case oracle::occi::OCCI_SQLT_LNG:
            case oracle::occi::OCCI_SQLT_LVC:
            case oracle::occi::OCCI_SQLT_STR:
            case oracle::occi::OCCI_SQLT_VCS:
            case oracle::occi::OCCI_SQLT_VNU:
            case oracle::occi::OCCI_SQLT_VBI:
            case oracle::occi::OCCI_SQLT_VST:
            case oracle::occi::OCCIROWID:
            case oracle::occi::OCCI_SQLT_RDD:
            case oracle::occi::OCCI_SQLT_RID:
            case oracle::occi::OCCIDATE:
            case oracle::occi::OCCI_SQLT_DAT:
            case oracle::occi::OCCI_SQLT_DATE:
            case oracle::occi::OCCI_SQLT_TIME:
            case oracle::occi::OCCI_SQLT_TIME_TZ:
            case oracle::occi::OCCITIMESTAMP:
            case oracle::occi::OCCI_SQLT_TIMESTAMP:
            case oracle::occi::OCCI_SQLT_TIMESTAMP_LTZ:
            case oracle::occi::OCCI_SQLT_TIMESTAMP_TZ:
//.........这里部分代码省略.........
开发者ID:MapQuest,项目名称:mapnik,代码行数:101,代码来源:occi_featureset.cpp

示例2: bind

void occi_datasource::bind() const
{
    if (is_bound_) return;

#ifdef MAPNIK_STATS
    mapnik::progress_timer __stats__(std::clog, "occi_datasource::bind");
#endif

    // connect to environment
    if (use_connection_pool_)
    {
        try
        {
            Environment* env = occi_environment::get_environment();

            pool_ = env->createStatelessConnectionPool(
                *params_.get<std::string>("user"),
                *params_.get<std::string>("password"),
                *params_.get<std::string>("host"),
                *params_.get<int>("max_size", 5),
                *params_.get<int>("initial_size", 1),
                1,
                StatelessConnectionPool::HOMOGENEOUS);
        }
        catch (SQLException& ex)
        {
            throw datasource_exception("OCCI Plugin: " + ex.getMessage());
        }
    }
    else
    {
        try
        {
            Environment* env = occi_environment::get_environment();

            conn_ = env->createConnection(
                *params_.get<std::string>("user"),
                *params_.get<std::string>("password"),
                *params_.get<std::string>("host"));
        }
        catch (SQLException& ex)
        {
            throw datasource_exception("OCCI Plugin: " + ex.getMessage());
        }
    }

    // extract real table name
    table_name_ = mapnik::sql_utils::table_from_sql(table_);

    // get SRID and/or GEOMETRY_FIELD from metadata table only if we need to
    if (! srid_initialized_ || geometry_field_ == "")
    {
#ifdef MAPNIK_STATS
        mapnik::progress_timer __stats__(std::clog, "occi_datasource::get_srid_and_geometry_field");
#endif

        std::ostringstream s;
        s << "SELECT srid, column_name FROM " << METADATA_TABLE << " WHERE";
        s << " LOWER(table_name) = LOWER('" << table_name_ << "')";

        if (geometry_field_ != "")
        {
            s << " AND LOWER(column_name) = LOWER('" << geometry_field_ << "')";
        }

        MAPNIK_LOG_DEBUG(occi) << "occi_datasource: " << s.str();

        try
        {
            occi_connection_ptr conn;
            if (use_connection_pool_) conn.set_pool(pool_);
            else                      conn.set_connection(conn_, false);

            ResultSet* rs = conn.execute_query(s.str());
            if (rs && rs->next ())
            {
                if (! srid_initialized_)
                {
                    srid_ = rs->getInt(1);
                    srid_initialized_ = true;
                }

                if (geometry_field_ == "")
                {
                    geometry_field_ = rs->getString(2);
                }
            }
        }
        catch (SQLException& ex)
        {
            throw datasource_exception("OCCI Plugin: " + ex.getMessage());
        }
    }

    // get columns description
    {
#ifdef MAPNIK_STATS
        mapnik::progress_timer __stats__(std::clog, "occi_datasource::get_column_description");
#endif

//.........这里部分代码省略.........
开发者ID:ClaudioFloreani,项目名称:mapnik,代码行数:101,代码来源:occi_datasource.cpp

示例3: __stats__


//.........这里部分代码省略.........
    {
#ifdef MAPNIK_STATS
        mapnik::progress_timer __stats__(std::clog, "occi_datasource::get_srid_and_geometry_field");
#endif

        std::ostringstream s;
        s << "SELECT srid, column_name FROM " << METADATA_TABLE << " WHERE";
        s << " LOWER(table_name) = LOWER('" << table_name_ << "')";

        if (geometry_field_ != "")
        {
            s << " AND LOWER(column_name) = LOWER('" << geometry_field_ << "')";
        }

        MAPNIK_LOG_DEBUG(occi) << "occi_datasource: " << s.str();

        try
        {
            occi_connection_ptr conn;
            if (use_connection_pool_) conn.set_pool(pool_);
            else                      conn.set_connection(conn_, false);

            ResultSet* rs = conn.execute_query(s.str());
            if (rs && rs->next ())
            {
                if (! srid_initialized_)
                {
                    srid_ = rs->getInt(1);
                    srid_initialized_ = true;
                }

                if (geometry_field_ == "")
                {
                    geometry_field_ = rs->getString(2);
                }
            }
        }
        catch (SQLException& ex)
        {
            throw datasource_exception("OCCI Plugin: " + ex.getMessage());
        }
    }

    // get columns description
    {
#ifdef MAPNIK_STATS
        mapnik::progress_timer __stats__(std::clog, "occi_datasource::get_column_description");
#endif

        std::ostringstream s;
        s << "SELECT " << fields_ << " FROM (" << table_name_ << ") WHERE ROWNUM < 1";

        MAPNIK_LOG_DEBUG(occi) << "occi_datasource: " << s.str();

        try
        {
            occi_connection_ptr conn;
            if (use_connection_pool_) conn.set_pool(pool_);
            else                      conn.set_connection(conn_, false);

            ResultSet* rs = conn.execute_query(s.str());
            if (rs)
            {
                std::vector<MetaData> listOfColumns = rs->getColumnListMetaData();

                for (unsigned int i = 0; i < listOfColumns.size(); ++i)
开发者ID:gischen,项目名称:mapnik,代码行数:67,代码来源:occi_datasource.cpp


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