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


C++ Statement::GetString方法代码示例

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


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

示例1: _GetChatroom

	bool Database::_GetChatroom(Statement &s, Chatroom &Out)
	{
		Nullable<std::string> Name;
		Nullable<std::string> OwnerUsername;
		Nullable<std::string> Password;
		Nullable<std::string> Description;
		Nullable<int> ServerFamily;
		Nullable<std::string> ServerIP;
		Nullable<int> ServerPort;

		if (!s.GetString("Name", Name) || !s.GetString("OwnerUsername", OwnerUsername) || !s.GetString("Password", Password) ||
				!s.GetString("Description", Description) || !s.GetInt("ServerFamily", ServerFamily) ||
				!s.GetString("ServerIP", ServerIP) || !s.GetInt("ServerPort", ServerPort))
			return false;

		if (Name.Null || OwnerUsername.Null || ServerIP.Null || ServerFamily.Null || ServerPort.Null)
			return false;

		Net::Address Address;
		Address.Load(ServerFamily.Value, ServerIP.Value, ServerPort.Value);
		Out.Name = Name.Value;
		Out.OwnerUsername = OwnerUsername.Value;
		Out.ServerAddress = Address;
		Out.Password = Password;
		Out.Description = Description;

		return true;
	}
开发者ID:hnefatl,项目名称:Chatroom,代码行数:28,代码来源:Database.cpp

示例2: _GetUser

	bool Database::_GetUser(Statement &s, User &Out)
	{
		Nullable<std::string> Username;
		Nullable<std::string> Password;

		if (!s.GetString("Username", Username) || !s.GetString("Password", Password))
			return false;

		if (Username.Null || Password.Null)
			return false;

		Out.Username = Username.Value;
		Out.Password = Password.Value;
		return true;
	}
开发者ID:hnefatl,项目名称:Chatroom,代码行数:15,代码来源:Database.cpp

示例3: _GetServer

	bool Database::_GetServer(Statement &s, Server &Out)
	{
		Nullable<std::string> Name;
		Nullable<int> Family;
		Nullable<std::string> IP;
		Nullable<int> Port;

		if (!s.GetString("Name", Name) || !s.GetInt("Family", Family) || !s.GetString("IP", IP) || !s.GetInt("Port", Port))
			return false;

		if (Family.Null || IP.Null || Port.Null || Name.Null)
			return false;

		Net::Address Address;
		Address.Load(Family.Value, IP.Value, Port.Value);
		Out.Address = Address;
		Out.Name = Name.Value;

		return true;
	}
开发者ID:hnefatl,项目名称:Chatroom,代码行数:20,代码来源:Database.cpp

示例4: fetchSchema

schema::XMLSchema fetchSchema(Statement stmt, BlockPtr block)
{
    // Fetch the XML that defines the schema for this point cloud
    std::ostringstream schemaQuery;
    OCILobLocator* metadata = NULL;
    schemaQuery <<
        "DECLARE" << std::endl << "PC_TABLE VARCHAR2(32) := '" <<
            stmt->GetString(block->pc->base_table) << "';" << std::endl <<
        "PC_ID NUMBER := " << stmt->GetInteger(&(block->pc->pc_id)) <<
            ";" << std::endl <<
        "PC_COLUMN VARCHAR2(32) := '" <<
            stmt->GetString(block->pc->base_column) << "';" << std::endl <<
        "BEGIN" << std::endl <<
        std::endl <<
        "EXECUTE IMMEDIATE" << std::endl <<
        " 'SELECT T.'||PC_COLUMN||'.PC_OTHER_ATTRS.getClobVal()"
            "FROM '||pc_table||' T WHERE T.ID='||"
            "PC_ID INTO :metadata;" << std::endl <<
        "END;" << std::endl;

    Statement getSchemaStmt(
        block->m_connection->CreateStatement(schemaQuery.str().c_str()));
    getSchemaStmt->BindName(":metadata", &metadata);

    getSchemaStmt->Execute();

    char* pc_schema = getSchemaStmt->ReadCLob(metadata);
    std::string pc_schema_xml;
    if (pc_schema)
    {
        pc_schema_xml = pc_schema;
        CPLFree(pc_schema);
    }
    std::ostringstream fname;
    int cloudId = stmt->GetInteger(&(block->pc->pc_id)) ;
//     fname << "schema-" << cloudId <<".xml";
//         std::ostream* out = FileUtils::createFile(fname.str());
//         out->write(pc_schema_xml.c_str(), pc_schema_xml.size());
//         FileUtils::closeFile(out);
    return schema::Reader(pc_schema_xml).schema();
}
开发者ID:simonsonc,项目名称:PDAL,代码行数:41,代码来源:common.cpp

