When the NUMBER_OF_ITERATIONS variable is set to 1, everything works fine ... but when I change it to any value greater than 1, I get some problems.
First of all, in this case, when I print the value of res , I get a huge amount (for example, 18446744073709551615).
Secondly, but most importantly, in this case, the script cannot process data, because the length of the value is always 0 ...
if __name__ == '__main__':
NUMBER_OF_ITERATIONS = 2
conn = DBconnection()
for i in range( NUMBER_OF_ITERATIONS ):
cursor = conn.cursor()
res = cursor.execute( 'SELECT field
FROM table
WHERE other_field = 0
LIMIT 10 LOCK IN SHARE MODE' )
print '
values = []
for elem in cursor.fetchall():
if elem != None:
values.append( list(elem).pop() )
if len( values ) != 0:
else:
print 'NO VALUES AVAILABLE'
cursor.close()
break
conn.close()
print 'DONE'
I use the InnoDB storage engine, and at the same time, another script exists on this script
w370> python, which loads data into the same table (using the LOAD DATA INFILE clause).
, , , ( ) ? , 2 . .