GithubHelp home page GithubHelp logo

Comments (8)

dmitry-a-morozov avatar dmitry-a-morozov commented on August 23, 2024

@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.

dmitry-a-morozov avatar dmitry-a-morozov commented on August 23, 2024

@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.

danielrbradley avatar danielrbradley commented on August 23, 2024

@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.

dmitry-a-morozov avatar dmitry-a-morozov commented on August 23, 2024

@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.

jackfoxy avatar jackfoxy commented on August 23, 2024

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.

dmitry-a-morozov avatar dmitry-a-morozov commented on August 23, 2024

Ok. I will start working on this.

from fsharp.data.sqlclient.

dmitry-a-morozov avatar dmitry-a-morozov commented on August 23, 2024

Fixed. Release 1.1.24.

from fsharp.data.sqlclient.

dsevastianov avatar dsevastianov commented on August 23, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.