Skip to content

Add oracle support#52

Merged
PhenX merged 15 commits intomainfrom
feature/oracle
Jun 2, 2025
Merged

Add oracle support#52
PhenX merged 15 commits intomainfrom
feature/oracle

Conversation

@PhenX
Copy link
Copy Markdown
Owner

@PhenX PhenX commented Jun 1, 2025

Fixes #46

It is really partial for now, only supports the basic features, and not returning, even though there is some code to support it, in the future

@PhenX PhenX requested a review from Copilot June 1, 2025 19:37
@PhenX PhenX marked this pull request as ready for review June 1, 2025 19:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request adds Oracle support to the bulk insert functionality. Key changes include:

  • Adding Oracle-specific DbContext and test container classes.
  • Introducing an Oracle bulk insert provider and its supporting classes (dialect builder, options, and DbContext options extension).
  • Updating benchmarks, project files, and documentation to incorporate Oracle support.

Reviewed Changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/PhenX.EntityFrameworkCore.BulkInsert.Tests/DbContext/TestDbContext.cs Removed an extraneous blank line and added Oracle DbContext.
tests/PhenX.EntityFrameworkCore.BulkInsert.Tests/DbContainer/TestDbContainerOracle.cs Added an Oracle test container with connection configuration adjustments.
tests/PhenX.EntityFrameworkCore.BulkInsert.Benchmark/Providers/LibComparatorOracle.cs Introduced a benchmark comparator for Oracle.
tests/PhenX.EntityFrameworkCore.BulkInsert.Benchmark/Program.cs Updated benchmark runner to include Oracle tests.
tests/PhenX.EntityFrameworkCore.BulkInsert.Benchmark/PhenX.EntityFrameworkCore.BulkInsert.Benchmark.csproj Included Oracle package reference and project reference.
tests/PhenX.EntityFrameworkCore.BulkInsert.Benchmark/LibComparator.cs Added Oracle branch in raw insert logic.
tests/PhenX.EntityFrameworkCore.BulkInsert.Benchmark/LibComparator.RawInsert.cs Added raw Oracle bulk insert implementation using OracleBulkCopy.
tests/PhenX.EntityFrameworkCore.BulkInsert/BulkInsertProviderBase.cs Updated logic to conditionally skip adding an ID column for providers that do not require it.
src/PhenX.EntityFrameworkCore.BulkInsert/Extensions/InternalExtensions.cs Adapted provider checking to support multiple provider types.
src/PhenX.EntityFrameworkCore.BulkInsert/Enums/ProviderType.cs Extended enum to include Oracle.
src/PhenX.EntityFrameworkCore.BulkInsert.Sqlite/SqliteBulkInsertProvider.cs Renamed temp table format to be more generic.
src/PhenX.EntityFrameworkCore.BulkInsert.Oracle/* New Oracle provider classes, options, and dialect implementations.
README.md Updated documentation to mention Oracle support and added relevant benchmarks.
PhenX.EntityFrameworkCore.BulkInsert.sln Included the new Oracle project in the solution.
Comments suppressed due to low confidence (1)

src/PhenX.EntityFrameworkCore.BulkInsert.Oracle/OracleBulkInsertProvider.cs:23

  • [nitpick] Using '#' as a prefix in the generated temporary table name could conflict with Oracle naming conventions. Consider revising the naming to ensure compatibility with Oracle identifier rules.
protected override string GetTempTableName(string tableName) => "$#temp_bulk_insert_{Guid.NewGuid().ToString("N")[..8]}";

Comment thread src/PhenX.EntityFrameworkCore.BulkInsert.Oracle/OracleBulkInsertProvider.cs Outdated
PhenX and others added 2 commits June 1, 2025 21:39
…rtProvider.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@PhenX PhenX requested a review from SebastianStehle June 1, 2025 19:47
Copy link
Copy Markdown
Collaborator

@SebastianStehle SebastianStehle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Only super small thing


foreach (var column in columns)
{
q.Append($"{column.QuotedColumName} {column.StoreDefinition}");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I have made an extension method for this case AppenJoined(",\n", column, (c, sb) => sb.Append("...")); or something like that

protected override string AddTableCopyBulkInsertId => ""; // No need to add an ID column in Oracle

/// <inheritdoc />
protected override string GetTempTableName(string tableName) => $"#temp_bulk_insert_{Guid.NewGuid().ToString("N")[..8]}";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you not take the whole guid?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oracle under a certain version (12 I think) does not allow indentifiers longer than 30, yay

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably comment that, because I would have forgotten that next week.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh I will remember 😅 but yeah I'll add a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ahve said this very often to myself :D

{
/// <inheritdoc cref="OracleBulkCopyOptions"/>
public OracleBulkCopyOptions CopyOptions { get; set; } = OracleBulkCopyOptions.Default;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty line


q.AppendLine(";");

var result = q.ToString();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you not got rid of this syntax in another PR

aka

return q.ToString();

}
}

// No conflict handling
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps two methods so that the comments are not necessary?

PhenX-Pro added 3 commits June 2, 2025 09:27
# Conflicts:
#	tests/PhenX.EntityFrameworkCore.BulkInsert.Benchmark/GetValueComparator.cs
@PhenX PhenX merged commit b79b2b5 into main Jun 2, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Oracle support

4 participants