Synchronous. A callback is called for each line found before continuing the code:
static int _getName(void* pNames, int columns, char** data, char** columnNames)
{
if (columns < 2)
{
assert(false && "Function called on wrong table!");
return 1;
}
std::vector<std::string>* vNames = static_cast< std::vector<std::string>* >(pNames);
vNames->push_back(data[1]);
return 0;
}
{
std::vector<std::string> names;
char* error = 0;
if (sqlite3_exec(pDB, "SELECT * FROM TableNames", _getName, static_cast<void*>(&names), &error) != SQLITE_OK)
{
}
assert(names.size() && "No entries were found in the table");
}
_getName , TableNames. , , . TableNames, 10 , names.size() == 10. _getName ,