MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / fetchTable

Method fetchTable

src/Databases/SQLite/DatabaseSQLite.cpp:146–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144
145
146StoragePtr DatabaseSQLite::fetchTable(const String & table_name, ContextPtr local_context, bool table_checked) const
147{
148 if (!sqlite_db)
149 sqlite_db = openSQLiteDB(database_path, getContext(), /* throw_on_error */true);
150
151 if (!table_checked && !checkSQLiteTable(table_name))
152 return StoragePtr{};
153
154 auto columns = fetchSQLiteTableStructure(sqlite_db.get(), table_name);
155
156 if (!columns)
157 return StoragePtr{};
158
159 auto storage = std::make_shared<StorageSQLite>(
160 StorageID(database_name, table_name),
161 sqlite_db,
162 database_path,
163 table_name,
164 ColumnsDescription{*columns},
165 ConstraintsDescription{},
166 /* comment = */ "",
167 local_context);
168
169 return storage;
170}
171
172
173ASTPtr DatabaseSQLite::getCreateDatabaseQueryImpl() const

Callers

nothing calls this directly

Calls 5

openSQLiteDBFunction · 0.85
getContextFunction · 0.50
StorageIDClass · 0.50
getMethod · 0.45

Tested by

no test coverage detected