mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-02-12 22:58:33 -06:00
Fall back to asking SQLite when parsing a table schema has failed
When parsing a table schema has failed, fall back to the PRAGMA provided by SQLite to give us some information about the layout of the table. This does not give us as much information but it is definitely better than no information at all. The main aim here is to fix the case where we are dealing with a virtual table which we failed to parse, and we now do not even know it is a virtual table. See issue #2187.
This commit is contained in:
@@ -1920,12 +1920,17 @@ void DBBrowserDB::updateSchema()
|
||||
else
|
||||
return false;
|
||||
|
||||
// If parsing wasn't successful set the object name manually, so that at least the name is going to be correct
|
||||
// If parsing wasn't successful set the object name and SQL manually, so that at least the name is going to be correct
|
||||
if(!object->fullyParsed())
|
||||
{
|
||||
object->setName(val_name);
|
||||
object->setOriginalSql(val_sql);
|
||||
}
|
||||
|
||||
// For virtual tables and views query the column list using the SQLite pragma because for both we can't yet rely on our grammar parser
|
||||
if((object->type() == sqlb::Object::Types::Table && std::dynamic_pointer_cast<sqlb::Table>(object)->isVirtual()) || object->type() == sqlb::Object::Types::View)
|
||||
// For virtual tables, views, and not fully parsed tables query the column list using the SQLite pragma because for both we can't yet rely on our grammar parser
|
||||
if(!object->fullyParsed() ||
|
||||
(object->type() == sqlb::Object::Types::Table && std::dynamic_pointer_cast<sqlb::Table>(object)->isVirtual()) ||
|
||||
object->type() == sqlb::Object::Types::View)
|
||||
{
|
||||
const auto columns = queryColumnInformation(schema_name, val_name);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user