Skip to content

Commit

Permalink
Absorb more patches
Browse files Browse the repository at this point in the history
  • Loading branch information
carlopi committed May 17, 2024
1 parent d355dd0 commit a8e4f54
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/include/storage/sqlite_schema_entry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class SQLiteSchemaEntry : public SchemaCatalogEntry {
public:
optional_ptr<CatalogEntry> CreateTable(CatalogTransaction transaction, BoundCreateTableInfo &info) override;
optional_ptr<CatalogEntry> CreateFunction(CatalogTransaction transaction, CreateFunctionInfo &info) override;
optional_ptr<CatalogEntry> CreateIndex(ClientContext &context, CreateIndexInfo &info,
optional_ptr<CatalogEntry> CreateIndex(CatalogTransaction transaction, CreateIndexInfo &info,
TableCatalogEntry &table) override;
optional_ptr<CatalogEntry> CreateView(CatalogTransaction transaction, CreateViewInfo &info) override;
optional_ptr<CatalogEntry> CreateSequence(CatalogTransaction transaction, CreateSequenceInfo &info) override;
Expand All @@ -32,7 +32,7 @@ class SQLiteSchemaEntry : public SchemaCatalogEntry {
CreatePragmaFunctionInfo &info) override;
optional_ptr<CatalogEntry> CreateCollation(CatalogTransaction transaction, CreateCollationInfo &info) override;
optional_ptr<CatalogEntry> CreateType(CatalogTransaction transaction, CreateTypeInfo &info) override;
void Alter(ClientContext &context, AlterInfo &info) override;
void Alter(CatalogTransaction transaction, AlterInfo &info) override;
void Scan(ClientContext &context, CatalogType type, const std::function<void(CatalogEntry &)> &callback) override;
void Scan(CatalogType type, const std::function<void(CatalogEntry &)> &callback) override;
void DropEntry(ClientContext &context, DropInfo &info) override;
Expand Down
3 changes: 2 additions & 1 deletion src/storage/sqlite_index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ SourceResultType SQLiteCreateIndex::GetData(ExecutionContext &context, DataChunk
OperatorSourceInput &input) const {
auto &catalog = table.catalog;
auto &schema = catalog.GetSchema(context.client, info->schema);
schema.CreateIndex(context.client, *info, table);
auto transaction = schema.GetCatalogTransaction(context.client);
schema.CreateIndex(transaction, *info, table);

return SourceResultType::FINISHED;
}
Expand Down
8 changes: 4 additions & 4 deletions src/storage/sqlite_schema_entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ string GetCreateIndexSQL(CreateIndexInfo &info, TableCatalogEntry &tbl) {
return sql;
}

optional_ptr<CatalogEntry> SQLiteSchemaEntry::CreateIndex(ClientContext &context, CreateIndexInfo &info,
optional_ptr<CatalogEntry> SQLiteSchemaEntry::CreateIndex(CatalogTransaction transaction, CreateIndexInfo &info,
TableCatalogEntry &table) {
auto &sqlite_transaction = SQLiteTransaction::Get(context, table.catalog);
auto &sqlite_transaction = SQLiteTransaction::Get(transaction.GetContext(), table.catalog);
sqlite_transaction.GetDB().Execute(GetCreateIndexSQL(info, table));
return nullptr;
}
Expand Down Expand Up @@ -219,12 +219,12 @@ void SQLiteSchemaEntry::AlterTable(SQLiteTransaction &sqlite_transaction, Remove
sqlite_transaction.GetDB().Execute(sql);
}

void SQLiteSchemaEntry::Alter(ClientContext &context, AlterInfo &info) {
void SQLiteSchemaEntry::Alter(CatalogTransaction catalog_transaction, AlterInfo &info) {
if (info.type != AlterType::ALTER_TABLE) {
throw BinderException("Only altering tables is supported for now");
}
auto &alter = info.Cast<AlterTableInfo>();
auto &transaction = SQLiteTransaction::Get(context, catalog);
auto &transaction = SQLiteTransaction::Get(catalog_transaction.GetContext(), catalog);
switch (alter.alter_table_type) {
case AlterTableType::RENAME_TABLE:
AlterTable(transaction, alter.Cast<RenameTableInfo>());
Expand Down

0 comments on commit a8e4f54

Please sign in to comment.