It is important to note that this function acts more as a counter of the number of rows fetched from the cursor. If you execute this prior to processing the cursor you will always get a 0 for an answer.
prova a fetchare il risultato prima.