alexbrainman / odbc

odbc driver written in go
BSD 3-Clause "New" or "Revised" License
359 stars 141 forks source link

SQLDescribeParam Errors #19

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Execute a merge statement like the following on Windows using SQL Server 
2008:
merge tblName
using (select ? as Id, ? as Name) as source
ON tblName.Id = source.Id
WHEN MATCHED THEN
update tblName.Name = source.Name
WHEN NOT MATCHED BY TARGET THEN
insert (name) into tblName(source.Name);

What is the expected output? What do you see instead?
Expected - the SQL statement execute correctly
Actual - DIAG [07009] [Microsoft][SQL Server Native Client 11.0]Invalid 
Descriptor Index (0) 

In this case, the call to SQLNumParams correctly returns 2 but it appears that 
SQLDescribeParam does not work to describe all parameters.  See 
http://msdn.microsoft.com/en-us/library/ms709448.aspx

If I make a change to ExtractParameters to ignore errors returned by 
SQLDescribeParam then the merge statement works correctly.  I think this 
work-around should work because SQLDescribeParam is not even implemented by 
freedts.

Original issue reported on code.google.com by lukemaul...@gmail.com on 28 Aug 2013 at 3:32

GoogleCodeExporter commented 9 years ago
I agree, I think solution will be similar to Issue 14. I will try and fix them 
together.

Alex

Original comment by alex.bra...@gmail.com on 30 Aug 2013 at 6:34

GoogleCodeExporter commented 9 years ago
Please, review https://codereview.appspot.com/13454045/

Alex

Original comment by alex.bra...@gmail.com on 5 Sep 2013 at 5:48

GoogleCodeExporter commented 9 years ago
This issue was closed by revision d64013ec9967.

Original comment by alex.bra...@gmail.com on 13 Sep 2013 at 2:09