/src/duckdb/src/parser/statement/export_statement.cpp
Line | Count | Source |
1 | | #include "duckdb/parser/statement/export_statement.hpp" |
2 | | #include "duckdb/parser/parsed_data/copy_info.hpp" |
3 | | #include "duckdb/common/sql_identifier.hpp" |
4 | | |
5 | | namespace duckdb { |
6 | | |
7 | | ExportStatement::ExportStatement(unique_ptr<CopyInfo> info) |
8 | 0 | : SQLStatement(StatementType::EXPORT_STATEMENT), info(std::move(info)) { |
9 | 0 | } |
10 | | |
11 | | ExportStatement::ExportStatement(const ExportStatement &other) |
12 | 0 | : SQLStatement(other), info(other.info->Copy()), database(other.database) { |
13 | 0 | } |
14 | | |
15 | 0 | unique_ptr<SQLStatement> ExportStatement::Copy() const { |
16 | 0 | return unique_ptr<ExportStatement>(new ExportStatement(*this)); |
17 | 0 | } |
18 | | |
19 | 0 | string ExportStatement::ToString() const { |
20 | 0 | string result = ""; |
21 | 0 | result += "EXPORT DATABASE"; |
22 | 0 | if (!database.empty()) { |
23 | 0 | result += " " + SQLIdentifier(database) + " TO"; |
24 | 0 | } |
25 | 0 | auto &path = info->file_path; |
26 | 0 | D_ASSERT(info->is_from == false); |
27 | 0 | result += " " + SQLString(path); |
28 | 0 | result += info->CopyOptionsToString(); |
29 | 0 | result += ";"; |
30 | 0 | return result; |
31 | 0 | } |
32 | | |
33 | | } // namespace duckdb |