Postgresql Cursor Fetch Loop Example In C