PQnfieldsで、フィールドの数を取得する。
https://www.postgresql.jp/document/8.4/html/libpq-exec.html
実行すると、
[bg1@localhost PQnfields]$ vi main.c [bg1@localhost PQnfields]$ gcc main.c -o main -lpq [bg1@localhost PQnfields]$ ./main CONNECTION_OK PGRES_TUPLES_OK field_count = 3 [bg1@localhost PQnfields]$
フィールドの数は3であることがわかる。
Sample/libpq/PQnfields/PQnfields/src/PQnfields at master · bg1bgst333/Sample · GitHub