Skip to content

WIP Add testing DB2 to GitHub Actions #2967

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 51 commits into
base: master
Choose a base branch
from

Conversation

bahusoid
Copy link
Member

@bahusoid bahusoid commented Dec 30, 2021

Too many tests error..

@hazzik
Copy link
Member

hazzik commented Jan 1, 2022

DB2 requires similar to Firebird workaround for parameters. Parameters that are used in the SELECT statements should be wrapped into cast.

2021-12-31T14:59:15.4008216Z 14) Error : NHibernate.Test.Criteria.ProjectionsTestAsync.UsingConditionalsAsync
2021-12-31T14:59:15.4010114Z NHibernate.Exceptions.GenericADOException : could not execute query
2021-12-31T14:59:15.4011188Z [ SELECT (case when this_.studentId = @p0 then @p1 else @p2 end) as y0_ FROM Student this_ ]
2021-12-31T14:59:15.4012866Z   Name:cp0 - Value:27 [Type: NHibernate.Type.Int64Type (SqlType: Int64)]  Name:cp1 - Value:yes [Type: NHibernate.Type.StringType (SqlType: String)]  Name:cp2 - Value:no [Type: NHibernate.Type.StringType (SqlType: String)]
2021-12-31T14:59:15.4014355Z [SQL: SELECT (case when this_.studentId = @p0 then @p1 else @p2 end) as y0_ FROM Student this_]
2021-12-31T14:59:15.4016006Z   ----> IBM.Data.DB2.Core.DB2Exception : ERROR [42610] [IBM][DB2/LINUXX8664] SQL0418N  The statement was not processed because the statement contains an invalid use of one of the following: an untyped parameter marker, the DEFAULT keyword, or a null value.
2021-12-31T14:59:15.4017111Z Data:
2021-12-31T14:59:15.4017905Z   actual-sql-query: SELECT (case when this_.studentId = @p0 then @p1 else @p2 end) as y0_ FROM Student this_

See this: https://www.ibm.com/docs/es/db2/11.1?topic=design-parameters-markers#d97366e93

@hazzik
Copy link
Member

hazzik commented Jan 1, 2022

I think we need to have a systematic approach rather than trying to fix this problem for different DBs. (I think Hana has the same problem). I had a several attempts to fix it, but never finished.

@bahusoid
Copy link
Member Author

bahusoid commented Jan 1, 2022

DB2 requires similar to Firebird workaround

I don't really like how it's done in Firebird. We need to think about more elegant solution rather than "brute force" parameters wrapping in cast. The request to disable this functionality proves it can cause more harm than good

@hazzik
Copy link
Member

hazzik commented Jan 1, 2022

Yes, agree.

@bahusoid
Copy link
Member Author

bahusoid commented Jan 1, 2022

171) Error : NHibernate.Test.TypesTest.StringTypeWithLengthFixture.HqlEqualityParameterCanExceedColumnSize
NHibernate.Exceptions.GenericADOException : could not execute query
[ select stringclas0_.Id as id1_0_, stringclas0_.StringValue as stringvalue2_0_, stringclas0_.LongStringValue as longstringvalue3_0_ from StringClass stringclas0_ where stringclas0_.StringValue=@p0 ]
  Name:likeValue - Value:AAAAAAAAABx [Type: NHibernate.Type.StringType (SqlType: String(Length=10))]
  ----> IBM.Data.DB2.Core.DB2Exception : ERROR [22001] [IBM] CLI0109E  String data right truncation. SQLSTATE=22001

This test is skipped if SupportsNonDataBoundCondition is false. But I see no non data bound conditions. It seems we need to adjust parameter sizes similar how it's done for MSSQL in SqlClientDriver.AdjustParameterForValue (another good place for systematic approach)

@hazzik
Copy link
Member

hazzik commented Jan 1, 2022

This test is skipped if SupportsNonDataBoundCondition is false.

Skip condition is incorrect then.

how it's done for MSSQL in SqlClientDriver.AdjustParameterForValue

Yes

another good place for systematic approach

Yes

/// <summary>
/// Supports sub-selects in order by clause
/// </summary>
public virtual bool SupportsSubSelectsInOrderBy => _dialect.SupportsScalarSubSelects;
Copy link
Member

Choose a reason for hiding this comment

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

DB2 supports scalar sub selects, but it does not support them in order-by clause.

This comment was marked as resolved.

This comment was marked as resolved.

@hazzik

This comment was marked as resolved.

@hazzik
Copy link
Member

hazzik commented Jan 11, 2022

