added onsuccess and onerror for iterating the cursor in getAll