adding quick cache lookup to SQL cursor statements