Esempio n. 1
0
int Database::coutTables() throw()
{
	if(dbStatus != SQLITE_OK)
		throw DatabaseNotOpenException() << DebugInfo(TRACE(), DebugInfo::Error);

	DatabaseResult res;
	int tableCount = -1;

	try
	{
		res = exec("SELECT COUNT(name) FROM ("
			"SELECT name FROM sqlite_master "
			"WHERE type IN ('table','view') AND name NOT LIKE 'sqlite_%' "
			"UNION ALL "
			"SELECT name FROM sqlite_temp_master "
			"WHERE type IN ('table','view') )");
		tableCount = res.getRowData().at(0).getColumnData().at(0).getIntData();

	} catch (...)
	{
		throw;
	}

	return tableCount;
}