Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Showing with 8 additions and 12 deletions.
  1. +8 −12 src/getdata.cpp
View
20 src/getdata.cpp
@@ -462,12 +462,12 @@ static PyObject* GetDataDecimal(Cursor* cur, Py_ssize_t iCol)
// TODO: Is Unicode a good idea for Python 2.7? We need to know which drivers support Unicode.
- SQLWCHAR buffer[100];
+ SQLCHAR buffer[100];
SQLLEN cbFetched = 0; // Note: will not include the NULL terminator.
SQLRETURN ret;
Py_BEGIN_ALLOW_THREADS
- ret = SQLGetData(cur->hstmt, (SQLUSMALLINT)(iCol+1), SQL_C_WCHAR, buffer, sizeof(buffer), &cbFetched);
+ ret = SQLGetData(cur->hstmt, (SQLSMALLINT)(iCol+1), SQL_C_CHAR, buffer, sizeof(buffer), &cbFetched);
Py_END_ALLOW_THREADS
if (!SQL_SUCCEEDED(ret))
return RaiseErrorFromHandle("SQLGetData", cur->cnxn->hdbc, cur->hstmt);
@@ -477,9 +477,9 @@ static PyObject* GetDataDecimal(Cursor* cur, Py_ssize_t iCol)
// Remove non-digits and convert the databases decimal to a '.' (required by decimal ctor).
//
- // We are assuming that the decimal point and digits fit within the size of SQLWCHAR.
+ // We are assuming that the decimal point and digits fit within the size of SQLCHAR.
- int cch = (int)(cbFetched / sizeof(SQLWCHAR));
+ int cch = (int)(cbFetched / sizeof(SQLCHAR));
for (int i = (cch - 1); i >= 0; i--)
{
@@ -490,18 +490,14 @@ static PyObject* GetDataDecimal(Cursor* cur, Py_ssize_t iCol)
}
else if ((buffer[i] < '0' || buffer[i] > '9') && buffer[i] != '-')
{
- memmove(&buffer[i], &buffer[i] + 1, (cch - i) * sizeof(SQLWCHAR));
+ memmove(&buffer[i], &buffer[i] + 1, (cch - i) * sizeof(SQLCHAR));
cch--;
}
}
I(buffer[cch] == 0);
- Object str(PyUnicode_FromSQLWCHAR(buffer, cch));
- if (!str)
- return 0;
-
- return PyObject_CallFunction(decimal_type, "O", str.Get());
+ return PyObject_CallFunction(decimal_type, "s", buffer);
}
@@ -559,7 +555,7 @@ static PyObject* GetDataLongLong(Cursor* cur, Py_ssize_t iCol)
ColumnInfo* pinfo = &cur->colinfos[iCol];
SQLSMALLINT nCType = pinfo->is_unsigned ? SQL_C_UBIGINT : SQL_C_SBIGINT;
- SQLBIGINT value;
+ PY_LONG_LONG value;
SQLLEN cbFetched;
SQLRETURN ret;
@@ -574,7 +570,7 @@ static PyObject* GetDataLongLong(Cursor* cur, Py_ssize_t iCol)
Py_RETURN_NONE;
if (pinfo->is_unsigned)
- return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)(SQLUBIGINT)value);
+ return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)value);
return PyLong_FromLongLong((PY_LONG_LONG)value);
}

No commit comments for this range

Something went wrong with that request. Please try again.