Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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...
commit 740b67e4ca1cbe5d9a52b37dce0b839c0e4caabd 1 parent 2e8398f
Michael Kleehammer authored committed
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/connection.cpp
View
6 src/connection.cpp
@@ -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))
{
Please sign in to comment.
Something went wrong with that request. Please try again.