ClickHouse/src/Storages/StorageSQLite.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

55 lines
1.2 KiB
C++
Raw Normal View History

2021-05-17 11:02:35 +00:00
#pragma once
#include "config.h"
2021-07-08 13:27:30 +00:00
#if USE_SQLITE
2021-05-17 11:02:35 +00:00
#include <Storages/IStorage.h>
2021-10-27 23:10:39 +00:00
#include <sqlite3.h>
2021-05-17 11:02:35 +00:00
namespace Poco
{
class Logger;
}
2021-05-17 11:02:35 +00:00
namespace DB
{
2021-07-10 08:05:23 +00:00
class StorageSQLite final : public IStorage, public WithContext
2021-05-17 11:02:35 +00:00
{
public:
2021-07-10 08:05:23 +00:00
using SQLitePtr = std::shared_ptr<sqlite3>;
2021-05-17 11:02:35 +00:00
StorageSQLite(
const StorageID & table_id_,
2021-07-10 08:05:23 +00:00
SQLitePtr sqlite_db_,
2021-07-26 07:05:28 +00:00
const String & database_path_,
2021-05-17 11:02:35 +00:00
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 StorageSnapshotPtr & storage_snapshot,
2021-05-17 11:02:35 +00:00
SelectQueryInfo & query_info,
ContextPtr context,
QueryProcessingStage::Enum processed_stage,
size_t max_block_size,
size_t num_streams) override;
2021-05-17 11:02:35 +00:00
2021-07-23 14:25:35 +00:00
SinkToStoragePtr write(const ASTPtr & query, const StorageMetadataPtr & /*metadata_snapshot*/, ContextPtr context) override;
2021-05-24 18:59:10 +00:00
2021-05-17 11:02:35 +00:00
private:
String remote_table_name;
String database_path;
2021-07-10 08:05:23 +00:00
SQLitePtr sqlite_db;
Poco::Logger * log;
2021-05-17 11:02:35 +00:00
};
}
2021-07-08 13:27:30 +00:00
#endif