greenew / pypyodbc

Automatically exported from code.google.com/p/pypyodbc
0 stars 0 forks source link

Multiple queries with one cursor fail sporadically (does not support conversion from xtype to ytype) #68

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.Have one insert statement with some number of parameters
2.Subsequently, change the query to a different insert with different types
3.Occasionally, there will be a type mismatch based on the last insert.

What is the expected output? What do you see instead?
In my case, I was doing an insert of two nvarchars and an int, after having 
done an insert which included datetime and nothing would be output ideally.

Instead, I got an error stating that implicit conversion from smalldatetime to 
int was not possible- indicating that the last insert parameters hung around 
after they shouldn't have.

What version of the product are you using? On what operating system?
pypyodbc 1.3.3 on python 3.4.3 (Windows 7)

Please provide any additional information below.

I think I've fixed the problem in the pypyodbc code. In the prepare() function, 
at the beginning (line ~1180), I noticed that there was an old free statement 
but no new one. Where the comment
#self._free_results(FREE_STATEMENT)
was, I simply put
self._free_stmt(SQL_RESET_PARAMS).

So far, nothing wrong has happened.

Original issue reported on code.google.com by vspri...@gmail.com on 11 Jun 2015 at 4:53