| 102 | |
| 103 | |
| 104 | Pipe StorageSQLite::read( |
| 105 | const Names & column_names, |
| 106 | const StorageSnapshotPtr & storage_snapshot, |
| 107 | SelectQueryInfo & query_info, |
| 108 | ContextPtr context_, |
| 109 | QueryProcessingStage::Enum, |
| 110 | size_t max_block_size, |
| 111 | size_t /*num_streams*/) |
| 112 | { |
| 113 | if (!sqlite_db) |
| 114 | sqlite_db = openSQLiteDB(database_path, getContext(), /* throw_on_error */true); |
| 115 | |
| 116 | storage_snapshot->check(column_names); |
| 117 | |
| 118 | String query = transformQueryForExternalDatabase( |
| 119 | query_info, |
| 120 | column_names, |
| 121 | storage_snapshot->metadata->getColumns().getOrdinary(), |
| 122 | IdentifierQuotingStyle::DoubleQuotes, |
| 123 | LiteralEscapingStyle::Regular, |
| 124 | "", |
| 125 | remote_table_name, |
| 126 | context_); |
| 127 | LOG_TRACE(log, "Query: {}", query); |
| 128 | |
| 129 | Block sample_block; |
| 130 | for (const String & column_name : column_names) |
| 131 | { |
| 132 | auto column_data = storage_snapshot->metadata->getColumns().getPhysical(column_name); |
| 133 | sample_block.insert({column_data.type, column_data.name}); |
| 134 | } |
| 135 | |
| 136 | return Pipe(std::make_shared<SQLiteSource>(sqlite_db, query, sample_block, max_block_size)); |
| 137 | } |
| 138 | |
| 139 | |
| 140 | class SQLiteSink final : public SinkToStorage |
nothing calls this directly
no test coverage detected