libpq
PQgetvalueã§ãæå®ã®ä½ç½®ã®å¤ãåå¾ãããhttps://www.postgresql.jp/document/8.4/html/libpq-exec.htmljè¡iåã®å¤ãåå¾ãããã¨ãããã¹ã¦ã®è¡ã¨åã§ç¹°ãè¿ãã [bg1@localhost PQgetvalue]$ vi main.c [bg1@localhost PQgetvalue]$ gcc main.c -o main â¦
PQntuplesã§ãã¿ãã«ã®æ°ãåå¾ãããhttps://www.postgresql.jp/document/8.4/html/libpq-exec.htmlå®è¡ããã¨ã [bg1@localhost PQntuples]$ vi main.c [bg1@localhost PQntuples]$ gcc main.c -o main -lpq [bg1@localhost PQntuples]$ ./main CONNECTIONâ¦
PQfnameã§ãæå®ã®ä½ç½®ã®ãã£ã¼ã«ãåãåå¾ãããhttps://www.postgresql.jp/document/8.4/html/libpq-exec.htmlPQfnameã§içªç®ã®ãã£ã¼ã«ãåãåå¾ãã¦ãã¹ãã¼ã¹ãåºåãã«ãã¦ã横ã«ä¸¦ã¹ãã [bg1@localhost PQfname]$ vi main.c [bg1@localhost PQfnamâ¦
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 CONNECâ¦
PQresultStatusã§ãPQexecã®çµæãåå¾ãããhttps://www.postgresql.jp/document/7.3/programmer/libpq-exec.html /* SQLå®è¡ */ res = PQexec(con, ""); /* PQexecã§SQLæ"SELECT * FROM user_profile;"ãå®è¡. */ type = PQresultStatus(res); /* PQresulâ¦
PQexecã¯ãæå®ããSQLæãå®è¡ãããhttps://www.postgresql.jp/document/8.4/html/libpq-exec.htmlPQexecã«conã¨SQLæãã»ãããã¦å®è¡ã PQresultStatusããPGRES_TUPLES_OKãªããæåã¨è¨ããã resã¯ãPQclearã§è§£æ¾ããå¿ è¦ããã $ vi main.c $ gcc mâ¦
PQstatusã¯ãæ¥ç¶ã®ç¶æ ãè¿ããhttps://www.postgresql.jp/document/9.3/html/libpq-status.html /* ããããã¡ã¤ã«ã®ã¤ã³ã¯ã«ã¼ã */ #include <stdio.h> /* æ¨æºå ¥åºå */ #include <libpq-fe.h> /* libpqããã³ãã¨ã³ã */ /* mainé¢æ° */ int main(void){ /* å¤æ°ã®å®£è¨ */ P</libpq-fe.h></stdio.h>â¦
libpqã§Cè¨èªããPostgreSQLã®DBã«æ¥ç¶ããã æ¥ç¶ã«ã¯ãPQconnectdbã使ããhttps://www.postgresql.jp/document/8.4/html/libpq-connect.html postgreSQLã¾ããã¤ã³ã¹ãã¼ã«ã [bg1@localhost ~]$ su ãã¹ã¯ã¼ã: [root@localhost bg1]# yum install postgâ¦