예제 #1
0
static cell_t SQL_FetchSize(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");
	}

	IResultRow *row = rs->CurrentRow();
	if (!row)
	{
		return pContext->ThrowNativeError("Current result set has no fetched rows");
	}

	if ((unsigned)params[2] >= rs->GetFieldCount())
	{
		return pContext->ThrowNativeError("Invalid field index %d", params[2]);
	}

	return row->GetDataSize(params[2]);
}
예제 #2
0
static cell_t SQL_GetFieldCount(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 0;
	}

	return rs->GetFieldCount();
}