@@ -30,8 +30,8 @@ static PGresult *res = NULL;
3030
3131static int on_error_state = ON_ERROR_STOP ;
3232
33- static in_result_block = FALSE;
34- static was_get_unset_result = FALSE;
33+ static int in_result_block = FALSE;
34+ static int was_get_unset_result = FALSE;
3535
3636/* LOCAL VARIABLES */
3737static int tuple ;
@@ -214,6 +214,7 @@ get_result()
214214was_get_unset_result = TRUE;
215215
216216/* we have to store the fetch location somewhere */
217+ /* XXX THIS IS A NO-NO */
217218cmdstatus [0 ]= NUL ;
218219memcpy (& cmdstatus [1 ],& tuple ,sizeof (tuple ));
219220
@@ -235,13 +236,16 @@ set_result(PGresult *newres)
235236halt ("set_result called with null result pointer\n" );
236237
237238if (res != NULL && was_get_unset_result == FALSE)
239+ {
238240if (in_result_block == FALSE)
239241PQclear (res );
240242else
241243{
244+ /* XXX THIS IS A NO-NO */
242245cmdstatus [0 ]= NUL ;
243246memcpy (& cmdstatus [1 ],& tuple ,sizeof (tuple ));
244247}
248+ }
245249
246250in_result_block = TRUE;
247251was_get_unset_result = FALSE;
@@ -270,6 +274,8 @@ unset_result(PGresult *oldres)
270274halt ("Unset of result without being set.\n" );
271275
272276was_get_unset_result = TRUE;
277+
278+ /* XXX THIS IS A NO-NO */
273279cmdstatus [0 ]= NUL ;
274280memcpy (& cmdstatus [1 ],& tuple ,sizeof (tuple ));
275281in_result_block = FALSE;