Hi All,
I’m not sure if this is the actual place for this but I guess I can start here. The question I have is, I’ve created a composite type like this:
CREATE TYPE myxml AS { encoding_ int4, xml_ xml };
In my client-side C code I am using PQgetvalue to pull in the data from the row/column. However, since it is a composite type, it is unclear to me how to get the individual members from the data. I have googled but I probably just am not googling the correct term because I cannot find any examples of this being done anywhere. A hex dump of the data gives me this:
0x0000000200000017000000046f0100000000008e000001433c637573746f6d6572696e666f20786d6c6e733d22687474703a2f2f6c7a6c6162732e637573742e636f6d22204369643d22543130303130303031223e3c6e616d653e5461626c6520584d4c…
I can tell that the green portion is my endcoding_ value and the blue section is the xml_ data.
My best guess right now is:
- 0x2 is the number of members
- 0x4 and 0x143 are the lengths of the individual members
- 0x17 and 0x8e are the OID for the member type
Is this the proper layout of these composite types? Can I go ahead and use this without possibly having it broken in the future? Are there any existing supported APIs that I can use instead to get this information?
Regards
G