* send_subtag * Send the data of subtag, the format is: * subtag + length + data * while length is the length of data followed. */
| 3867 | * while length is the length of data followed. |
| 3868 | */ |
| 3869 | static void |
| 3870 | send_subtag(StringInfoData *buf, ExtendProtocolSubTag subtag, List *relids) |
| 3871 | { |
| 3872 | bytea *res; |
| 3873 | int rlen; |
| 3874 | char *ptr; |
| 3875 | int rcount; |
| 3876 | Oid relid; |
| 3877 | ListCell *lc; |
| 3878 | |
| 3879 | pq_sendint32(buf, subtag); /* subtag */ |
| 3880 | |
| 3881 | rcount = list_length(relids); |
| 3882 | rlen = sizeof(int)/* count of relids */ + sizeof(Oid) * rcount; |
| 3883 | |
| 3884 | pq_sendint32(buf, rlen); /* length */ |
| 3885 | |
| 3886 | res = palloc(rlen + VARHDRSZ); |
| 3887 | ptr = VARDATA(res); |
| 3888 | |
| 3889 | memcpy(ptr, &rcount, sizeof(int)); |
| 3890 | ptr += sizeof(int); |
| 3891 | |
| 3892 | foreach(lc, relids) |
| 3893 | { |
| 3894 | relid = lfirst_oid(lc); |
| 3895 | memcpy(ptr, &relid, sizeof(Oid)); |
| 3896 | ptr += sizeof(Oid); |
| 3897 | } |
| 3898 | |
| 3899 | SET_VARSIZE(res, rlen + VARHDRSZ); |
| 3900 | |
| 3901 | pq_sendbytes(buf, VARDATA(res), VARSIZE(res) - VARHDRSZ); |
| 3902 | } |
| 3903 | |
| 3904 | /* |
| 3905 | * notify_modified_relations_local |
no test coverage detected