Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions teradata/tdodbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@
SQLPOINTER = ctypes.c_void_p
SQLHANDLE = ctypes.c_void_p

SQLWCHAR_SIZE = ctypes.sizeof(SQLWCHAR)

ADDR = ctypes.byref
PTR = ctypes.POINTER
ERROR_BUFFER_SIZE = 2 ** 10
Expand Down Expand Up @@ -766,7 +768,7 @@ def _executeManyBatch(self, params, numParams, dataTypes):
paramArrays.append((SQLDOUBLE * paramSetSize)())
else:
maxLen += 1
valueSize = SQLLEN(ctypes.sizeof(SQLWCHAR) * maxLen)
valueSize = SQLLEN(SQLWCHAR_SIZE * maxLen)
paramArrays.append(_createBuffer(paramSetSize * maxLen))
lengthArrays.append((SQLLEN * paramSetSize)())
for paramSetNum in range(0, paramSetSize):
Expand Down Expand Up @@ -1125,7 +1127,7 @@ def _getRow(cursor, buffers, bufSizes, dataTypes, indicators, rowIndex):
elif dataType == SQL_LONGVARBINARY:
val = _getLobData(cursor, col, buf, True)
else:
chLen = (int)(bufSize / ctypes.sizeof(SQLWCHAR))
chLen = (bufSize // SQLWCHAR_SIZE)
chBuf = (SQLWCHAR * chLen)
val = _outputStr(chBuf.from_buffer(buf,
bufSize * rowIndex))
Expand Down
10 changes: 3 additions & 7 deletions teradata/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def trace(self, message, *args, **kws):
# Yes, logger takes its '*args' as 'args'.
if self.isEnabledFor(TRACE):
self._log(TRACE, message, args, **kws)

logging.TRACE = TRACE
logging.Logger.trace = trace

Expand Down Expand Up @@ -125,20 +126,15 @@ def fetchmany(self, size=None):
size = self.arraysize
self.fetchSize = size
rows = []
count = 0
for row in self:
for row, count in enumerate(self):
rows.append(row)
count += 1
if count == size:
break
return rows

def fetchall(self):
self.fetchSize = self.arraysize
rows = []
for row in self:
rows.append(row)
return rows
return list(self)

def nextset(self):
# Abstract method, defined by convention only
Expand Down