pantry/projects/postgresql.org/libpq/libpq.c

23 lines
397 B
C
Raw Normal View History

2023-05-07 21:07:18 +03:00
#include <stdlib.h>
#include <stdio.h>
#include <libpq-fe.h>
int main()
{
const char *conninfo;
PGconn *conn;
conninfo = "dbname = postgres";
conn = PQconnectdb(conninfo);
if (PQstatus(conn) != CONNECTION_OK) // This should always fail
{
printf("Connection to database attempted and failed");
PQfinish(conn);
exit(0);
}
return 0;
}