Permalink
Browse files

Issue 86: getinfo reading into wrong data type.

Was using PyArg_ParseTuple to read a long into a SQLUSMALLINT, which is completely wrong.
Changed dadta type to unsigned long then cast as necessary later.
  • Loading branch information...
Michael Kleehammer authored and mkleehammer committed Aug 30, 2010
1 parent 2e8398f commit 740b67e4ca1cbe5d9a52b37dce0b839c0e4caabd
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/connection.cpp
View
@@ -530,8 +530,8 @@ Connection_getinfo(PyObject* self, PyObject* args)
if (!cnxn)
return 0;
- SQLUSMALLINT infotype;
- if (!PyArg_ParseTuple(args, "l", &infotype))
+ unsigned long infotype;
+ if (!PyArg_ParseTuple(args, "k", &infotype))
return 0;
unsigned int i = 0;
@@ -549,7 +549,7 @@ Connection_getinfo(PyObject* self, PyObject* args)
SQLRETURN ret;
Py_BEGIN_ALLOW_THREADS
- ret = SQLGetInfo(cnxn->hdbc, infotype, szBuffer, sizeof(szBuffer), &cch);
+ ret = SQLGetInfo(cnxn->hdbc, (SQLUSMALLINT)infotype, szBuffer, sizeof(szBuffer), &cch);
Py_END_ALLOW_THREADS
if (!SQL_SUCCEEDED(ret))
{

0 comments on commit 740b67e

Please sign in to comment.