本文整理汇总了C++中DatabaseResult::addRowData方法的典型用法代码示例。如果您正苦于以下问题:C++ DatabaseResult::addRowData方法的具体用法?C++ DatabaseResult::addRowData怎么用?C++ DatabaseResult::addRowData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabaseResult
的用法示例。
在下文中一共展示了DatabaseResult::addRowData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: exec
DatabaseResult Database::exec(const String sqlStmt)
{
DatabaseColumn dbCol;
DatabaseRow dbRow;
DatabaseResult dbRes;
if(sqliteStatus != SQLITE_OK)
throw DatabaseNotOpenException() << DebugInfo(TRACE(), DebugInfo::Error);
sqliteStatus = sqlite3_prepare_v2(db, sqlStmt.data(),
-1, &dbStmt, NULL);
if(sqliteStatus != SQLITE_OK)
throw DatabaseStatementInvalidException() << DebugInfo(String(sqlStmt) << "\n\"" << sqlite3_errmsg(db) << "\"\n" << TRACE(), DebugInfo::Error);
int iCol = 0, colType = -1;
int colCount = sqlite3_column_count(dbStmt);
int stepRet = sqlite3_step(dbStmt);
bool isNoResult = true;
if(stepRet == SQLITE_ROW)
isNoResult = false;
while(stepRet == SQLITE_ROW)
{
for(iCol=0; iCol<colCount; ++iCol)
{
colType = sqlite3_column_type(dbStmt, iCol);
if(colType == SQLITE_INTEGER)
{
dbCol = DatabaseColumn(sqlite3_column_int(dbStmt, iCol));
dbCol.setInt64Data(sqlite3_column_int64(dbStmt, iCol));
}
else if(colType == SQLITE_FLOAT)
{
dbCol = DatabaseColumn(sqlite3_column_double(dbStmt, iCol));
}
else if(colType == SQLITE_TEXT)
{
dbCol = DatabaseColumn(String(sqlite3_column_text(dbStmt, iCol)));
}
else if(colType == SQLITE_BLOB)
{
dbCol = DatabaseColumn((unsigned char*)sqlite3_column_blob(dbStmt, iCol));
}
else if(colType == SQLITE_NULL)
{
dbCol = DatabaseColumn(true);
}
dbRow.addColumn(dbCol);
}
dbRes.addRowData(dbRow);
dbRow = DatabaseRow();
stepRet = sqlite3_step(dbStmt);
}
sqlite3_finalize(dbStmt);
if(stepRet != SQLITE_DONE)
throw DatabaseResultNotDoneException() << DebugInfo(sqlite3_errmsg(db) << TRACE(), DebugInfo::Error);
if(isNoResult == true)
dbRes.setRowChanged(sqlite3_changes(db));
return dbRes;
}