Closed Ironlenny closed 8 years ago
self.cursor.fetchall()
print((tuple(self.cursor.fetchall()))) # debug
The first fetchall()
consumes all records, the cursor will be positioned at the end of result set, so there are no more records to fetch. Can't repeat fetchall()
.
for i in query:
args.append((1, wgdb.COND_EQUAL, i))
This is not wrong, but it could easily generate a query like "where x = 1 and x = 2" which will always have an empty set as a result. Just a heads up.
Thank you. I wasn't aware fetchall() placed the cursor at the end of the set, but that does make sense in hindsight. And thanks for the heads up about my query builder. I'm going to have to fix that.
Here's the funtion:
Here's my test:
This is the output: