mirror of
https://github.com/PyMySQL/mysqlclient.git
synced 2025-08-15 19:31:54 +08:00
Horrible, stupid error
This commit is contained in:
@ -162,7 +162,7 @@ class BaseCursor:
|
||||
self.description = None
|
||||
self.rowcount = -1
|
||||
self.arraysize = 100
|
||||
self._query = ''
|
||||
self._thequery = ''
|
||||
|
||||
def close(self):
|
||||
self.connection = None
|
||||
@ -182,7 +182,7 @@ class BaseCursor:
|
||||
args -- sequence or mapping, parameters to use with query.
|
||||
rows -- rows affected, if any"""
|
||||
self._check_open()
|
||||
self._query = query
|
||||
self._thequery = query
|
||||
from types import ListType, TupleType
|
||||
from string import rfind, join, split, atoi
|
||||
qc = self.connection.quote_conv
|
||||
@ -211,7 +211,7 @@ class BaseCursor:
|
||||
|
||||
This method performs multiple-row inserts and similar queries."""
|
||||
self._check_open()
|
||||
self._query = query
|
||||
self._thequery = query
|
||||
from string import join
|
||||
m = insert_values.search(query)
|
||||
if not m: raise ProgrammingError, "can't find values"
|
||||
@ -227,7 +227,7 @@ class BaseCursor:
|
||||
raise
|
||||
qv = query[p:]
|
||||
for a in args[1:]: q.append(qv % escape(a, qc))
|
||||
return self._query(join(q, ',\n'))
|
||||
return self._thequery(join(q, ',\n'))
|
||||
|
||||
def __do_query(self, q):
|
||||
from string import split, atoi
|
||||
@ -297,7 +297,7 @@ class CursorStoreResultMixIn:
|
||||
|
||||
def fetchone(self):
|
||||
"""Fetches a single row from the cursor."""
|
||||
if not self._query: raise ProgrammingError, "execute() first"
|
||||
if not self._thequery: raise ProgrammingError, "execute() first"
|
||||
if self._pos >= len(self._rows): return None
|
||||
result = self._rows[self._pos]
|
||||
self._pos = self._pos+1
|
||||
@ -307,7 +307,7 @@ class CursorStoreResultMixIn:
|
||||
"""cursor.fetchmany(size=cursor.arraysize)
|
||||
|
||||
size -- integer, maximum number of rows to fetch."""
|
||||
if not self._query: raise ProgrammingError, "execute() first"
|
||||
if not self._thequery: raise ProgrammingError, "execute() first"
|
||||
end = self._pos + size or self.arraysize
|
||||
result = self._rows[self._pos:end]
|
||||
self._pos = end
|
||||
@ -315,7 +315,7 @@ class CursorStoreResultMixIn:
|
||||
|
||||
def fetchall(self):
|
||||
"""Fetchs all available rows from the cursor."""
|
||||
if not self._query: raise ProgrammingError, "execute() first"
|
||||
if not self._thequery: raise ProgrammingError, "execute() first"
|
||||
result = self._pos and self._rows[self._pos:] or self._rows
|
||||
self._pos = len(self._rows)
|
||||
return result
|
||||
@ -353,7 +353,7 @@ class CursorUseResultMixIn:
|
||||
def fetchone(self):
|
||||
"""Fetches a single row from the cursor."""
|
||||
self._check_open()
|
||||
if not self._query: raise ProgrammingError, "execute() first"
|
||||
if not self._thequery: raise ProgrammingError, "execute() first"
|
||||
return self._fetch_row()
|
||||
|
||||
def fetchmany(self, size=None):
|
||||
@ -361,13 +361,13 @@ class CursorUseResultMixIn:
|
||||
|
||||
size -- integer, maximum number of rows to fetch."""
|
||||
self._check_open()
|
||||
if not self._query: raise ProgrammingError, "execute() first"
|
||||
if not self._thequery: raise ProgrammingError, "execute() first"
|
||||
return self._fetch_rows(size or self.arraysize)
|
||||
|
||||
def fetchall(self):
|
||||
"""Fetchs all available rows from the cursor."""
|
||||
self._check_open()
|
||||
if not self._query: raise ProgrammingError, "execute() first"
|
||||
if not self._thequery: raise ProgrammingError, "execute() first"
|
||||
return self._fetch_all_rows()
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user