本文整理汇总了C++中QueryResultMysql::NextRow方法的典型用法代码示例。如果您正苦于以下问题:C++ QueryResultMysql::NextRow方法的具体用法?C++ QueryResultMysql::NextRow怎么用?C++ QueryResultMysql::NextRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryResultMysql
的用法示例。
在下文中一共展示了QueryResultMysql::NextRow方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Query
QueryResult* DatabaseMysql::Query(const char *sql)
{
if (!mMysql)
return 0;
MYSQL_RES *result = 0;
uint64 rowCount = 0;
uint32 fieldCount = 0;
{
// guarded block for thread-safe mySQL request
//ZThread::Guard<ZThread::FastMutex> query_connection_guard(mMutex);
//I dont want do make this thread safe yet~I mean no need now. By YinQing
#ifdef MANGOS_DEBUG
uint32 _s = getMSTime();
#endif
if(mysql_query(mMysql, sql))
{
IME_SQLERROR("SQL: %s", sql);
IME_SQLERROR("query ERROR: %s", mysql_error(mMysql));
return NULL;
}
else
{
#ifdef MANGOS_DEBUG
IME_SQLERROR("[%u ms] SQL: %s", getMSTime() - _s, sql );
#endif
}
result = mysql_store_result(mMysql);
rowCount = mysql_affected_rows(mMysql);
fieldCount = mysql_field_count(mMysql);
// end guarded block
}
if (!result )
return NULL;
if (!rowCount)
{
mysql_free_result(result);
return NULL;
}
QueryResultMysql *queryResult = new QueryResultMysql(result, rowCount, fieldCount);
queryResult->NextRow();
return queryResult;
}
示例2: Query
QueryResult* DatabaseMysql::Query(const char *sql)
{
if (!mMysql)
return 0;
MYSQL_RES *result = 0;
uint64 rowCount = 0;
uint32 fieldCount = 0;
{
// guarded block for thread-safe mySQL request
ZThread::Guard<ZThread::FastMutex> query_connection_guard(mMutex);
#ifdef MANGOS_DEBUG
uint32 _s = getMSTime();
#endif
if(mysql_query(mMysql, sql))
{
sLog.outErrorDb( "SQL: %s", sql );
sLog.outErrorDb("query ERROR: %s", mysql_error(mMysql));
return NULL;
}
else
{
#ifdef MANGOS_DEBUG
sLog.outDebug("[%u ms] SQL: %s", getMSTimeDiff(_s,getMSTime()), sql );
#endif
}
result = mysql_store_result(mMysql);
rowCount = mysql_affected_rows(mMysql);
fieldCount = mysql_field_count(mMysql);
// end guarded block
}
if (!result )
return NULL;
if (!rowCount)
{
mysql_free_result(result);
return NULL;
}
QueryResultMysql *queryResult = new QueryResultMysql(result, rowCount, fieldCount);
queryResult->NextRow();
return queryResult;
}
示例3: Query
QueryResult* MySQLConnection::Query(const char *sql)
{
MYSQL_RES *result = NULL;
MYSQL_FIELD *fields = NULL;
uint64 rowCount = 0;
uint32 fieldCount = 0;
if(!_Query(sql,&result,&fields,&rowCount,&fieldCount))
return NULL;
QueryResultMysql *queryResult = new QueryResultMysql(result, fields, rowCount, fieldCount);
queryResult->NextRow();
return queryResult;
}
示例4: Query
QueryResult_AutoPtr DatabaseMysql::Query(const char *sql)
{
MYSQL_RES *result = NULL;
MYSQL_FIELD *fields = NULL;
uint64 rowCount = 0;
uint32 fieldCount = 0;
if (!_Query(sql, &result, &fields, &rowCount, &fieldCount))
return QueryResult_AutoPtr(NULL);
QueryResultMysql *queryResult = new QueryResultMysql(result, fields, rowCount, fieldCount);
queryResult->NextRow();
return QueryResult_AutoPtr(queryResult);
}
示例5: Query
QueryResult* DatabaseMysql::Query(const char *sql)
{
if (!mMysql)
return 0;
MYSQL_RES *result = 0;
uint64 rowCount = 0;
uint32 fieldCount = 0;
{
// guarded block for thread-safe mySQL request
ZThread::Guard<ZThread::FastMutex> query_connection_guard((ZThread::ThreadImpl::current()==tranThread?tranMutex:mMutex));
if(mysql_query(mMysql, sql))
{
sLog.outError( "SQL: %s", sql );
sLog.outError("query ERROR: %s", mysql_error(mMysql));
return NULL;
}
else
{
DEBUG_LOG( "SQL: %s", sql );
}
result = mysql_store_result(mMysql);
rowCount = mysql_affected_rows(mMysql);
fieldCount = mysql_field_count(mMysql);
// end guarded block
}
if (!result )
return NULL;
if (!rowCount)
{
mysql_free_result(result);
return NULL;
}
QueryResultMysql *queryResult = new QueryResultMysql(result, rowCount, fieldCount);
queryResult->NextRow();
return queryResult;
}
示例6: QueryNamed
QueryNamedResult* MySQLConnection::QueryNamed(const char *sql)
{
MYSQL_RES *result = NULL;
MYSQL_FIELD *fields = NULL;
uint64 rowCount = 0;
uint32 fieldCount = 0;
if(!_Query(sql,&result,&fields,&rowCount,&fieldCount))
return NULL;
QueryFieldNames names(fieldCount);
for (uint32 i = 0; i < fieldCount; i++)
names[i] = fields[i].name;
QueryResultMysql *queryResult = new QueryResultMysql(result, fields, rowCount, fieldCount);
queryResult->NextRow();
return new QueryNamedResult(queryResult,names);
}