blob: f4518cf37072de0b6668783239ae2f7ce05dcf5b (
plain) (
blame)
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
|
#pragma once
#include "clickhouse_config.h"
#if USE_SQLITE
#include <Core/ExternalResultDescription.h>
#include <Processors/ISource.h>
#error #include <sqlite3.h>
namespace DB
{
class SQLiteSource : public ISource
{
using SQLitePtr = std::shared_ptr<sqlite3>;
public:
SQLiteSource(SQLitePtr sqlite_db_, const String & query_str_, const Block & sample_block, UInt64 max_block_size_);
String getName() const override { return "SQLite"; }
private:
using ValueType = ExternalResultDescription::ValueType;
struct StatementDeleter
{
void operator()(sqlite3_stmt * stmt) { sqlite3_finalize(stmt); }
};
Chunk generate() override;
void insertValue(IColumn & column, ExternalResultDescription::ValueType type, int idx);
String query_str;
UInt64 max_block_size;
ExternalResultDescription description;
SQLitePtr sqlite_db;
std::unique_ptr<sqlite3_stmt, StatementDeleter> compiled_statement;
};
}
#endif
|