mirror of
https://github.com/ivabus/pantry
synced 2024-11-10 10:35:17 +03:00
23 lines
397 B
C
23 lines
397 B
C
|
#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;
|
||
|
}
|