17 lines
675 B
Plaintext
17 lines
675 B
Plaintext
|
BEGIN
|
||
|
FILE db;
|
||
|
STRING err;
|
||
|
STRING conninfo = "dbname=testdb user=gmgauthier password=thx1138gg host=localhost port=5432";
|
||
|
INT status = pq connect db(db, conninfo, err);
|
||
|
IF status = 0 THEN
|
||
|
print(("Connected!", newline));
|
||
|
printf (($"protocol="g (0)x"server="g (0)x"socket="g (0)x"pid="g (0)l$,
|
||
|
pq protocol version (db), pq server version (db), pq socket (db),
|
||
|
pq back end pid (db)));
|
||
|
print(("Exec: ", pq exec(db, "SELECT version()"), newline));
|
||
|
INT finish status = pq finish(db);
|
||
|
print(("Finish: ", finish status, newline))
|
||
|
ELSE
|
||
|
print(("Failed: ", err, newline))
|
||
|
FI
|
||
|
END
|