1
1
.\" This is -*-nroff-*-
2
2
.\" XXX standard disclaimer belongs here....
3
- .\" $Header: /cvsroot/pgsql/src/man/Attic/libpq.3,v 1.25 1998/10/14 05:31:50 momjian Exp $
3
+ .\" $Header: /cvsroot/pgsql/src/man/Attic/libpq.3,v 1.26 1999/04/17 17:18:41 momjian Exp $
4
4
.TH LIBPQ INTRO 08/08/98 PostgreSQL PostgreSQL
5
5
.SH DESCRIPTION
6
6
Current documentation for this topic is available in the new Programmer's Guide
@@ -975,7 +975,7 @@ main()
975
975
976
976
/* start a transaction block */
977
977
res = PQexec(conn, "BEGIN");
978
- if (PQresultStatus(res) != PGRES_COMMAND_OK)
978
+ if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
979
979
{
980
980
fprintf(stderr, "BEGIN command failed\\n " );
981
981
PQclear(res);
@@ -993,7 +993,7 @@ main()
993
993
* databases
994
994
*/
995
995
res = PQexec(conn, "DECLARE mycursor CURSOR FOR select * from pg_database");
996
- if (PQresultStatus(res) != PGRES_COMMAND_OK)
996
+ if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
997
997
{
998
998
fprintf(stderr, "DECLARE CURSOR command failed\\n " );
999
999
PQclear(res);
@@ -1002,7 +1002,7 @@ main()
1002
1002
PQclear(res);
1003
1003
1004
1004
res = PQexec(conn, "FETCH ALL in mycursor");
1005
- if (PQresultStatus(res) != PGRES_TUPLES_OK)
1005
+ if (!res || PQresultStatus(res) != PGRES_TUPLES_OK)
1006
1006
{
1007
1007
fprintf(stderr, "FETCH ALL command didn't return tuples properly\\n " );
1008
1008
PQclear(res);
@@ -1115,7 +1115,7 @@ main()
1115
1115
}
1116
1116
1117
1117
res = PQexec(conn, "LISTEN TBL2");
1118
- if (PQresultStatus(res) != PGRES_COMMAND_OK)
1118
+ if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
1119
1119
{
1120
1120
fprintf(stderr, "LISTEN command failed\\n " );
1121
1121
PQclear(res);
@@ -1239,7 +1239,7 @@ main()
1239
1239
1240
1240
/* start a transaction block */
1241
1241
res = PQexec(conn, "BEGIN");
1242
- if (PQresultStatus(res) != PGRES_COMMAND_OK)
1242
+ if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
1243
1243
{
1244
1244
fprintf(stderr, "BEGIN command failed\\n " );
1245
1245
PQclear(res);
@@ -1257,7 +1257,7 @@ main()
1257
1257
* databases
1258
1258
*/
1259
1259
res = PQexec(conn, "DECLARE mycursor BINARY CURSOR FOR select * from test1");
1260
- if (PQresultStatus(res) != PGRES_COMMAND_OK)
1260
+ if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
1261
1261
{
1262
1262
fprintf(stderr, "DECLARE CURSOR command failed\\n " );
1263
1263
PQclear(res);
@@ -1266,7 +1266,7 @@ main()
1266
1266
PQclear(res);
1267
1267
1268
1268
res = PQexec(conn, "FETCH ALL in mycursor");
1269
- if (PQresultStatus(res) != PGRES_TUPLES_OK)
1269
+ if (!res || PQresultStatus(res) != PGRES_TUPLES_OK)
1270
1270
{
1271
1271
fprintf(stderr, "FETCH ALL command didn't return tuples properly\\n " );
1272
1272
PQclear(res);
0 commit comments