Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ChangeLog/7.1.0-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,5 @@
[main] RecordSetHeader constructors changed IEnumerable<T> paremters to IReadOnlyList<T>
[main] ColumnGroupCollection no longer takes IEnumerable<T> as parameter of constructor
[main] ColumnCollection no longer takes IEnumerable<T> as parameter of constructor, only constructor with IReadOnlyList<T> is available now
[sqlserver] Microsoft.Data.SqlClient is updated to verson 4.0.0
[firebird] Add support for Firebird 4
[sqlserver] Microsoft.Data.SqlClient is updated to verson 4.0.0
42 changes: 21 additions & 21 deletions Orm/Xtensive.Orm.Firebird/Sql.Drivers.Firebird/Connection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ namespace Xtensive.Sql.Drivers.Firebird
{
internal class Connection : SqlConnection
{
private FbConnection underlyingConnection;
private FbTransaction activeTransaction;
protected FbConnection underlyingConnection;
protected FbTransaction activeTransaction;

/// <inheritdoc/>
public override DbConnection UnderlyingConnection => underlyingConnection;
Expand All @@ -36,26 +36,26 @@ public override void BeginTransaction(IsolationLevel isolationLevel)

var transactionOptions = CreateTransactionOptions(isolationLevel);
activeTransaction = underlyingConnection.BeginTransaction(transactionOptions);
}

private static FbTransactionOptions CreateTransactionOptions(IsolationLevel isolationLevel)
{
var transactionOptions = new FbTransactionOptions {WaitTimeout = TimeSpan.FromSeconds(10)};
switch (SqlHelper.ReduceIsolationLevel(isolationLevel)) {
case IsolationLevel.ReadCommitted:
transactionOptions.TransactionBehavior = FbTransactionBehavior.ReadCommitted
| FbTransactionBehavior.NoRecVersion
| FbTransactionBehavior.Write
| FbTransactionBehavior.NoWait;
break;
case IsolationLevel.Serializable:
transactionOptions.TransactionBehavior = FbTransactionBehavior.Concurrency
| FbTransactionBehavior.Write
| FbTransactionBehavior.Wait;
break;
}
static FbTransactionOptions CreateTransactionOptions(IsolationLevel isolationLevel)
{
var transactionOptions = new FbTransactionOptions { WaitTimeout = TimeSpan.FromSeconds(10) };
switch (SqlHelper.ReduceIsolationLevel(isolationLevel)) {
case IsolationLevel.ReadCommitted:
transactionOptions.TransactionBehavior = FbTransactionBehavior.ReadCommitted
| FbTransactionBehavior.NoRecVersion
| FbTransactionBehavior.Write
| FbTransactionBehavior.NoWait;
break;
case IsolationLevel.Serializable:
transactionOptions.TransactionBehavior = FbTransactionBehavior.Concurrency
| FbTransactionBehavior.Write
| FbTransactionBehavior.Wait;
break;
}

return transactionOptions;
return transactionOptions;
}
}

/// <inheritdoc/>
Expand Down Expand Up @@ -85,4 +85,4 @@ public Connection(SqlDriver driver)
underlyingConnection = new FbConnection();
}
}
} ;
}
15 changes: 6 additions & 9 deletions Orm/Xtensive.Orm.Firebird/Sql.Drivers.Firebird/DriverFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,12 @@ private static SqlDriver CreateDriverInstance(
DefaultSchemaName = defaultSchema.Schema,
};

if (coreServerInfo.ServerVersion < new Version(2, 5)) {
throw new NotSupportedException(Strings.ExFirebirdBelow25IsNotSupported);
}

if (coreServerInfo.ServerVersion.Major == 2 && coreServerInfo.ServerVersion.Minor == 5) {
return new v2_5.Driver(coreServerInfo);
}

return null;
return coreServerInfo.ServerVersion switch {
({ Major: 2 } and { Minor: < 5 }) or { Major: < 2 } => throw new NotSupportedException(Strings.ExFirebirdBelow25IsNotSupported),
{ Major: 2 } and { Minor: 5 } => new v2_5.Driver(coreServerInfo),
{ Major: 4 } => new v4_0.Driver(coreServerInfo),
_ => throw new NotSupportedException()
};
}

/// <inheritdoc/>
Expand Down
18 changes: 18 additions & 0 deletions Orm/Xtensive.Orm.Firebird/Sql.Drivers.Firebird/v4_0/Compiler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright (C) 2021 Xtensive LLC.
// This code is distributed under MIT license terms.
// See the License.txt file in the project root for more information.

using System;
using System.Collections.Generic;
using System.Text;

namespace Xtensive.Sql.Drivers.Firebird.v4_0
{
internal class Compiler : v2_5.Compiler
{
protected internal Compiler(SqlDriver driver)
: base(driver)
{
}
}
}
30 changes: 30 additions & 0 deletions Orm/Xtensive.Orm.Firebird/Sql.Drivers.Firebird/v4_0/Driver.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright (C) 2021 Xtensive LLC.
// This code is distributed under MIT license terms.
// See the License.txt file in the project root for more information.

using System;
using Xtensive.Sql.Info;
using Xtensive.Sql.Compiler;

namespace Xtensive.Sql.Drivers.Firebird.v4_0
{
internal class Driver : v2_5.Driver
{
protected override Sql.TypeMapper CreateTypeMapper() => new TypeMapper(this);

protected override SqlCompiler CreateCompiler() => new Compiler(this);

protected override SqlTranslator CreateTranslator() => new Translator(this);

protected override Model.Extractor CreateExtractor() => new Extractor(this);

protected override Info.ServerInfoProvider CreateServerInfoProvider() => new ServerInfoProvider(this);

// Constructors

public Driver(CoreServerInfo coreServerInfo)
: base(coreServerInfo)
{
}
}
}
Loading