ClickHouse/src/Storages/StorageSQLite.h

52 lines
1.2 KiB
C++
Raw Normal View History

2021-05-17 11:02:35 +00:00
#pragma once
2021-07-08 13:27:30 +00:00
#if !defined(ARCADIA_BUILD)
#include "config_core.h"
#endif
#if USE_SQLITE
2021-05-17 11:02:35 +00:00
#include <sqlite3.h>
#include <Storages/IStorage.h>
2021-07-07 20:39:41 +00:00
#include <common/shared_ptr_helper.h>
2021-05-17 11:02:35 +00:00
namespace DB
{
2021-07-07 20:39:41 +00:00
class StorageSQLite final : public shared_ptr_helper<StorageSQLite>, public IStorage, public WithContext
2021-05-17 11:02:35 +00:00
{
2021-07-07 20:39:41 +00:00
friend struct shared_ptr_helper<StorageSQLite>;
2021-05-17 11:02:35 +00:00
public:
StorageSQLite(
const StorageID & table_id_,
std::shared_ptr<sqlite3> db_ptr_,
const String & remote_table_name_,
const ColumnsDescription & columns_,
const ConstraintsDescription & constraints_,
2021-06-01 20:52:12 +00:00
ContextPtr context_);
2021-05-17 11:02:35 +00:00
std::string getName() const override { return "SQLite"; }
Pipe read(
const Names & column_names,
const StorageMetadataPtr & /*metadata_snapshot*/,
SelectQueryInfo & query_info,
ContextPtr context,
QueryProcessingStage::Enum processed_stage,
size_t max_block_size,
unsigned num_streams) override;
2021-05-24 18:59:10 +00:00
BlockOutputStreamPtr write(const ASTPtr & query, const StorageMetadataPtr & /*metadata_snapshot*/, ContextPtr context) override;
2021-05-17 11:02:35 +00:00
private:
String remote_table_name;
ContextPtr global_context;
std::shared_ptr<sqlite3> db_ptr;
};
}
2021-07-08 13:27:30 +00:00
#endif