Skip to content
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

Binding parameters using a key value type #43

Open
ranjithchev opened this issue Oct 23, 2018 · 2 comments
Open

Binding parameters using a key value type #43

ranjithchev opened this issue Oct 23, 2018 · 2 comments

Comments

@ranjithchev
Copy link

ranjithchev commented Oct 23, 2018

Hi

I understand that currently this library supports binding parameters but expects it be in the right order.
select a,b from table1 where a=? and b=? and the binding parameters should be an array in the right order like ["abc", 2]

Is there a way we can support or have support to give the binding parameters as below (This is supported in mssql library).

select a,b from table1 where a=@v1 and b=@v2
request.add(paramname, paramvalue, paramtype)
In the above example it would translate to
request.add("v1", "abc", sql.Varchar)
request.add("v2", 2, sql.Int)

Thanks
Ranjith

@asztal
Copy link

asztal commented Oct 24, 2018

I don't think this is possible. See the below quote from MSDN (emphasis mine):

Certain DBMSs allow an application to specify the parameters to a stored procedure by name instead of by position in the procedure call. Such parameters are called named parameters. ODBC supports the use of named parameters. In ODBC, named parameters are used only in calls to stored procedures and cannot be used in other SQL statements.

https://docs.microsoft.com/en-us/sql/odbc/reference/develop-app/binding-parameters-by-name-named-parameters?view=sql-server-2017

@ranjithchev
Copy link
Author

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants