Skip to content

Commit

Permalink
Add missing files
Browse files Browse the repository at this point in the history
  • Loading branch information
Mytherin committed Dec 5, 2019
1 parent 9cff4ee commit 045ddac
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/parser/parsed_data/CMakeLists.txt
@@ -0,0 +1,6 @@
add_library_unity(duckdb_parsed_data
OBJECT
alter_table_info.cpp)
set(ALL_OBJECT_FILES
${ALL_OBJECT_FILES} $<TARGET_OBJECTS:duckdb_parsed_data>
PARENT_SCOPE)
51 changes: 51 additions & 0 deletions src/parser/parsed_data/alter_table_info.cpp
@@ -0,0 +1,51 @@
#include "duckdb/parser/parsed_data/alter_table_info.hpp"
#include "duckdb/common/serializer.hpp"

using namespace duckdb;
using namespace std;

void AlterInfo::Serialize(Serializer &serializer) {
serializer.Write<AlterType>(type);
}

unique_ptr<AlterInfo> AlterInfo::Deserialize(Deserializer &source) {
auto type = source.Read<AlterType>();
switch(type) {
case AlterType::ALTER_TABLE:
return AlterTableInfo::Deserialize(source);
default:
throw SerializationException("Unknown alter type for deserialization!");
}
}

void AlterTableInfo::Serialize(Serializer &serializer) {
AlterInfo::Serialize(serializer);
serializer.Write<AlterTableType>(alter_table_type);
serializer.WriteString(schema);
serializer.WriteString(table);
}

unique_ptr<AlterInfo> AlterTableInfo::Deserialize(Deserializer &source) {
auto type = source.Read<AlterTableType>();
auto schema = source.Read<string>();
auto table = source.Read<string>();
unique_ptr<AlterTableInfo> info;
switch(type) {
case AlterTableType::RENAME_COLUMN:
return RenameColumnInfo::Deserialize(source, schema, table);
default:
throw SerializationException("Unknown alter table type for deserialization!");
}
}

void RenameColumnInfo::Serialize(Serializer &serializer) {
AlterTableInfo::Serialize(serializer);
serializer.WriteString(name);
serializer.WriteString(new_name);
}

unique_ptr<AlterInfo> RenameColumnInfo::Deserialize(Deserializer &source, string schema, string table) {
auto name = source.Read<string>();
auto new_name = source.Read<string>();
return make_unique<RenameColumnInfo>(schema, table, name, new_name);
}

0 comments on commit 045ddac

Please sign in to comment.