Skip to content

Commit 347ca30

Browse files
author
Roy Chase
authored
Merge pull request #4 from LinqToDB4iSeries/Linq2DB_1.8.4Testing
Linq2db v1.9.0 compatibility changes
2 parents 0092ae7 + a7da5fa commit 347ca30

19 files changed

+79
-23
lines changed

.axoCover/settings.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"TestRunner": "",
3+
"TestPlatform": "x86",
4+
"TestApartmentState": "STA",
5+
"TestAdapterMode": "Standard",
6+
"IsRedirectingFrameworkAssemblies": true,
7+
"TestSettings": "",
8+
"ExcludeAttributes": "System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute",
9+
"ExcludeFiles": "",
10+
"ExcludeDirectories": "",
11+
"Filters": "+[*]*",
12+
"IsIncludingSolutionAssemblies": true,
13+
"IsExcludingTestAssemblies": false,
14+
"IsCoveringByTest": true,
15+
"IsMergingByHash": true,
16+
"IsSkippingAutoProps": true
17+
}

ISeriesProvider/DB2iSeriesMappingSchema.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ private static void AppendConversion(StringBuilder stringBuilder, int value)
7676

7777
private static void ConvertStringToSql(StringBuilder stringBuilder, string value)
7878
{
79-
DataTools.ConvertStringToSql(stringBuilder, "||", "'", AppendConversion, value);
79+
DataTools.ConvertStringToSql(stringBuilder, "||", "", AppendConversion, value, null);
8080
}
8181

8282
private static void ConvertCharToSql(StringBuilder stringBuilder, char value)

ISeriesProvider/DB2iSeriesSqlBuilder.cs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ protected override void BuildInsertOrUpdateQueryAsMerge(string fromDummyTable)
148148

149149
AppendIndent().Append("USING (SELECT ");
150150

151+
ExtractMergeParametersIfCannotCombine(keys);
152+
151153
for (var i = 0; i < keys.Count; i++)
152154
{
153155
var key = keys[i];
@@ -220,6 +222,7 @@ protected override void BuildInsertOrUpdateQueryAsMerge(string fromDummyTable)
220222
StringBuilder.Length--;
221223
}
222224

225+
223226
protected override void BuildUpdateSet()
224227
{
225228
AppendIndent()
@@ -290,8 +293,43 @@ protected override void BuildSelectClause()
290293
protected override void BuildSql()
291294
{
292295
AlternativeBuildSql(true, base.BuildSql);
296+
297+
//// HACK: the number of parameters are not always provided by Linq2DB
298+
//// the missing ones should simply be copies of existing ones
299+
//var sql = this.StringBuilder.ToString();
300+
//var cnt = sql.Count(c => c.Equals('@'));
301+
302+
//if (cnt != SelectQuery.Parameters.Count)
303+
//{
304+
// // do something
305+
// var currentParams = SelectQuery.Parameters.Select(p => p.Name).ToList();
306+
307+
// var matches = ParseParams(sql);
308+
// foreach (var item in matches)
309+
// {
310+
// if (currentParams.Contains(item))
311+
// currentParams.Remove(item);
312+
// else
313+
// {
314+
// // add the parameter as a copy of the original one
315+
// var old = SelectQuery.Parameters.Where(p => p.Name == item).First();
316+
317+
// SelectQuery.Parameters.Add(old);
318+
// }
319+
// }
320+
//}
293321
}
294322

323+
//IEnumerable<string> ParseParams(string sql)
324+
//{
325+
// var parms = sql.Split(new[] { '@' }, StringSplitOptions.None);
326+
// foreach (var part in parms.Skip(1))
327+
// {
328+
// var retval = part.TakeWhile(s => char.IsLetterOrDigit(s));
329+
// yield return string.Concat(retval);
330+
// }
331+
//}
332+
295333

296334
protected override IEnumerable<SelectQuery.Column> GetSelectedColumns()
297335
{

ISeriesProvider/DB2iSeriesTools.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ private static IDataProvider ProviderDetector(IConnectionStringSettings css, str
6161
return _db2iSeriesDataProvider;
6262
}
6363
}
64-
catch (Exception ex)
64+
catch (Exception)
6565
{
6666
}
6767
}

ISeriesProvider/LinqToDB.DataProvider.DB2iSeries.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
</PropertyGroup>
4141
<ItemGroup>
4242
<Reference Include="IBM.Data.DB2.iSeries, Version=12.0.0.0, Culture=neutral, PublicKeyToken=9cdb2ebfb1f93a26, processorArchitecture=MSIL" />
43-
<Reference Include="linq2db, Version=1.8.3.0, Culture=neutral, PublicKeyToken=f19f8aed7feff67e, processorArchitecture=MSIL">
44-
<HintPath>..\packages\linq2db.1.8.3\lib\net45\linq2db.dll</HintPath>
43+
<Reference Include="linq2db, Version=1.9.0.0, Culture=neutral, PublicKeyToken=f19f8aed7feff67e, processorArchitecture=MSIL">
44+
<HintPath>..\packages\linq2db.1.9.0\lib\net45\linq2db.dll</HintPath>
4545
<Private>True</Private>
4646
</Reference>
4747
<Reference Include="System" />

ISeriesProvider/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="linq2db" version="1.8.3" targetFramework="net45" />
3+
<package id="linq2db" version="1.9.0" targetFramework="net45" />
44
</packages>

NuGet/linq2db4iSeries.nuspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
33
<metadata>
44
<id>linq2db4iSeries</id>
5-
<version>1.8.3.0</version>
5+
<version>1.9.0.0</version>
66
<title>LINQ to DB provider for iSeries DB2</title>
77
<authors>Retail Assist Ltd</authors>
88
<owners />
@@ -17,8 +17,8 @@
1717
</tags>
1818
<dependencies>
1919
<group>
20-
<!-- 1.8.2 <= x < 1.8.4 -->
21-
<dependency id="linq2db" version="[1.8.2,1.8.4)" />
20+
<!-- 1.9.0 <= x < 1.9.1 -->
21+
<dependency id="linq2db" version="[1.9.0,1.9.1)" />
2222
</group>
2323
</dependencies>
2424
</metadata>

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,5 @@ The rest of the usage is exactly the same as Linq2DB. See https://github.com/lin
4040
2. Any objects created using this provider (e.g. as the result of a Create table statement) will be created in the Library in the Default Collection connection string parameter. If this is not specifed then it wil be created in the default library for the user account.
4141
3. Transactions can only be used if journalling is set up on the table (file). If the iSeries schema is created with a CREATE SCHEMA command then this will be set by default however if the schema is created using the iSeries commands then you will need to either add journalling to the table explicitly OR create a journal receiver called QSQJRN in the Library to have journalling automatically applied to each table.
4242
4. This is currently only working for .Net 4.0/4.5
43+
5. The new Linq2DB merge syntax is currently untested.
4344

Tests/FSharp/Tests.FSharp.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
</ItemGroup>
5959
<ItemGroup>
6060
<Reference Include="linq2db">
61-
<HintPath>..\..\packages\linq2db.1.8.3\lib\net45\linq2db.dll</HintPath>
61+
<HintPath>..\..\packages\linq2db.1.9.0\lib\net45\linq2db.dll</HintPath>
6262
<Private>True</Private>
6363
</Reference>
6464
<Reference Include="mscorlib" />

Tests/FSharp/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="linq2db" version="1.8.3" targetFramework="net45" />
3+
<package id="linq2db" version="1.9.0" targetFramework="net45" />
44
<package id="NUnit" version="3.2.1" targetFramework="net45" />
55
</packages>

0 commit comments

Comments
 (0)