Comments (8)
@danielrbradley The type provider currently supports nullable input parameters by mapping them to optional args for AsyncExecute/Execute.
Be careful with the specific example you gave - you cannot have unbound variable with same name (@bitfilter) more than once in side single T-SQL batch. The workaround is to use intermediate variable inside script like
DECLARE @bitFilterCopy AS BIT = @bitfilter
SELECT * FROM x WHERE @bitFilterCopy IS NULL OR (BitCol = @bitFilterCopy)
from fsharp.data.sqlclient.
@danielrbradley I take my previous comment back. There is no way to specify nullable input params. Mostly because meta-info stored procedure sys.sp_describe_undeclared_parameters TP relies upon doesn't support it.
More to that, even for stored procedure there no reasonable way to get default values for parameters.
from fsharp.data.sqlclient.
@dmitry-a-morozov I assumed there was a good reason as to why it's not currently implemented. However, might it be possible to change the implementation, or provide an option when defining the type provider (similar to the SingleRow = true), to make it assume that all parameters found could be nullable, perhaps an option like AllowNullParameters?
from fsharp.data.sqlclient.
@danielrbradley I'm kind of back working on small fixes for the SqlCommandProvider. Do you still think AllowNullParameters feature will be valuable?
from fsharp.data.sqlclient.
as in SELECT * FROM tbMyTable WHERE myTableColumn = @myTableColumn
and I want the parameter to be null? In that case I would say "yes", however perhaps it would be more F# type compliant if we could assign the myTableColumn
to None
.
from fsharp.data.sqlclient.
Ok. I will start working on this.
from fsharp.data.sqlclient.
Fixed. Release 1.1.24.
from fsharp.data.sqlclient.
@danielrbradley SqlProgrammabilityProvider now supports default parameters and nullable input-output parameters for Stored Procedures and Table-Valued User-Defined Functions.
And of course SqlCommandProvider now supports AllParametersOptional
.
Also, there is a simple workaround for the issue with SqlCommandProvider not accepting duplicate usage of variables in SQL as mentioned by @dmitry-a-morozov (at least in this particular case):
SELECT * FROM x WHERE BitCol = ISNULL(@bitFilter, BitCol)
from fsharp.data.sqlclient.
Related Issues (20)
- Dacpac support info HOT 3
- "F# Formatting" link is broken
- Can't build/run from the commandline, but can from Visual Studio 2019 HOT 2
- Question: Creating a provider without an access to DB HOT 3
- SqlEnumProvider breaks VS 2019 HOT 2
- Not platform detection Fable HOT 1
- Build is broken without full VS installation
- Fixed length binary columns in user defined table types fail when constructed HOT 8
- Cannot use User Defined Table Types with the SqlCommandProvider HOT 5
- .NET 6 support HOT 6
- One line summary of the bug HOT 2
- TVP Column Ordering is incorrect as of version 2.1.0
- Cannot use parameter name more than once in a script HOT 3
- System.Data.SqlClient is not supported on this platform. HOT 5
- Conversion failed when using User Defined Table Types HOT 1
- Any 2023 tricks for running on Windows? HOT 3
- NullReferenceException in SqlConnection.UseLocally HOT 1
- Support for 'Active Directory Interactive' authentication HOT 3
- dotnet SDK projects using FSharp.Core version 7.0.0 breaks at runtime HOT 3
- SQL LIKE operation doesn't recognize variable HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fsharp.data.sqlclient.