Advertisement
salahzar

libpq

May 18th, 2017
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.37 KB | None | 0 0
  1. PGconn *conn = PQconnectdb("postgresql://sa:test@localhost:5435/test");
  2.  
  3.     for(i=0; i<ITERATIONS;i++){
  4.         char buf[1024];
  5.         sprintf(buf,"INSERT INTO TEST(ID,NAME,FIELD,F2) VALUES(NEXTVAL('RESTART'),'%s','%d','%d')", name,i,i);
  6.         if (execCommand(conn, buf) != 0) {
  7.             printf("Command not executed\n");
  8.             exit(0);
  9.         }
  10.  
  11.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement