I am trying to get some integer values from database (almost 30.000 rows) and it gives error "error while observer running READ-FROM-STRING in procedure GET-IMAGEDB Expected a constant." I considered it may happen because of requiring waiting time to not set a null value to variable of NetLogo and added "print" lines to delay the process. It worked for small sized datasets for instance 30.000 rows. However, when the dataset size increased to 250.000 rows, now I am getting same error again. I am not sure about reason of the error. I have also tried to get all rows from the dataset with single query and set it to NetLogo list, but still gives same error and extremely slow. I have attached the code. Thank you for any help.
let total ( (width + 1) * (height + 1) )
let counter 0
while [ counter < total ]
[ set query "select x, y, r, g, b, background from colorinfo where pixelId = \""
set query (word query counter "\"" )
let resultList (mysql:executeQuery db query)
let stringList item 0 resultList
print (word "wait 1")
let x read-from-string item 0 stringList
print (word "wait 2")
let y read-from-string item 1 stringList
let r read-from-string item 2 stringList
let g read-from-string item 3 stringList
let b read-from-string item 4 stringList
let background read-from-string item 5 stringList
ask patch (x + width + 2) ( y) [ set pcolor (list r g b) ]
print counter
set counter (counter + 1)
set stringList [ ]
set resultList [ ]
]