Skip to content

Commit 5e56cda

Browse files
committed
Merge branch 'master' into master-small-improvements
2 parents c8e33a8 + 5c1df60 commit 5e56cda

File tree

36 files changed

+1596
-595
lines changed

36 files changed

+1596
-595
lines changed

ChangeLog/7.1.0-dev.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,5 @@
7676
[main] RecordSetHeader constructors changed IEnumerable<T> paremters to IReadOnlyList<T>
7777
[main] ColumnGroupCollection no longer takes IEnumerable<T> as parameter of constructor
7878
[main] ColumnCollection no longer takes IEnumerable<T> as parameter of constructor, only constructor with IReadOnlyList<T> is available now
79-
[sqlserver] Microsoft.Data.SqlClient is updated to verson 4.0.0
79+
[firebird] Add support for Firebird 4
80+
[sqlserver] Microsoft.Data.SqlClient is updated to verson 4.0.0

Extensions/Xtensive.Orm.Web.Tests/Xtensive.Orm.Web.Tests.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
<IsPackable>false</IsPackable>
55
<SignAssembly>true</SignAssembly>
66
<AssemblyOriginatorKeyFile>$(ExtensionsKeyFile)</AssemblyOriginatorKeyFile>
7-
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
8-
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
97
</PropertyGroup>
108
<Import Project="$(SolutionDir)MSBuild\DataObjects.Net.InternalBuild.targets" />
119
<ItemGroup>

Orm/Xtensive.Orm.Firebird/Sql.Drivers.Firebird/Connection.cs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ namespace Xtensive.Sql.Drivers.Firebird
1313
{
1414
internal class Connection : SqlConnection
1515
{
16-
private FbConnection underlyingConnection;
17-
private FbTransaction activeTransaction;
16+
protected FbConnection underlyingConnection;
17+
protected FbTransaction activeTransaction;
1818

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

3737
var transactionOptions = CreateTransactionOptions(isolationLevel);
3838
activeTransaction = underlyingConnection.BeginTransaction(transactionOptions);
39-
}
4039

41-
private static FbTransactionOptions CreateTransactionOptions(IsolationLevel isolationLevel)
42-
{
43-
var transactionOptions = new FbTransactionOptions {WaitTimeout = TimeSpan.FromSeconds(10)};
44-
switch (SqlHelper.ReduceIsolationLevel(isolationLevel)) {
45-
case IsolationLevel.ReadCommitted:
46-
transactionOptions.TransactionBehavior = FbTransactionBehavior.ReadCommitted
47-
| FbTransactionBehavior.NoRecVersion
48-
| FbTransactionBehavior.Write
49-
| FbTransactionBehavior.NoWait;
50-
break;
51-
case IsolationLevel.Serializable:
52-
transactionOptions.TransactionBehavior = FbTransactionBehavior.Concurrency
53-
| FbTransactionBehavior.Write
54-
| FbTransactionBehavior.Wait;
55-
break;
56-
}
40+
static FbTransactionOptions CreateTransactionOptions(IsolationLevel isolationLevel)
41+
{
42+
var transactionOptions = new FbTransactionOptions { WaitTimeout = TimeSpan.FromSeconds(10) };
43+
switch (SqlHelper.ReduceIsolationLevel(isolationLevel)) {
44+
case IsolationLevel.ReadCommitted:
45+
transactionOptions.TransactionBehavior = FbTransactionBehavior.ReadCommitted
46+
| FbTransactionBehavior.NoRecVersion
47+
| FbTransactionBehavior.Write
48+
| FbTransactionBehavior.NoWait;
49+
break;
50+
case IsolationLevel.Serializable:
51+
transactionOptions.TransactionBehavior = FbTransactionBehavior.Concurrency
52+
| FbTransactionBehavior.Write
53+
| FbTransactionBehavior.Wait;
54+
break;
55+
}
5756

58-
return transactionOptions;
57+
return transactionOptions;
58+
}
5959
}
6060

6161
/// <inheritdoc/>
@@ -85,4 +85,4 @@ public Connection(SqlDriver driver)
8585
underlyingConnection = new FbConnection();
8686
}
8787
}
88-
} ;
88+
}

Orm/Xtensive.Orm.Firebird/Sql.Drivers.Firebird/DriverFactory.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,12 @@ private static SqlDriver CreateDriverInstance(
6969
DefaultSchemaName = defaultSchema.Schema,
7070
};
7171

72-
if (coreServerInfo.ServerVersion < new Version(2, 5)) {
73-
throw new NotSupportedException(Strings.ExFirebirdBelow25IsNotSupported);
74-
}
75-
76-
if (coreServerInfo.ServerVersion.Major == 2 && coreServerInfo.ServerVersion.Minor == 5) {
77-
return new v2_5.Driver(coreServerInfo);
78-
}
79-
80-
return null;
72+
return coreServerInfo.ServerVersion switch {
73+
({ Major: 2 } and { Minor: < 5 }) or { Major: < 2 } => throw new NotSupportedException(Strings.ExFirebirdBelow25IsNotSupported),
74+
{ Major: 2 } and { Minor: 5 } => new v2_5.Driver(coreServerInfo),
75+
{ Major: 4 } => new v4_0.Driver(coreServerInfo),
76+
_ => throw new NotSupportedException()
77+
};
8178
}
8279

8380
/// <inheritdoc/>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright (C) 2021 Xtensive LLC.
2+
// This code is distributed under MIT license terms.
3+
// See the License.txt file in the project root for more information.
4+
5+
using System;
6+
using System.Collections.Generic;
7+
using System.Text;
8+
9+
namespace Xtensive.Sql.Drivers.Firebird.v4_0
10+
{
11+
internal class Compiler : v2_5.Compiler
12+
{
13+
protected internal Compiler(SqlDriver driver)
14+
: base(driver)
15+
{
16+
}
17+
}
18+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright (C) 2021 Xtensive LLC.
2+
// This code is distributed under MIT license terms.
3+
// See the License.txt file in the project root for more information.
4+
5+
using System;
6+
using Xtensive.Sql.Info;
7+
using Xtensive.Sql.Compiler;
8+
9+
namespace Xtensive.Sql.Drivers.Firebird.v4_0
10+
{
11+
internal class Driver : v2_5.Driver
12+
{
13+
protected override Sql.TypeMapper CreateTypeMapper() => new TypeMapper(this);
14+
15+
protected override SqlCompiler CreateCompiler() => new Compiler(this);
16+
17+
protected override SqlTranslator CreateTranslator() => new Translator(this);
18+
19+
protected override Model.Extractor CreateExtractor() => new Extractor(this);
20+
21+
protected override Info.ServerInfoProvider CreateServerInfoProvider() => new ServerInfoProvider(this);
22+
23+
// Constructors
24+
25+
public Driver(CoreServerInfo coreServerInfo)
26+
: base(coreServerInfo)
27+
{
28+
}
29+
}
30+
}

0 commit comments

Comments
 (0)