本文整理汇总了C++中IResultSet::CurrentRow方法的典型用法代码示例。如果您正苦于以下问题:C++ IResultSet::CurrentRow方法的具体用法?C++ IResultSet::CurrentRow怎么用?C++ IResultSet::CurrentRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IResultSet
的用法示例。
在下文中一共展示了IResultSet::CurrentRow方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SQL_FetchSize
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: SQL_FetchString
static cell_t SQL_FetchString(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");
}
const char *str;
size_t length;
DBResult res = row->GetString(params[2], &str, &length);
if (res == DBVal_Error)
{
return pContext->ThrowNativeError("Error fetching data from field %d", params[2]);
} else if (res == DBVal_TypeMismatch) {
return pContext->ThrowNativeError("Could not fetch data in field %d as a string", params[2]);
}
pContext->StringToLocalUTF8(params[3], params[4], str, &length);
cell_t *addr;
pContext->LocalToPhysAddr(params[5], &addr);
*addr = (cell_t)res;
return (cell_t)length;
}
示例3: SQL_FetchInt
static cell_t SQL_FetchInt(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");
}
int iv;
DBResult res = row->GetInt(params[2], &iv);
if (res == DBVal_Error)
{
return pContext->ThrowNativeError("Error fetching data from field %d", params[2]);
} else if (res == DBVal_TypeMismatch) {
return pContext->ThrowNativeError("Could not fetch data in field %d as an integer", params[2]);
}
cell_t *addr;
pContext->LocalToPhysAddr(params[3], &addr);
*addr = (cell_t)res;
return iv;
}