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

tests fail with SQL Server Native Client 11.0 #4

Closed
GoogleCodeExporter opened this issue Jun 15, 2015 · 4 comments
Closed

tests fail with SQL Server Native Client 11.0 #4

GoogleCodeExporter opened this issue Jun 15, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

... testing with the "msdriver" option of "SQL Server Native Client 11.0" and 
one of the existing tests is failing:
mssql_test.go:530: test "select cast('abc' as varchar(max))" failed: expect 
"abc", but got "\x00\x00\x00"
panic: runtime error: slice bounds out of range [recovered]
        panic: runtime error: slice bounds out of range

It is throwing the panic on column/odbc:217.  If I test with "msdriver" option 
of "SQL Server" then I do not get the error.  Do you want me to try to look 
into it before I submit the code change for review again?  Do you know what 
might be causing it?


Luke

Original issue reported on code.google.com by alex.bra...@gmail.com on 25 Apr 2013 at 1:04

@GoogleCodeExporter
Copy link
Author

It looks like the SQL Server Native Client 11.0 API returns a type of 
SQL_VARCHAR for varchar(max) columns but returns a special length of 0.  I 
think the fix is to check for length of 0 and if so, treat it as a non-bindable 
column.

Original comment by lukemaul...@gmail.com on 26 Apr 2013 at 1:01

@GoogleCodeExporter
Copy link
Author

lukemauldin,

Sounds like a plan. Would you like to send the fix? If not, I will fix it 
myself eventually.

Alex

Original comment by alex.bra...@gmail.com on 26 Apr 2013 at 2:50

@GoogleCodeExporter
Copy link
Author

Here https://codereview.appspot.com/9009043/ is a fix as you suggested. Please, 
review it. I will wait for your CL 8751045 to be submitted first.

Alex

Original comment by alex.bra...@gmail.com on 29 Apr 2013 at 4:22

  • Changed state: Started

@GoogleCodeExporter
Copy link
Author

This issue was closed by revision 3a97962d9419.

Original comment by alex.bra...@gmail.com on 1 May 2013 at 7:58

  • Changed state: Fixed

popeliv pushed a commit to popeliv/odbc that referenced this issue Jul 18, 2024
As per the [specifications](https://pkg.go.dev/database/sql/driver#QueryerContext),
`QueryerContext` is an optional interface.
When it's not implemented, the driver falls back to the `Queryer` interface
that is also optional, and eventually defaults to:
  - preparing a query
  - executing the statement
  - closing the statement

This means that the context passed to `QueryContext` gets completely ignored
and therefore timeouts aren't honoured.

This commit provides an implementation of the `QueryerContext` interface
that honours the context. When the context expires or gets cancelled,
the statement gets cancelled and closed, and upon completion,
an error is returned.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant