Skip to content

Commit 712b8cb

Browse files
Merge pull request #421 from suou-ryuu/issue-420
Issue 420: restored TVP column ordering to, expected, column_id
2 parents 66c3613 + 995a318 commit 712b8cb

File tree

6 files changed

+60
-11
lines changed

6 files changed

+60
-11
lines changed

RELEASE_NOTES.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
#### 2.1.2 May 08, 2022
2+
3+
* Issue #420 fix "TVP Column Ordering is incorrect as of version 2.1.0"
4+
* Contributor: Suou Ryuu (https://github.com/suou-ryuu)
5+
6+
#### 2.1.1-beta0 April 07, 2022
7+
8+
* Issue #413 fix "Fixed length binary columns in user defined table types fail when constructed"
9+
* Breaking change: removal of net40 support
10+
* Contributor: Suou Ryuu (https://github.com/suou-ryuu)
11+
112
#### 2.1.0-beta1 December 17, 2020
213

314
* fix reading from app.config vs App.config on case sensitive file system

src/SqlClient.DesignTime/AssemblyInfo.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ open System.Runtime.CompilerServices
66
[<assembly: AssemblyTitleAttribute("SqlClient.DesignTime")>]
77
[<assembly: AssemblyProductAttribute("FSharp.Data.SqlClient.DesignTime")>]
88
[<assembly: AssemblyDescriptionAttribute("SqlClient F# type providers")>]
9-
[<assembly: AssemblyVersionAttribute("2.0.5")>]
10-
[<assembly: AssemblyFileVersionAttribute("2.0.5")>]
9+
[<assembly: AssemblyVersionAttribute("2.1.2")>]
10+
[<assembly: AssemblyFileVersionAttribute("2.1.2")>]
1111
[<assembly: InternalsVisibleToAttribute("SqlClient.Tests")>]
1212
do ()
1313

1414
module internal AssemblyVersionInformation =
1515
let [<Literal>] AssemblyTitle = "SqlClient.DesignTime"
1616
let [<Literal>] AssemblyProduct = "FSharp.Data.SqlClient.DesignTime"
1717
let [<Literal>] AssemblyDescription = "SqlClient F# type providers"
18-
let [<Literal>] AssemblyVersion = "2.0.5"
19-
let [<Literal>] AssemblyFileVersion = "2.0.5"
18+
let [<Literal>] AssemblyVersion = "2.1.2"
19+
let [<Literal>] AssemblyFileVersion = "2.1.2"
2020
let [<Literal>] InternalsVisibleTo = "SqlClient.Tests"

src/SqlClient.DesignTime/SqlClientExtensions.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -526,10 +526,10 @@ select
526526
c.name, c.system_type_id, c.user_type_id, c.is_nullable, c.max_length, c.is_identity, c.is_computed, tt.user_type_id table_type_user_type_id, c.[precision], c.scale
527527
from sys.table_types as tt
528528
inner join sys.columns as c on tt.type_table_object_id = c.object_id
529-
order by
530-
tt.user_type_id
529+
order by
530+
c.column_id
531+
, tt.user_type_id
531532
, c.user_type_id
532-
, c.column_id
533533
"""
534534
, this)
535535
use reader = cmd.ExecuteReader()

src/SqlClient/AssemblyInfo.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ open System.Runtime.CompilerServices
66
[<assembly: AssemblyTitleAttribute("SqlClient")>]
77
[<assembly: AssemblyProductAttribute("FSharp.Data.SqlClient")>]
88
[<assembly: AssemblyDescriptionAttribute("SqlClient F# type providers")>]
9-
[<assembly: AssemblyVersionAttribute("2.0.5")>]
10-
[<assembly: AssemblyFileVersionAttribute("2.0.5")>]
9+
[<assembly: AssemblyVersionAttribute("2.1.2")>]
10+
[<assembly: AssemblyFileVersionAttribute("2.1.2")>]
1111
[<assembly: InternalsVisibleToAttribute("SqlClient.Tests")>]
1212
do ()
1313

1414
module internal AssemblyVersionInformation =
1515
let [<Literal>] AssemblyTitle = "SqlClient"
1616
let [<Literal>] AssemblyProduct = "FSharp.Data.SqlClient"
1717
let [<Literal>] AssemblyDescription = "SqlClient F# type providers"
18-
let [<Literal>] AssemblyVersion = "2.0.5"
19-
let [<Literal>] AssemblyFileVersion = "2.0.5"
18+
let [<Literal>] AssemblyVersion = "2.1.2"
19+
let [<Literal>] AssemblyFileVersion = "2.1.2"
2020
let [<Literal>] InternalsVisibleTo = "SqlClient.Tests"

tests/SqlClient.Tests/TVPTests.fs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,4 +222,20 @@ let ``Using Fixed Length Binary TVP``() =
222222
]
223223
|> Seq.map (fun d -> FixedLengthBinaryTVP.FixedLengthBinaryTVPTest (Some d))
224224
|> cmd.Execute
225+
|> ignore
226+
227+
228+
type TestTVPColumnOrder = SqlCommandProvider<"EXEC [dbo].[TestTVPColumnOrder] @tvp", ConnectionStrings.AdventureWorksLiteral>
229+
[<Fact>]
230+
let ``User Defined Table Types should list columns orderd by Column Id (i.e. the order in which they appear in the declared type)`` () =
231+
use cmd = new TestTVPColumnOrder(ConnectionStrings.AdventureWorksLiteral)
232+
233+
[
234+
(1, "some string", true)
235+
(2, "some other string", false)
236+
(3, "yet another string", true)
237+
]
238+
|> Seq.map (fun (i, s, b) -> TestTVPColumnOrder.TVPColumnOrder(i, s, b))
239+
|> Seq.toList
240+
|> cmd.Execute
225241
|> ignore

tests/SqlClient.Tests/extensions.sql

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ GO
6161
IF OBJECT_ID('dbo.FixedLengthBinaryTVPTestProc') IS NOT NULL
6262
DROP PROCEDURE [dbo].[FixedLengthBinaryTVPTestProc]
6363
GO
64+
IF OBJECT_ID('dbo.TestTVPColumnOrder') IS NOT NULL
65+
DROP PROCEDURE [dbo].[TestTVPColumnOrder]
66+
GO
6467
IF OBJECT_ID('Sales.GetUKSalesOrders') IS NOT NULL
6568
DROP FUNCTION Sales.GetUKSalesOrders;
6669
GO
@@ -127,6 +130,10 @@ IF TYPE_ID(N'dbo.FixedLengthBinaryTVPTest') IS NOT NULL
127130
DROP TYPE [dbo].[FixedLengthBinaryTVPTest]
128131
GO
129132

133+
IF TYPE_ID(N'dbo.TVPColumnOrder') IS NOT NULL
134+
DROP TYPE [dbo].[TVPColumnOrder]
135+
GO
136+
130137

131138
CREATE TYPE dbo.MyTableType AS TABLE (myId int not null, myName nvarchar(30) null)
132139
GO
@@ -154,6 +161,13 @@ CREATE TYPE [dbo].[FixedLengthBinaryTVPTest] AS TABLE (
154161
)
155162
GO
156163

164+
CREATE TYPE [dbo].[TVPColumnOrder] AS TABLE(
165+
[Param1] INT NOT NULL,
166+
[Param2] NVARCHAR(100) NOT NULL,
167+
[Param3] BIT NOT NULL
168+
)
169+
GO
170+
157171
--TABLES
158172

159173
CREATE TABLE dbo.TableHavingColumnNamesWithSpaces (
@@ -269,6 +283,14 @@ BEGIN
269283
END
270284
GO
271285

286+
CREATE PROCEDURE [dbo].[TestTVPColumnOrder](
287+
@tvpColumnOrder [dbo].[TVPColumnOrder] READONLY
288+
)
289+
AS
290+
SELECT *
291+
FROM @tvpColumnOrder
292+
GO
293+
272294

273295
CREATE FUNCTION dbo.ufnGetStock2(@ProductID [int] = NULL)
274296
RETURNS [int]

0 commit comments

Comments
 (0)