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


C++ IResultSet::FetchRow方法代码示例

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


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

示例1: ClientConnectCallback

void CookieManager::ClientConnectCallback(int serial, IQuery *data)
{
	int client;

	/* Check validity of client */
	if ((client = playerhelpers->GetClientFromSerial(serial)) == 0)
	{
		return;
	}
	statsPending[client] = false;
	
	IResultSet *results;
	/* Check validity of results */
	if (data == NULL || (results = data->GetResultSet()) == NULL)
	{
		return;
	}

	CookieData *pData;
	IResultRow *row;
	unsigned int timestamp;
	CookieAccess access;
	
	while (results->MoreRows() && ((row = results->FetchRow()) != NULL))
	{
		const char *name = "";
		row->GetString(0, &name, NULL);
		
		const char *value = "";
		row->GetString(1, &value, NULL);

		pData = new CookieData(value);
		pData->changed = false;

		pData->timestamp = (row->GetInt(4, (int *)&timestamp) == DBVal_Data) ? timestamp : 0;

		Cookie *parent = FindCookie(name);

		if (parent == NULL)
		{
			const char *desc = "";
			row->GetString(2, &desc, NULL);

			access = CookieAccess_Public;
			row->GetInt(3, (int *)&access);

			parent = CreateCookie(name, desc, access);
		}

		pData->parent = parent;
		parent->data[client] = pData;
		clientData[client].append(pData);
	}

	statsLoaded[client] = true;

	cookieDataLoadedForward->PushCell(client);
	cookieDataLoadedForward->Execute(NULL);
}
开发者ID:404UserNotFound,项目名称:sourcemod,代码行数:59,代码来源:cookie.cpp

示例2: SelectIdCallback

void CookieManager::SelectIdCallback(Cookie *pCookie, IQuery *data)
{
	IResultSet *results;
	
	if (data == NULL || (results = data->GetResultSet()) == NULL)
	{
		return;
	}

	IResultRow *row = results->FetchRow();

	if (row == NULL)
	{
		return;
	}

	row->GetInt(0, &pCookie->dbid);
}
开发者ID:404UserNotFound,项目名称:sourcemod,代码行数:18,代码来源:cookie.cpp

示例3: SQL_FetchRow

static cell_t SQL_FetchRow(IPluginContext *pContext, const cell_t *params)
{
	IQuery *query;
	HandleError err;

	if ((err = ReadQueryHndl(params[1], pContext, &query)) != HandleError_None)
	{
		return pContext->ThrowNativeError("Invalid query Handle %x (error: %d)", params[1], err);
	}

	IResultSet *rs = query->GetResultSet();
	if (!rs)
	{
		return pContext->ThrowNativeError("No current result set");
	}

	return (rs->FetchRow() != NULL) ? true : false;
}
开发者ID:pmrowla,项目名称:sourcemod-1.5,代码行数:18,代码来源:smn_database.cpp

示例4: ClientConnectCallback

void CookieManager::ClientConnectCallback(int serial, IQuery *data)
{
    int client;
    IResultSet *results;

    /* Check validity of client */
    if ((client = playerhelpers->GetClientFromSerial(serial)) == 0)
    {
        return;
    }

    /* Check validity of results */
    if (data == NULL || (results = data->GetResultSet()) == NULL)
    {
        return;
    }

    IResultRow *row;
    do
    {
        if ((row = results->FetchRow()) == NULL)
        {
            break;
        }

        const char *name;
        row->GetString(0, &name, NULL);

        const char *value;
        row->GetString(1, &value, NULL);

        CookieData *pData = new CookieData(value);
        pData->changed = false;

        Cookie *parent = FindCookie(name);

        if (parent == NULL)
        {
            const char *desc;
            row->GetString(2, &desc, NULL);

            CookieAccess access = CookieAccess_Public;
            row->GetInt(3, (int *)&access);

            parent = CreateCookie(name, desc, access);
            cookieTrie.insert(name, parent);
            cookieList.push_back(parent);
        }

        pData->parent = parent;
        parent->data[client] = pData;

        clientData[client].push_back(pData);

    } while (results->MoreRows());

    statsLoaded[client] = true;

    cookieDataLoadedForward->PushCell(client);
    cookieDataLoadedForward->Execute(NULL);
}
开发者ID:asceth,项目名称:synapi,代码行数:61,代码来源:cookie.cpp


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