read method

Reads a Table schema from the stmt inducing a table (either a CreateTableStatement or a CreateVirtualTableStatement).

This method might throw an exception if the table could not be read.

Implementation

Table read(TableInducingStatement stmt) {
  if (stmt is CreateTableStatement) {
    return _readCreateTable(stmt);
  } else if (stmt is CreateVirtualTableStatement) {
    final module = stmt.scope.rootScope.knownModules[stmt.moduleName];

    if (module == null) {
      throw CantReadSchemaException('Unknown module "${stmt.moduleName}", '
          'did you register it?');
    }

    return module.parseTable(stmt);
  }

  throw AssertionError('Unknown table statement');
}