-
Notifications
You must be signed in to change notification settings - Fork 69
Add TempTableDefinitions and TableVarMapping #278
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
Closed
Closed
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
8a9bbff
Add TempTableDefinitions and TableVarMapping
davidoptima 921ca59
try and get the build working
davidoptima a85d2b8
Add config
davidoptima 635b365
Add loadTempTablesMethod
davidoptima d344274
Version bump
davidoptima 69f6a8e
bool -> bit
davidoptima 0f0112d
add binary
davidoptima 1962219
Add TempTableLoader
davidoptima d60ead7
Clean up
davidoptima a5b454f
Merge remote-tracking branch 'remotes/upstream/master' into temp-tables
davidoptima a749685
Clean up whitespace changes
davidoptima 5ecc01a
More white space
davidoptima 0b90ac1
Add missing file
davidoptima 68b5fe0
Fix more merge fall out
davidoptima 9f6a4d5
pin fake in build.sh
davidoptima 622834e
FSharp.Core.4.0.0.1
davidoptima 73ea1fa
update bindingRedirect
davidoptima 85e1839
try get the mono build working
davidoptima File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/bin/bash | ||
if [ ! -f packages/FAKE/tools/FAKE.exe ]; then | ||
mono .nuget/NuGet.exe install FAKE -OutputDirectory packages -ExcludeVersion | ||
mono .nuget/NuGet.exe install FAKE -OutputDirectory packages -ExcludeVersion -Version 4.1.2 | ||
fi | ||
#workaround assembly resolution issues in build.fsx | ||
mono packages/FAKE/tools/FAKE.exe build.fsx $@ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
module FSharp.Data.TempTableTests | ||
|
||
open FSharp.Data | ||
open Xunit | ||
open System.Data.SqlClient | ||
|
||
type TempTable = | ||
SqlCommandProvider< | ||
TempTableDefinitions = " | ||
CREATE TABLE #Temp ( | ||
Id INT NOT NULL, | ||
Name NVARCHAR(100) NULL)", | ||
CommandText = " | ||
SELECT Id, Name FROM #Temp", | ||
ConnectionStringOrName = | ||
ConnectionStrings.AdventureWorksLiteral> | ||
|
||
[<Fact>] | ||
let usingTempTable() = | ||
use conn = new SqlConnection(ConnectionStrings.AdventureWorksLiteral) | ||
conn.Open() | ||
|
||
use cmd = new TempTable(conn) | ||
|
||
cmd.LoadTempTables( | ||
Temp = | ||
[ TempTable.Temp(Id = 1, Name = Some "monkey") | ||
TempTable.Temp(Id = 2, Name = Some "donkey") ]) | ||
|
||
let actual = | ||
cmd.Execute() | ||
|> Seq.map(fun x -> x.Id, x.Name) | ||
|> Seq.toList | ||
|
||
let expected = [ | ||
1, Some "monkey" | ||
2, Some "donkey" | ||
] | ||
|
||
Assert.Equal<_ list>(expected, actual) | ||
|
||
[<Fact>] | ||
let queryWithHash() = | ||
// We shouldn't mangle the statement when it's run | ||
use cmd = | ||
new SqlCommandProvider< | ||
CommandText = " | ||
SELECT Id, Name | ||
FROM | ||
( | ||
SELECT 1 AS Id, '#name' AS Name UNION | ||
SELECT 2, 'some other value' | ||
) AS a | ||
WHERE Name = '#name'", | ||
ConnectionStringOrName = | ||
ConnectionStrings.AdventureWorksLiteral>(ConnectionStrings.AdventureWorksLiteral) | ||
|
||
let actual = | ||
cmd.Execute() | ||
|> Seq.map(fun x -> x.Id, x.Name) | ||
|> Seq.toList | ||
|
||
let expected = [ | ||
1, "#name" | ||
] | ||
|
||
Assert.Equal<_ list>(expected, actual) | ||
|
||
type TempTableHash = | ||
SqlCommandProvider< | ||
TempTableDefinitions = " | ||
CREATE TABLE #Temp ( | ||
Id INT NOT NULL)", | ||
CommandText = " | ||
SELECT a.Id, a.Name | ||
FROM | ||
( | ||
SELECT 1 AS Id, '#Temp' AS Name UNION | ||
SELECT 2, 'some other value' | ||
) AS a | ||
INNER JOIN #Temp t ON t.Id = a.Id", | ||
ConnectionStringOrName = | ||
ConnectionStrings.AdventureWorksLiteral> | ||
|
||
[<Fact>] | ||
let queryWithHashAndTempTable() = | ||
// We shouldn't mangle the statement when it's run | ||
use conn = new SqlConnection(ConnectionStrings.AdventureWorksLiteral) | ||
conn.Open() | ||
|
||
use cmd = new TempTableHash(conn) | ||
|
||
cmd.LoadTempTables( | ||
Temp = | ||
[ TempTableHash.Temp(Id = 1) ]) | ||
|
||
let actual = | ||
cmd.Execute() | ||
|> Seq.map(fun x -> x.Id, x.Name) | ||
|> Seq.toList | ||
|
||
let expected = [ | ||
1, "#Temp" | ||
] | ||
|
||
Assert.Equal<_ list>(expected, actual) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we shouldn't touch this for now.