1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#pragma once
#include "clickhouse_config.h"
#if USE_SQLITE
#include <Storages/IStorage.h>
#error #include <sqlite3.h>
namespace Poco
{
class Logger;
}
namespace DB
{
class StorageSQLite final : public IStorage, public WithContext
{
public:
using SQLitePtr = std::shared_ptr<sqlite3>;
StorageSQLite(
const StorageID & table_id_,
SQLitePtr sqlite_db_,
const String & database_path_,
const String & remote_table_name_,
const ColumnsDescription & columns_,
const ConstraintsDescription & constraints_,
ContextPtr context_);
std::string getName() const override { return "SQLite"; }
Pipe read(
const Names & column_names,
const StorageSnapshotPtr & storage_snapshot,
SelectQueryInfo & query_info,
ContextPtr context,
QueryProcessingStage::Enum processed_stage,
size_t max_block_size,
size_t num_streams) override;
SinkToStoragePtr write(const ASTPtr & query, const StorageMetadataPtr & /*metadata_snapshot*/, ContextPtr context, bool async_insert) override;
static ColumnsDescription getTableStructureFromData(
const SQLitePtr & sqlite_db_,
const String & table);
private:
String remote_table_name;
String database_path;
SQLitePtr sqlite_db;
Poco::Logger * log;
};
}
#endif
|