示例5: fetchSchema

pdal::Schema Reader::fetchSchema(Statement statement, sdo_pc* pc, boost::uint32_t& capacity, std::string ns_override) const
{
    log()->get(logDEBUG) << "Fetching schema from SDO_PC object" << std::endl;

    // Fetch the XML that defines the schema for this point cloud
    std::ostringstream select_schema;
    OCILobLocator* metadata = NULL;
    select_schema
            << "DECLARE" << std::endl
            << "PC_TABLE VARCHAR2(32) := '" << statement->GetString(pc->base_table) << "';" << std::endl
            << "PC_ID NUMBER := " << statement->GetInteger(&(pc->pc_id)) << ";" << std::endl
            << "PC_COLUMN VARCHAR2(32) := '" << statement->GetString(pc->base_column) << "';" << std::endl
            << "BEGIN" << std::endl
            << std::endl
            << "EXECUTE IMMEDIATE" << std::endl
            << " 'SELECT T.'||PC_COLUMN||'.PC_OTHER_ATTRS.getClobVal(), T.'||PC_COLUMN||'.PTN_PARAMS FROM '||pc_table||' T WHERE T.ID='||PC_ID INTO :metadata, :capacity;"
            << std::endl
            << "END;"
            << std::endl;
    Statement get_schema(m_connection->CreateStatement(select_schema.str().c_str()));
    get_schema->BindName(":metadata", &metadata);

    int ptn_params_length = 1024;
    char* ptn_params = (char*) malloc(sizeof(char*) * ptn_params_length);
    ptn_params[ptn_params_length-1] = '\0'; //added trailing null to fix ORA-01480
    get_schema->BindName(":capacity", ptn_params, ptn_params_length);
    get_schema->Execute();

    char* pc_schema = get_schema->ReadCLob(metadata);

    std::string write_schema_file = getOptions().getValueOrDefault<std::string>("xml_schema_dump", std::string(""));
    if (write_schema_file.size() > 0)
    {
        std::ostream* out = FileUtils::createFile(write_schema_file);
        out->write(pc_schema, strlen(pc_schema));
        FileUtils::closeFile(out);
    }


    // Fetch the block capacity from the point cloud object so we
    // can use it later.
    // PTN_PARAMS is like:
    // 'blk_capacity=1000,work_tablespace=my_work_ts'
    int block_capacity = 0;
    boost::char_separator<char> sep_space(" ");
    boost::char_separator<char> sep_equal("=");

    std::string s_cap(ptn_params);
    tokenizer parameters(s_cap, sep_space);
    for (tokenizer::iterator t = parameters.begin(); t != parameters.end(); ++t)
    {
        tokenizer parameter((*t), sep_equal);

        for (tokenizer::iterator c = parameter.begin(); c != parameter.end(); ++c)
        {
            if (boost::iequals(c->c_str(), "blk_capacity"))
            {
                tokenizer::iterator d = ++c;
                block_capacity = atoi(d->c_str());
            }
        }
    }

    if (block_capacity < 1)
    {
        std::ostringstream oss;
        oss << "Invalid block capacity for point cloud object in Oracle: " << block_capacity;
        throw pdal_error(oss.str());
    }

    capacity = block_capacity;

    std::string pc_schema_xml(pc_schema);
    if (pc_schema)
        CPLFree(pc_schema);

    if (ptn_params)
        free(ptn_params);

    Schema schema = Schema::from_xml(pc_schema_xml);

    schema::index_by_index const& dims = schema.getDimensions().get<schema::index>();

    for (schema::index_by_index::const_iterator iter = dims.begin(); iter != dims.end(); ++iter)
    {
        // For dimensions that do not have namespaces, we'll set the namespace
        // to the namespace of the current stage

        if (iter->getNamespace().size() == 0)
        {
            log()->get(logDEBUG4) << "setting namespace for dimension " << iter->getName() << " to "  << getName() << std::endl;


            Dimension d(*iter);
            if (iter->getUUID().is_nil())
            {
                d.createUUID();
            }

            if (ns_override.size() > 0)
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


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