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