Open GoogleCodeExporter opened 9 years ago
The fix will be in 2 parts. The first, which has been tested by Joe, is to:
* Only call SQLDescribeParam for a parameter when None is passed. All other
types
are determined from the pyodbc data type.
* Cache this information with the prepared statement. If the same SQL
statement is
used repeatedly, we will never call more than once per parameter.
The second part of the fix is to cache this information for more than just the
last
statement. Instead, I'll keep an internal dictionary of the last 10, 20, etc.
statements and anything we know about them. I'll have to make a method to
change the
dictionary size and to flush it.
Original comment by mkleehammer
on 29 Dec 2008 at 4:40
Are you actively working on this? I'm looking for a project to learn python on
c-level and I've been playing with pyodbc a couple of days. I was thinking:
- create a hashtable with hashes for each statement, both for fast lookup and
to prevent sql-code hanging around in-memory
- instead of caching N statements, to cache all statements, add a 'lastused'
ticker and flush statements that were not re-used for x seconds, optionally
settable by user (where x=0 means no cache)
I'd not be fast, thinking in term of months go get this right.
Original comment by rbrt8...@gmail.com
on 28 Nov 2010 at 11:42
How about adding a way to specify the types manually, for example, by exposing
them as classes? Something like this: cursor.execute('select Helloworld = ?',
pyodbc.types.Binary(None))
Original comment by sad.n...@gmail.com
on 6 Feb 2011 at 4:17
Another benefit of specifying types manually is that pyodbc could then work
better with ODBC drivers which do not implement SQLDescribeParam, eg FreeTDS.
Original comment by lukedell...@gmail.com
on 7 Feb 2011 at 4:01
Yes, and in addition to that, there are databases which do not implement
SQLDescribeParam as well, for example, Sybase.
Original comment by sad.n...@gmail.com
on 13 Feb 2011 at 9:34
Original issue reported on code.google.com by
mkleehammer
on 29 Dec 2008 at 4:37