-
Notifications
You must be signed in to change notification settings - Fork 511
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
'?' always replaced as parameter (even in string literals and comments) #13
Comments
I shall extend the parseParams to scan the SQL statement and replace the ? only in the appropriate state i.e. not in comments, strings and identifiers. |
Underlying protocol only supports "at" prefixed parameter names, support for question marks is supported by client library, freetds does exactly this. |
Thanks for the comments and patch! This makes sense. |
It makes sense to have positional positional parameters, :1, :2 like Oracle or $1, $2 like PostgreSQL. |
replace ? only in the correct context, resolves issue #13
postgres driver should wait for lock
update azidentity to 0.13.1
Thanks for all of the work @denisenkom and @dimdin. It is exciting how quickly go-mssqldb is maturing. I am a bit concerned with change 0a8a8cf that uses '?' for parameters. I'm interested in both your thoughts about the best way to proceed.
It looks like if go-mssqldb uses '?' the library will need to parse the query and replace '?' with @px (where X is the integer field number). However, parsing the query in the client side library seems error prone to get all of the cases correct (eg: string literals, comments, etc). We could definitely improve the implementation of parseParams() to handle these cases, however it seems like it might be better to avoid parsing the query all together client side (if possible).
The plus side is that '?' does seem like the standard character to use for MS SQL so I like the change from this perspective.
Does anyone know how other mssql client libraries are doing this? I know nothing about TDS so I'm not sure of the limitations we are facing at the protocol level.
Thoughts?
The text was updated successfully, but these errors were encountered: