38 "SELECT pg_catalog.set_config('search_path', '', false)");
49 main(
int argc,
char **argv)
71 fprintf(stderr,
"usage: %s tableName dbName1 dbName2\n", argv[0]);
72 fprintf(stderr,
" compares two tables in two databases\n");
99 res1 =
PQexec(conn1,
"BEGIN");
102 fprintf(stderr,
"BEGIN command failed\n");
116 res1 =
PQexec(conn1,
"DECLARE myportal CURSOR FOR select * from pg_database");
119 fprintf(stderr,
"DECLARE CURSOR command failed\n");
125 res1 =
PQexec(conn1,
"FETCH ALL in myportal");
128 fprintf(stderr,
"FETCH ALL command didn't return tuples properly\n");
135 for (
i = 0;
i < nFields;
i++)
142 for (
j = 0;
j < nFields;
j++)
150 res1 =
PQexec(conn1,
"CLOSE myportal");
154 res1 =
PQexec(conn1,
"END");
static void PGresult * res
char * PQerrorMessage(const PGconn *conn)
ConnStatusType PQstatus(const PGconn *conn)
void PQfinish(PGconn *conn)
ExecStatusType PQresultStatus(const PGresult *res)
int PQntuples(const PGresult *res)
char * PQfname(const PGresult *res, int field_num)
PGresult * PQexec(PGconn *conn, const char *query)
char * PQgetvalue(const PGresult *res, int tup_num, int field_num)
int PQnfields(const PGresult *res)
#define PQsetdb(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME)
static const char * pghost
static const char * pgport
static const char * dbName
int main(int argc, char **argv)
static void exit_nicely(PGconn *conn1, PGconn *conn2)
static void check_prepare_conn(PGconn *conn, const char *dbName)