#include "pgstream.h" #include #include #include #include int main(int argc, char** argv) { const int loops=10000; pg_cnx cnx; char buf[]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; try { struct timeval tv1, tv2; if (argc < 2) { std::cerr << "Usage: " << argv[0] << " connection_string\n"; exit(1); } cnx.connect(argv[1]); for (int j=0; j<2; j++) { cnx.set_option("bind_variables", j>0); cnx.set_option("prepare_statements", j>0); { pg_trans trans(cnx); pg_stmt("CREATE TABLE txt1(pk1 int,t1 text,t2 text," "t3 text, t4 text)", cnx); gettimeofday(&tv1,NULL); pg_stream s1("INSERT INTO txt1(pk1,t1,t2,t3,t4) " "VALUES(:i,:p1,:p2,:p3,:p4)", cnx); for (int i=0; i