Also... The assembly name and namespace has (edit:almost) reverted back to .NET version. Need to change driver.

@bahusoid
Copy link
Member Author

I was thinking about this. But why?

Just to check how it works... It's the latest version. So why not?

@bahusoid
Copy link
Member Author

Just to check how it works.

And it doesn't work... So let's just drop it for now..

@hazzik
Copy link
Member

hazzik commented Jan 11, 2022

Yeah, it is IBM.Data.Db2.DB2Connection (in assembly) vs IBM.Data.DB2.DB2Connection (expected)

@bahusoid

This comment has been minimized.

@bahusoid
Copy link
Member Author

Interesting async regen failure.

Logs crit: AsyncGenerator.CommandLine[0] One or more errors occurred while opening the project: Msbuild failed when processing the file '/home/runner/work/nhibernate-core/nhibernate-core/src/NHibernate.Test/NHibernate.Test.csproj' with message: /usr/share/dotnet/sdk/6.0.405/Microsoft.Common.CurrentVersion.targets: (2302, 5): There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "/home/runner/.nuget/packages/ibm.data.db2.core-lnx/3.1.0.500/lib/netstandard2.1/IBM.Data.DB2.Core.dll", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. Hint: For suppressing irrelevant errors use SuppressDiagnosticFailures option. System.InvalidOperationException: One or more errors occurred while opening the project: Msbuild failed when processing the file '/home/runner/work/nhibernate-core/nhibernate-core/src/NHibernate.Test/NHibernate.Test.csproj' with message: /usr/share/dotnet/sdk/6.0.405/Microsoft.Common.CurrentVersion.targets: (2302, 5): There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "/home/runner/.nuget/packages/ibm.data.db2.core-lnx/3.1.0.500/lib/netstandard2.1/IBM.Data.DB2.Core.dll", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. Hint: For suppressing irrelevant errors use SuppressDiagnosticFailures option. at AsyncGenerator.AsyncCodeGenerator.CheckForErrors(MSBuildWorkspace workspace, String itemType, ImmutableArray`1 supressFailuresPredicates, ILogger logger) in C:\Workspace\Git\AsyncGenerator\Source\AsyncGenerator\AsyncCodeGenerator.cs:line 437 at AsyncGenerator.AsyncCodeGenerator.OpenProject(MSBuildWorkspace workspace, String filePath, ImmutableArray`1 supressFailuresPredicates, ILogger logger, CancellationToken cancellationToken) in C:\Workspace\Git\AsyncGenerator\Source\AsyncGenerator\AsyncCodeGenerator.cs:line 375 at AsyncGenerator.AsyncCodeGenerator.GenerateAsync(AsyncCodeConfiguration configuration, CancellationToken cancellationToken) in C:\Workspace\Git\AsyncGenerator\Source\AsyncGenerator\AsyncCodeGenerator.cs:line 76 at AsyncGenerator.CommandLine.Program.Main(String[] args) in C:\Workspace\Git\AsyncGenerator\Source\AsyncGenerator.CommandLine\Program.cs:line 51

@robsosno
Copy link

Changing casing in namespace. Smart move...

I've just moved my app from .NET 3.1 to .NET 6.0. Next step it would be to have new Db2 driver supporting .NET 6.0 (I expect better performance). However I was surprised with driver name change - db2-net-packages (breaking changes paragraph).
I see some logic in the naming: IBM.Data.DB2 is dedicated to classic .NET framework, IBM.Data.DB2.Core to .NET Core and IBM.Data.Db2 to .NET 5+ . They removed Core similarly as Framework did and to avoid possibility of incorrect linking 3.1 with 5+ they've changed DB2 to Db2. So it seems that all future versions will be in accordance with this new schema.
I saw some changes on db2Net5 branch. When do you plan to merge it to the core?
I would vote to implement driver differently - as an additional class, let it be named Db2Driver or Db2Driver5. I trust more to manual configuration than smart switches.

bahusoid and others added 10 commits June 4, 2024 12:19
ERROR [42803] [IBM][DB2/LINUXX8664] SQL0119N  An expression starting with "BODYWEIGHT" specified in a SELECT clause, HAVING clause, or ORDER BY clause is not specified in the GROUP BY clause or it is in a SELECT clause, HAVING clause, or ORDER BY clause with a column function and no GROUP BY clause is specified.
@hazzik
Copy link
Member

hazzik commented Jun 5, 2024

Note to myself:

On Windows need to set DB2LANG=en_US environment variable.

@hazzik
Copy link
Member

hazzik commented Jun 6, 2024

Current state: 91 tests are failing.

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.

3 participants