* PQnotifies * returns a PGnotify* structure of the latest async notification * that has not yet been handled * * returns NULL, if there is currently * no unhandled async notification from the backend * * the CALLER is responsible for FREE'ing the structure returned * * Note that this function does not read any new data from the socket; * so usually, caller should call PQconsumeInput()
| 2552 | * so usually, caller should call PQconsumeInput() first. |
| 2553 | */ |
| 2554 | PGnotify * |
| 2555 | PQnotifies(PGconn *conn) |
| 2556 | { |
| 2557 | PGnotify *event; |
| 2558 | |
| 2559 | if (!conn) |
| 2560 | return NULL; |
| 2561 | |
| 2562 | /* Parse any available data to see if we can extract NOTIFY messages. */ |
| 2563 | parseInput(conn); |
| 2564 | |
| 2565 | event = conn->notifyHead; |
| 2566 | if (event) |
| 2567 | { |
| 2568 | conn->notifyHead = event->next; |
| 2569 | if (!conn->notifyHead) |
| 2570 | conn->notifyTail = NULL; |
| 2571 | event->next = NULL; /* don't let app see the internal state */ |
| 2572 | } |
| 2573 | return event; |
| 2574 | } |
| 2575 | |
| 2576 | /* |
| 2577 | * PQputCopyData - send some data to the backend during COPY IN or COPY BOTH |