From 4e52614b8bfdc4601c50dee747ebd1cd635b4872 Mon Sep 17 00:00:00 2001 From: Alex Zaytsev Date: Wed, 31 Aug 2022 02:35:30 +1200 Subject: [PATCH 01/10] Test using Firebird 4.0 --- .github/workflows/NetCoreTests.yml | 2 +- appveyor.yml | 2 +- lib/teamcity/firebird/firebird_installation.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/NetCoreTests.yml b/.github/workflows/NetCoreTests.yml index 5bd6bdbc64b..f46ab5d8a60 100644 --- a/.github/workflows/NetCoreTests.yml +++ b/.github/workflows/NetCoreTests.yml @@ -45,7 +45,7 @@ jobs: - name: Set up Firebird if: matrix.DB == 'Firebird' run: | - docker run --name firebird -e EnableWireCrypt=true -e FIREBIRD_USER=nhibernate -e FIREBIRD_PASSWORD=nhibernate -e ISC_PASSWORD=nhibernate -e FIREBIRD_DATABASE=nhibernate -p 3050:3050 -d jacobalberty/firebird:v3.0 + docker run --name firebird -e EnableWireCrypt=true -e FIREBIRD_USER=nhibernate -e FIREBIRD_PASSWORD=nhibernate -e ISC_PASSWORD=nhibernate -e FIREBIRD_DATABASE=nhibernate -p 3050:3050 -d jacobalberty/firebird:v4.0 - name: Set up Oracle if: matrix.DB == 'Oracle' diff --git a/appveyor.yml b/appveyor.yml index eb6fc4b2fc9..fe166181a00 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -22,7 +22,7 @@ before_test: # Install Firebird New-Item -ItemType Directory -Force $FireBirdPath > $null Push-Location $FireBirdPath - Invoke-WebRequest 'https://github.com/FirebirdSQL/firebird/releases/download/R3_0_5/Firebird-3.0.5.33220-0_x64.zip' -OutFile firebird.zip + Invoke-WebRequest 'https://github.com/FirebirdSQL/firebird/releases/download/v4.0.2/Firebird-4.0.2.2816-0-x64.zip' -OutFile firebird.zip Unblock-File firebird.zip 7z x firebird.zip New-Item -ItemType Directory -Force Data diff --git a/lib/teamcity/firebird/firebird_installation.txt b/lib/teamcity/firebird/firebird_installation.txt index 2466b196bf8..d843ff52ab7 100644 --- a/lib/teamcity/firebird/firebird_installation.txt +++ b/lib/teamcity/firebird/firebird_installation.txt @@ -1,7 +1,7 @@ Installation steps for Firebird for NH TeamCity: -1. Download Firebird (Firebird-3.0.2.32703_0_x64): https://www.firebirdsql.org/en/server-packages/; +1. Download Firebird (Firebird-4.0.2.2816-0-x64): https://www.firebirdsql.org/en/server-packages/; 2. Run the installer AS ADMINISTRATOR... Use the default firebird password when prompted: masterkey. 3. Leave other settings with their defaults. 4. The setup should install Firebird on the machine; From 69c053f99cf18a128f8d2e3641e47dc8cd4f96a2 Mon Sep 17 00:00:00 2001 From: Alex Zaytsev Date: Wed, 28 Sep 2022 11:42:08 +1300 Subject: [PATCH 02/10] Add separate Firebird4Dialect --- .github/workflows/NetCoreTests.yml | 7 +++++++ appveyor.yml | 22 ++++++++++++++++++++++ psake.ps1 | 5 +++++ src/NHibernate/Dialect/FirebirdDialect.cs | 4 ++++ 4 files changed, 38 insertions(+) diff --git a/.github/workflows/NetCoreTests.yml b/.github/workflows/NetCoreTests.yml index f46ab5d8a60..226ddbbdb10 100644 --- a/.github/workflows/NetCoreTests.yml +++ b/.github/workflows/NetCoreTests.yml @@ -14,6 +14,8 @@ jobs: CONNECTION_STRING: "Host=localhost;Username=nhibernate;Password=nhibernate;Database=nhibernate;Enlist=true;" - DB: Firebird CONNECTION_STRING: "DataSource=localhost;Database=nhibernate;User=SYSDBA;Password=nhibernate;charset=utf8;" + - DB: Firebird4 + CONNECTION_STRING: "DataSource=localhost;Database=nhibernate;User=SYSDBA;Password=nhibernate;charset=utf8;" - DB: MySQL CONNECTION_STRING: "Server=localhost;Uid=root;Password=nhibernate;Database=nhibernate;Old Guids=True;SslMode=none;" - DB: Oracle @@ -44,6 +46,11 @@ jobs: - name: Set up Firebird if: matrix.DB == 'Firebird' + run: | + docker run --name firebird -e EnableWireCrypt=true -e FIREBIRD_USER=nhibernate -e FIREBIRD_PASSWORD=nhibernate -e ISC_PASSWORD=nhibernate -e FIREBIRD_DATABASE=nhibernate -p 3050:3050 -d jacobalberty/firebird:v3.0 + + - name: Set up Firebird4 + if: matrix.DB == 'Firebird4' run: | docker run --name firebird -e EnableWireCrypt=true -e FIREBIRD_USER=nhibernate -e FIREBIRD_PASSWORD=nhibernate -e ISC_PASSWORD=nhibernate -e FIREBIRD_DATABASE=nhibernate -p 3050:3050 -d jacobalberty/firebird:v4.0 diff --git a/appveyor.yml b/appveyor.yml index fe166181a00..a73e841f7e6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,6 +7,7 @@ environment: - DB: PostgreSQL CONNECTION_STRING: Host=localhost;Port=5432;Username=postgres;Password=Password12!;Database=nhibernate;Enlist=true; - DB: Firebird + - DB: Firebird4 - DB: MySQL CONNECTION_STRING: Server=127.0.0.1;Uid=root;Pwd=Password12!;Database=nhibernate;Old Guids=True;SslMode=none;CharSet=utf8; - DB: SQLite @@ -18,6 +19,27 @@ before_test: - ps: |- switch ($env:DB) { 'Firebird' { + $FireBirdPath = 'C:\firebird' + # Install Firebird + New-Item -ItemType Directory -Force $FireBirdPath > $null + Push-Location $FireBirdPath + Invoke-WebRequest 'https://github.com/FirebirdSQL/firebird/releases/download/R3_0_5/Firebird-3.0.5.33220-0_x64.zip' -OutFile firebird.zip + Unblock-File firebird.zip + 7z x firebird.zip + New-Item -ItemType Directory -Force Data + # Declare nhibernate db + Add-Content -Path '.\databases.conf' -Value "`r`nnhibernate = $FireBirdPath\Data\nhibernate.fdb" + # Minimal db settings + Add-Content -Path '.\firebird.conf' -Value "`r`nAuthServer = Srp`r`nAuthClient = Srp`r`nUserManager = Srp`r`nWireCrypt = Enabled" + # Create SYSDBA account + New-Item SYSDBA.sql -Type File + Add-Content -Path '.\SYSDBA.sql' -Value "CREATE USER SYSDBA PASSWORD 'masterkey';`r`nCOMMIT;`r`nQUIT;" + .\isql -user sysdba employee -input SYSDBA.sql + # Start Firebird + .\firebird.exe -a + Pop-Location + } + 'Firebird4' { $FireBirdPath = 'C:\firebird' # Install Firebird New-Item -ItemType Directory -Force $FireBirdPath > $null diff --git a/psake.ps1 b/psake.ps1 index 86111d4fc95..34fa3e2ea37 100644 --- a/psake.ps1 +++ b/psake.ps1 @@ -14,6 +14,11 @@ Task Set-Configuration { 'connection.driver_class' = 'NHibernate.Driver.FirebirdClientDriver'; 'dialect' = 'NHibernate.Dialect.FirebirdDialect' }; + 'Firebird4' = @{ + 'connection.connection_string' = 'DataSource=localhost;Database=nhibernate;User ID=SYSDBA;Password=masterkey;MaxPoolSize=200;'; + 'connection.driver_class' = 'NHibernate.Driver.FirebirdClientDriver'; + 'dialect' = 'NHibernate.Dialect.Firebird4Dialect' + }; 'MySQL' = @{ 'connection.connection_string' = 'Server=127.0.0.1;Uid=root;Pwd=Password12!;Database=nhibernate;Old Guids=True;SslMode=none;'; 'connection.driver_class' = 'NHibernate.Driver.MySqlDataDriver'; diff --git a/src/NHibernate/Dialect/FirebirdDialect.cs b/src/NHibernate/Dialect/FirebirdDialect.cs index 66304d6de5c..13e5927b083 100644 --- a/src/NHibernate/Dialect/FirebirdDialect.cs +++ b/src/NHibernate/Dialect/FirebirdDialect.cs @@ -611,4 +611,8 @@ private void RegisterTrigonometricFunctions() #endregion } + + public class Firebird4Dialect: Dialect + { + } } From b34511d6ec664b7fcd9825de9004a791715ba0fb Mon Sep 17 00:00:00 2001 From: Alex Zaytsev Date: Wed, 28 Sep 2022 11:46:22 +1300 Subject: [PATCH 03/10] Fix dialect definition and add test dialect --- src/NHibernate.Test/TestDialects/Firebird4TestDialect.cs | 9 +++++++++ src/NHibernate/Dialect/Firebird4Dialect.cs | 6 ++++++ src/NHibernate/Dialect/FirebirdDialect.cs | 4 ---- 3 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 src/NHibernate.Test/TestDialects/Firebird4TestDialect.cs create mode 100644 src/NHibernate/Dialect/Firebird4Dialect.cs diff --git a/src/NHibernate.Test/TestDialects/Firebird4TestDialect.cs b/src/NHibernate.Test/TestDialects/Firebird4TestDialect.cs new file mode 100644 index 00000000000..b2c9d5e706e --- /dev/null +++ b/src/NHibernate.Test/TestDialects/Firebird4TestDialect.cs @@ -0,0 +1,9 @@ +namespace NHibernate.Test.TestDialects +{ + public class Firebird4TestDialect : FirebirdTestDialect + { + public Firebird4TestDialect(Dialect.Dialect dialect) : base(dialect) + { + } + } +} diff --git a/src/NHibernate/Dialect/Firebird4Dialect.cs b/src/NHibernate/Dialect/Firebird4Dialect.cs new file mode 100644 index 00000000000..b1f8f8ab846 --- /dev/null +++ b/src/NHibernate/Dialect/Firebird4Dialect.cs @@ -0,0 +1,6 @@ +namespace NHibernate.Dialect +{ + public class Firebird4Dialect: FirebirdDialect + { + } +} diff --git a/src/NHibernate/Dialect/FirebirdDialect.cs b/src/NHibernate/Dialect/FirebirdDialect.cs index 13e5927b083..66304d6de5c 100644 --- a/src/NHibernate/Dialect/FirebirdDialect.cs +++ b/src/NHibernate/Dialect/FirebirdDialect.cs @@ -611,8 +611,4 @@ private void RegisterTrigonometricFunctions() #endregion } - - public class Firebird4Dialect: Dialect - { - } } From a8312a50b692a34120ded07f51cd966f4cdd31f1 Mon Sep 17 00:00:00 2001 From: Alex Zaytsev Date: Wed, 28 Sep 2022 11:57:44 +1300 Subject: [PATCH 04/10] Override current_timestamp in Firebird4 --- src/NHibernate/Dialect/Firebird4Dialect.cs | 7 +++++++ src/NHibernate/Dialect/FirebirdDialect.cs | 15 +-------------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/NHibernate/Dialect/Firebird4Dialect.cs b/src/NHibernate/Dialect/Firebird4Dialect.cs index b1f8f8ab846..6bbf55f31a3 100644 --- a/src/NHibernate/Dialect/Firebird4Dialect.cs +++ b/src/NHibernate/Dialect/Firebird4Dialect.cs @@ -1,6 +1,13 @@ +using NHibernate.Dialect.Function; + namespace NHibernate.Dialect { public class Firebird4Dialect: FirebirdDialect { + protected override void RegisterFunctions() + { + base.RegisterFunctions(); + RegisterFunction("current_timestamp", new NoArgSQLFunction("localtimestamp", NHibernateUtil.LocalDateTime, false)); + } } } diff --git a/src/NHibernate/Dialect/FirebirdDialect.cs b/src/NHibernate/Dialect/FirebirdDialect.cs index 66304d6de5c..7109480335c 100644 --- a/src/NHibernate/Dialect/FirebirdDialect.cs +++ b/src/NHibernate/Dialect/FirebirdDialect.cs @@ -152,19 +152,6 @@ public override SqlString Render(IList args, ISessionFactoryImplementor factory) } } - [Serializable] - private class CurrentTimeStamp : NoArgSQLFunction - { - public CurrentTimeStamp() : base("current_timestamp", NHibernateUtil.LocalDateTime, true) - { - } - - public override SqlString Render(IList args, ISessionFactoryImplementor factory) - { - return new SqlString(Name); - } - } - public override IDataBaseSchema GetDataBaseSchema(DbConnection connection) { return new FirebirdDataBaseSchema(connection); @@ -474,7 +461,7 @@ protected virtual void RegisterFunctions() private void OverrideStandardHQLFunctions() { - RegisterFunction("current_timestamp", new CurrentTimeStamp()); + RegisterFunction("current_timestamp", new NoArgSQLFunction("current_timestamp", NHibernateUtil.LocalDateTime, false)); RegisterFunction("current_date", new NoArgSQLFunction("current_date", NHibernateUtil.LocalDate, false)); RegisterFunction("length", new StandardSafeSQLFunction("char_length", NHibernateUtil.Int64, 1)); RegisterFunction("nullif", new StandardSafeSQLFunction("nullif", 2)); From 9b6dfa781be456a2f10450b9f90be943242d2d83 Mon Sep 17 00:00:00 2001 From: Alex Zaytsev Date: Wed, 28 Sep 2022 13:54:44 +1300 Subject: [PATCH 05/10] Add handling BigInteger --- src/NHibernate/Type/ByteType.cs | 14 ++++++++++++-- src/NHibernate/Type/Int16Type.cs | 13 +++++++++++-- src/NHibernate/Type/Int32Type.cs | 14 ++++++++++++-- src/NHibernate/Type/Int64Type.cs | 13 +++++++++++-- src/NHibernate/Type/SByteType.cs | 13 +++++++++++-- src/NHibernate/Type/UInt16Type.cs | 13 +++++++++++-- src/NHibernate/Type/UInt32Type.cs | 13 +++++++++++-- src/NHibernate/Type/UInt64Type.cs | 13 +++++++++++-- 8 files changed, 90 insertions(+), 16 deletions(-) diff --git a/src/NHibernate/Type/ByteType.cs b/src/NHibernate/Type/ByteType.cs index 7c90bd6738a..ed8196bac67 100644 --- a/src/NHibernate/Type/ByteType.cs +++ b/src/NHibernate/Type/ByteType.cs @@ -2,6 +2,7 @@ using System.Collections; using System.Data; using System.Data.Common; +using System.Numerics; using NHibernate.Engine; using NHibernate.SqlTypes; @@ -23,12 +24,21 @@ public ByteType() public override object Get(DbDataReader rs, int index, ISessionImplementor session) { - return Convert.ToByte(rs[index]); + return rs[index] switch + { + + BigInteger bi => (byte) bi, + var c => Convert.ToByte(c) + }; } public override object Get(DbDataReader rs, string name, ISessionImplementor session) { - return Convert.ToByte(rs[name]); + return rs[name] switch + { + BigInteger bi => (byte) bi, + var c => Convert.ToByte(c) + }; } public override System.Type ReturnedClass diff --git a/src/NHibernate/Type/Int16Type.cs b/src/NHibernate/Type/Int16Type.cs index f517be93424..f55c1d1b2f5 100644 --- a/src/NHibernate/Type/Int16Type.cs +++ b/src/NHibernate/Type/Int16Type.cs @@ -5,6 +5,7 @@ using NHibernate.SqlTypes; using System.Collections.Generic; using System.Data; +using System.Numerics; namespace NHibernate.Type { @@ -31,7 +32,11 @@ public override object Get(DbDataReader rs, int index, ISessionImplementor sessi { try { - return Convert.ToInt16(rs[index]); + return rs[index] switch + { + BigInteger bi => (short) bi, + var c => Convert.ToInt16(c) + }; } catch (Exception ex) { @@ -43,7 +48,11 @@ public override object Get(DbDataReader rs, string name, ISessionImplementor ses { try { - return Convert.ToInt16(rs[name]); + return rs[name]switch + { + BigInteger bi => (short) bi, + var c => Convert.ToInt16(c) + }; } catch (Exception ex) { diff --git a/src/NHibernate/Type/Int32Type.cs b/src/NHibernate/Type/Int32Type.cs index 9602842ae3b..02371f1bc3c 100644 --- a/src/NHibernate/Type/Int32Type.cs +++ b/src/NHibernate/Type/Int32Type.cs @@ -5,6 +5,7 @@ using NHibernate.SqlTypes; using System.Collections.Generic; using System.Data; +using System.Numerics; namespace NHibernate.Type { @@ -27,11 +28,16 @@ public override string Name } private static readonly Int32 ZERO = 0; + public override object Get(DbDataReader rs, int index, ISessionImplementor session) { try { - return Convert.ToInt32(rs[index]); + return rs[index] switch + { + BigInteger bi => (int) bi, + var c => Convert.ToInt32(c) + }; } catch (Exception ex) { @@ -43,7 +49,11 @@ public override object Get(DbDataReader rs, string name, ISessionImplementor ses { try { - return Convert.ToInt32(rs[name]); + return rs[name] switch + { + BigInteger bi => (int) bi, + var c => Convert.ToInt32(c) + }; } catch (Exception ex) { diff --git a/src/NHibernate/Type/Int64Type.cs b/src/NHibernate/Type/Int64Type.cs index 5bad9a7513b..3fa7892f4bf 100644 --- a/src/NHibernate/Type/Int64Type.cs +++ b/src/NHibernate/Type/Int64Type.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Data; using System.Data.Common; +using System.Numerics; using NHibernate.Engine; using NHibernate.SqlTypes; @@ -31,7 +32,11 @@ public override object Get(DbDataReader rs, int index, ISessionImplementor sessi { try { - return Convert.ToInt64(rs[index]); + return rs[index] switch + { + BigInteger bi => (long) bi, + var c => Convert.ToInt64(c) + }; } catch (Exception ex) { @@ -43,7 +48,11 @@ public override object Get(DbDataReader rs, string name, ISessionImplementor ses { try { - return Convert.ToInt64(rs[name]); + return rs[name] switch + { + BigInteger bi => (long) bi, + var c => Convert.ToInt64(c) + }; } catch (Exception ex) { diff --git a/src/NHibernate/Type/SByteType.cs b/src/NHibernate/Type/SByteType.cs index 55021fb22a6..2f861bda232 100644 --- a/src/NHibernate/Type/SByteType.cs +++ b/src/NHibernate/Type/SByteType.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Data; using System.Data.Common; +using System.Numerics; using NHibernate.Engine; using NHibernate.SqlTypes; @@ -31,7 +32,11 @@ public override object Get(DbDataReader rs, int index, ISessionImplementor sessi { try { - return Convert.ToSByte(rs[index]); + return rs[index] switch + { + BigInteger bi => (sbyte) bi, + var c => Convert.ToSByte(c) + }; } catch (Exception ex) { @@ -43,7 +48,11 @@ public override object Get(DbDataReader rs, string name, ISessionImplementor ses { try { - return Convert.ToSByte(rs[name]); + return rs[name] switch + { + BigInteger bi => (sbyte) bi, + var c => Convert.ToSByte(c) + }; } catch (Exception ex) { diff --git a/src/NHibernate/Type/UInt16Type.cs b/src/NHibernate/Type/UInt16Type.cs index 10e9d15cd9b..8628e8d4a91 100644 --- a/src/NHibernate/Type/UInt16Type.cs +++ b/src/NHibernate/Type/UInt16Type.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Data; using System.Data.Common; +using System.Numerics; using NHibernate.Engine; using NHibernate.SqlTypes; @@ -31,7 +32,11 @@ public override object Get(DbDataReader rs, int index, ISessionImplementor sessi { try { - return Convert.ToUInt16(rs[index]); + return rs[index] switch + { + BigInteger bi => (ushort) bi, + var c => Convert.ToUInt16(c) + }; } catch (Exception ex) { @@ -43,7 +48,11 @@ public override object Get(DbDataReader rs, string name, ISessionImplementor ses { try { - return Convert.ToUInt16(rs[name]); + return rs[name] switch + { + BigInteger bi => (ushort) bi, + var c => Convert.ToUInt16(c) + }; } catch (Exception ex) { diff --git a/src/NHibernate/Type/UInt32Type.cs b/src/NHibernate/Type/UInt32Type.cs index 0590278ef68..274d101b5ae 100644 --- a/src/NHibernate/Type/UInt32Type.cs +++ b/src/NHibernate/Type/UInt32Type.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Data; using System.Data.Common; +using System.Numerics; using NHibernate.Engine; using NHibernate.SqlTypes; @@ -31,7 +32,11 @@ public override object Get(DbDataReader rs, int index, ISessionImplementor sessi { try { - return Convert.ToUInt32(rs[index]); + return rs[index] switch + { + BigInteger bi => (uint) bi, + var c => Convert.ToUInt32(c) + }; } catch (Exception ex) { @@ -43,7 +48,11 @@ public override object Get(DbDataReader rs, string name, ISessionImplementor ses { try { - return Convert.ToUInt32(rs[name]); + return rs[name] switch + { + BigInteger bi => (uint) bi, + var c => Convert.ToUInt32(c) + }; } catch (Exception ex) { diff --git a/src/NHibernate/Type/UInt64Type.cs b/src/NHibernate/Type/UInt64Type.cs index a902b6d46fe..83d710a47f3 100644 --- a/src/NHibernate/Type/UInt64Type.cs +++ b/src/NHibernate/Type/UInt64Type.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Data; using System.Data.Common; +using System.Numerics; using NHibernate.Engine; using NHibernate.SqlTypes; @@ -30,7 +31,11 @@ public override object Get(DbDataReader rs, int index, ISessionImplementor sessi { try { - return Convert.ToUInt64(rs[index]); + return rs[index] switch + { + BigInteger bi => (ulong)bi, + var c => Convert.ToUInt64(c) + }; } catch (Exception ex) { @@ -42,7 +47,11 @@ public override object Get(DbDataReader rs, string name, ISessionImplementor ses { try { - return Convert.ToUInt64(rs[name]); + return rs[name] switch + { + BigInteger bi => (ulong) bi, + var c => Convert.ToUInt64(c) + }; } catch (Exception ex) { From 995535ebcdb89482cbefaa28e9ae8693f7e5bdab Mon Sep 17 00:00:00 2001 From: Alex Zaytsev Date: Wed, 28 Sep 2022 16:05:21 +1300 Subject: [PATCH 06/10] Add support for BigInteger in DoubleType and SingleType --- src/NHibernate/Type/DoubleType.cs | 13 +++++++++++-- src/NHibernate/Type/SingleType.cs | 13 +++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/NHibernate/Type/DoubleType.cs b/src/NHibernate/Type/DoubleType.cs index 4a8cf3406a9..9fbe8a0ed71 100644 --- a/src/NHibernate/Type/DoubleType.cs +++ b/src/NHibernate/Type/DoubleType.cs @@ -1,6 +1,7 @@ using System; using System.Data; using System.Data.Common; +using System.Numerics; using NHibernate.Engine; using NHibernate.SqlTypes; @@ -22,12 +23,20 @@ public DoubleType(SqlType sqlType) : base(sqlType) {} public override object Get(DbDataReader rs, int index, ISessionImplementor session) { - return Convert.ToDouble(rs[index]); + return rs[index] switch + { + BigInteger bi => (double) bi, + var v => Convert.ToDouble(v) + }; } public override object Get(DbDataReader rs, string name, ISessionImplementor session) { - return Convert.ToDouble(rs[name]); + return rs[name] switch + { + BigInteger bi => (double) bi, + var v => Convert.ToDouble(v) + }; } /// diff --git a/src/NHibernate/Type/SingleType.cs b/src/NHibernate/Type/SingleType.cs index 70ca434e04d..0cab527f6a6 100644 --- a/src/NHibernate/Type/SingleType.cs +++ b/src/NHibernate/Type/SingleType.cs @@ -1,6 +1,7 @@ using System; using System.Data; using System.Data.Common; +using System.Numerics; using NHibernate.Engine; using NHibernate.SqlTypes; @@ -35,7 +36,11 @@ public override object Get(DbDataReader rs, int index, ISessionImplementor sessi { try { - return Convert.ToSingle(rs[index]); + return rs[index] switch + { + BigInteger bi => (float) bi, + var v => Convert.ToSingle(v) + }; } catch (Exception ex) { @@ -47,7 +52,11 @@ public override object Get(DbDataReader rs, string name, ISessionImplementor ses { try { - return Convert.ToSingle(rs[name]); + return rs[name] switch + { + BigInteger bi => (float) bi, + var v => Convert.ToSingle(v) + }; } catch (Exception ex) { From 7c809aee8a989c2bcde84702e9692f1496cefb68 Mon Sep 17 00:00:00 2001 From: Alex Zaytsev Date: Wed, 28 Sep 2022 16:19:59 +1300 Subject: [PATCH 07/10] Add Firebird4Dialect to trigger scope --- src/NHibernate.Test/GeneratedTest/ComponentOwner.hbm.xml | 3 ++- src/NHibernate.Test/Generatedkeys/Select/MyEntity.hbm.xml | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/NHibernate.Test/GeneratedTest/ComponentOwner.hbm.xml b/src/NHibernate.Test/GeneratedTest/ComponentOwner.hbm.xml index c2a34df1321..297c0ddfd56 100644 --- a/src/NHibernate.Test/GeneratedTest/ComponentOwner.hbm.xml +++ b/src/NHibernate.Test/GeneratedTest/ComponentOwner.hbm.xml @@ -72,6 +72,7 @@ + - \ No newline at end of file + diff --git a/src/NHibernate.Test/Generatedkeys/Select/MyEntity.hbm.xml b/src/NHibernate.Test/Generatedkeys/Select/MyEntity.hbm.xml index 9910b7403cd..64ccf0f528e 100644 --- a/src/NHibernate.Test/Generatedkeys/Select/MyEntity.hbm.xml +++ b/src/NHibernate.Test/Generatedkeys/Select/MyEntity.hbm.xml @@ -21,6 +21,7 @@ CREATE GENERATOR MYGENERATOR; DROP GENERATOR MYGENERATOR; + @@ -37,6 +38,7 @@ END DROP TRIGGER my_entity_BI; + @@ -71,4 +73,4 @@ DROP TRIGGER my_entity_BI; - \ No newline at end of file + From 1215fd130de4a387d51580e0f95a328badfcd54a Mon Sep 17 00:00:00 2001 From: Alex Zaytsev Date: Wed, 28 Sep 2022 16:33:26 +1300 Subject: [PATCH 08/10] Fix CurrentTimestampSelectString for Firebird4Dialect --- src/NHibernate/Dialect/Firebird4Dialect.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/NHibernate/Dialect/Firebird4Dialect.cs b/src/NHibernate/Dialect/Firebird4Dialect.cs index 6bbf55f31a3..d42b8e6340d 100644 --- a/src/NHibernate/Dialect/Firebird4Dialect.cs +++ b/src/NHibernate/Dialect/Firebird4Dialect.cs @@ -4,6 +4,8 @@ namespace NHibernate.Dialect { public class Firebird4Dialect: FirebirdDialect { + public override string CurrentTimestampSelectString => "select LOCALTIMESTAMP from RDB$DATABASE"; + protected override void RegisterFunctions() { base.RegisterFunctions(); From 7a732f5b81ea5f5e8e2c96432a31ad36f901a84f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 20 Jan 2023 00:48:33 +0000 Subject: [PATCH 09/10] Generate async files --- src/NHibernate/Async/Type/ByteType.cs | 1 + src/NHibernate/Async/Type/Int16Type.cs | 1 + src/NHibernate/Async/Type/Int32Type.cs | 1 + src/NHibernate/Async/Type/Int64Type.cs | 1 + src/NHibernate/Async/Type/UInt16Type.cs | 1 + src/NHibernate/Async/Type/UInt32Type.cs | 1 + src/NHibernate/Async/Type/UInt64Type.cs | 1 + 7 files changed, 7 insertions(+) diff --git a/src/NHibernate/Async/Type/ByteType.cs b/src/NHibernate/Async/Type/ByteType.cs index c908d33432e..0d38fdf1a71 100644 --- a/src/NHibernate/Async/Type/ByteType.cs +++ b/src/NHibernate/Async/Type/ByteType.cs @@ -12,6 +12,7 @@ using System.Collections; using System.Data; using System.Data.Common; +using System.Numerics; using NHibernate.Engine; using NHibernate.SqlTypes; diff --git a/src/NHibernate/Async/Type/Int16Type.cs b/src/NHibernate/Async/Type/Int16Type.cs index 95cec493791..804d767eafd 100644 --- a/src/NHibernate/Async/Type/Int16Type.cs +++ b/src/NHibernate/Async/Type/Int16Type.cs @@ -15,6 +15,7 @@ using NHibernate.SqlTypes; using System.Collections.Generic; using System.Data; +using System.Numerics; namespace NHibernate.Type { diff --git a/src/NHibernate/Async/Type/Int32Type.cs b/src/NHibernate/Async/Type/Int32Type.cs index e7897e1eafc..3b4217968dd 100644 --- a/src/NHibernate/Async/Type/Int32Type.cs +++ b/src/NHibernate/Async/Type/Int32Type.cs @@ -15,6 +15,7 @@ using NHibernate.SqlTypes; using System.Collections.Generic; using System.Data; +using System.Numerics; namespace NHibernate.Type { diff --git a/src/NHibernate/Async/Type/Int64Type.cs b/src/NHibernate/Async/Type/Int64Type.cs index a4dae360662..e1b07967cbd 100644 --- a/src/NHibernate/Async/Type/Int64Type.cs +++ b/src/NHibernate/Async/Type/Int64Type.cs @@ -13,6 +13,7 @@ using System.Collections.Generic; using System.Data; using System.Data.Common; +using System.Numerics; using NHibernate.Engine; using NHibernate.SqlTypes; diff --git a/src/NHibernate/Async/Type/UInt16Type.cs b/src/NHibernate/Async/Type/UInt16Type.cs index b30c8ee87a4..cfd05ee60f6 100644 --- a/src/NHibernate/Async/Type/UInt16Type.cs +++ b/src/NHibernate/Async/Type/UInt16Type.cs @@ -13,6 +13,7 @@ using System.Collections.Generic; using System.Data; using System.Data.Common; +using System.Numerics; using NHibernate.Engine; using NHibernate.SqlTypes; diff --git a/src/NHibernate/Async/Type/UInt32Type.cs b/src/NHibernate/Async/Type/UInt32Type.cs index b5aa62179c0..2fa37d01162 100644 --- a/src/NHibernate/Async/Type/UInt32Type.cs +++ b/src/NHibernate/Async/Type/UInt32Type.cs @@ -13,6 +13,7 @@ using System.Collections.Generic; using System.Data; using System.Data.Common; +using System.Numerics; using NHibernate.Engine; using NHibernate.SqlTypes; diff --git a/src/NHibernate/Async/Type/UInt64Type.cs b/src/NHibernate/Async/Type/UInt64Type.cs index 08e7c68a1e6..d2db5e47c99 100644 --- a/src/NHibernate/Async/Type/UInt64Type.cs +++ b/src/NHibernate/Async/Type/UInt64Type.cs @@ -13,6 +13,7 @@ using System.Collections.Generic; using System.Data; using System.Data.Common; +using System.Numerics; using NHibernate.Engine; using NHibernate.SqlTypes; From c23199519ce7ec044c403b8c87ed43b3d6037263 Mon Sep 17 00:00:00 2001 From: Alex Zaytsev Date: Mon, 23 Jan 2023 09:32:17 +1000 Subject: [PATCH 10/10] Set version 5.5.0-dev --- build-common/NHibernate.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build-common/NHibernate.props b/build-common/NHibernate.props index 5e27ab81d28..5575d231ce4 100644 --- a/build-common/NHibernate.props +++ b/build-common/NHibernate.props @@ -2,10 +2,10 @@ - 5.4 + 5.5 0 - + dev 9.0 $(NhVersion).$(VersionPatch)