Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
8bbfa166
Commit
8bbfa166
authored
Oct 01, 2004
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't assume PQdb() will return a valid result from a failed connection.
parent
bbd1e1cc
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
20 deletions
+20
-20
doc/src/sgml/libpq.sgml
doc/src/sgml/libpq.sgml
+7
-7
src/test/examples/testlibpq.c
src/test/examples/testlibpq.c
+2
-2
src/test/examples/testlibpq2.c
src/test/examples/testlibpq2.c
+2
-2
src/test/examples/testlibpq3.c
src/test/examples/testlibpq3.c
+2
-2
src/test/examples/testlibpq4.c
src/test/examples/testlibpq4.c
+3
-3
src/test/examples/testlo.c
src/test/examples/testlo.c
+4
-4
No files found.
doc/src/sgml/libpq.sgml
View file @
8bbfa166
<!--
<!--
$PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.16
4 2004/09/26 22:51:49
tgl Exp $
$PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.16
5 2004/10/01 17:34:17
tgl Exp $
-->
-->
<chapter id="libpq">
<chapter id="libpq">
...
@@ -3979,8 +3979,8 @@ main(int argc, char **argv)
...
@@ -3979,8 +3979,8 @@ main(int argc, char **argv)
/* Check to see that the backend connection was successfully made */
/* Check to see that the backend connection was successfully made */
if (PQstatus(conn) != CONNECTION_OK)
if (PQstatus(conn) != CONNECTION_OK)
{
{
fprintf(stderr, "Connection to database
'%s' failed.\n", PQdb(conn));
fprintf(stderr, "Connection to database
failed: %s",
fprintf(stderr, "%s",
PQerrorMessage(conn));
PQerrorMessage(conn));
exit_nicely(conn);
exit_nicely(conn);
}
}
...
@@ -4125,8 +4125,8 @@ main(int argc, char **argv)
...
@@ -4125,8 +4125,8 @@ main(int argc, char **argv)
/* Check to see that the backend connection was successfully made */
/* Check to see that the backend connection was successfully made */
if (PQstatus(conn) != CONNECTION_OK)
if (PQstatus(conn) != CONNECTION_OK)
{
{
fprintf(stderr, "Connection to database
'%s' failed.\n", PQdb(conn));
fprintf(stderr, "Connection to database
failed: %s",
fprintf(stderr, "%s",
PQerrorMessage(conn));
PQerrorMessage(conn));
exit_nicely(conn);
exit_nicely(conn);
}
}
...
@@ -4267,8 +4267,8 @@ main(int argc, char **argv)
...
@@ -4267,8 +4267,8 @@ main(int argc, char **argv)
/* Check to see that the backend connection was successfully made */
/* Check to see that the backend connection was successfully made */
if (PQstatus(conn) != CONNECTION_OK)
if (PQstatus(conn) != CONNECTION_OK)
{
{
fprintf(stderr, "Connection to database
'%s' failed.\n", PQdb(conn));
fprintf(stderr, "Connection to database
failed: %s",
fprintf(stderr, "%s",
PQerrorMessage(conn));
PQerrorMessage(conn));
exit_nicely(conn);
exit_nicely(conn);
}
}
...
...
src/test/examples/testlibpq.c
View file @
8bbfa166
...
@@ -41,8 +41,8 @@ main(int argc, char **argv)
...
@@ -41,8 +41,8 @@ main(int argc, char **argv)
/* Check to see that the backend connection was successfully made */
/* Check to see that the backend connection was successfully made */
if
(
PQstatus
(
conn
)
!=
CONNECTION_OK
)
if
(
PQstatus
(
conn
)
!=
CONNECTION_OK
)
{
{
fprintf
(
stderr
,
"Connection to database
'%s' failed.
\n
"
,
PQdb
(
conn
));
fprintf
(
stderr
,
"Connection to database
failed: %s"
,
fprintf
(
stderr
,
"%s"
,
PQerrorMessage
(
conn
));
PQerrorMessage
(
conn
));
exit_nicely
(
conn
);
exit_nicely
(
conn
);
}
}
...
...
src/test/examples/testlibpq2.c
View file @
8bbfa166
...
@@ -61,8 +61,8 @@ main(int argc, char **argv)
...
@@ -61,8 +61,8 @@ main(int argc, char **argv)
/* Check to see that the backend connection was successfully made */
/* Check to see that the backend connection was successfully made */
if
(
PQstatus
(
conn
)
!=
CONNECTION_OK
)
if
(
PQstatus
(
conn
)
!=
CONNECTION_OK
)
{
{
fprintf
(
stderr
,
"Connection to database
'%s' failed.
\n
"
,
PQdb
(
conn
));
fprintf
(
stderr
,
"Connection to database
failed: %s"
,
fprintf
(
stderr
,
"%s"
,
PQerrorMessage
(
conn
));
PQerrorMessage
(
conn
));
exit_nicely
(
conn
);
exit_nicely
(
conn
);
}
}
...
...
src/test/examples/testlibpq3.c
View file @
8bbfa166
...
@@ -66,8 +66,8 @@ main(int argc, char **argv)
...
@@ -66,8 +66,8 @@ main(int argc, char **argv)
/* Check to see that the backend connection was successfully made */
/* Check to see that the backend connection was successfully made */
if
(
PQstatus
(
conn
)
!=
CONNECTION_OK
)
if
(
PQstatus
(
conn
)
!=
CONNECTION_OK
)
{
{
fprintf
(
stderr
,
"Connection to database
'%s' failed.
\n
"
,
PQdb
(
conn
));
fprintf
(
stderr
,
"Connection to database
failed: %s"
,
fprintf
(
stderr
,
"%s"
,
PQerrorMessage
(
conn
));
PQerrorMessage
(
conn
));
exit_nicely
(
conn
);
exit_nicely
(
conn
);
}
}
...
...
src/test/examples/testlibpq4.c
View file @
8bbfa166
...
@@ -22,10 +22,10 @@ static void
...
@@ -22,10 +22,10 @@ static void
check_conn
(
PGconn
*
conn
,
const
char
*
dbName
)
check_conn
(
PGconn
*
conn
,
const
char
*
dbName
)
{
{
/* check to see that the backend connection was successfully made */
/* check to see that the backend connection was successfully made */
if
(
PQstatus
(
conn
)
==
CONNECTION_BAD
)
if
(
PQstatus
(
conn
)
!=
CONNECTION_OK
)
{
{
fprintf
(
stderr
,
"Connection to database
'%s' failed.
\n
"
,
dbName
);
fprintf
(
stderr
,
"Connection to database
\"
%s
\"
failed: %s"
,
fprintf
(
stderr
,
"%s"
,
PQerrorMessage
(
conn
));
dbName
,
PQerrorMessage
(
conn
));
exit
(
1
);
exit
(
1
);
}
}
}
}
...
...
src/test/examples/testlo.c
View file @
8bbfa166
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/test/examples/testlo.c,v 1.2
3 2004/09/22 05:12:45 neilc
Exp $
* $PostgreSQL: pgsql/src/test/examples/testlo.c,v 1.2
4 2004/10/01 17:34:19 tgl
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -225,10 +225,10 @@ main(int argc, char **argv)
...
@@ -225,10 +225,10 @@ main(int argc, char **argv)
conn
=
PQsetdb
(
NULL
,
NULL
,
NULL
,
NULL
,
database
);
conn
=
PQsetdb
(
NULL
,
NULL
,
NULL
,
NULL
,
database
);
/* check to see that the backend connection was successfully made */
/* check to see that the backend connection was successfully made */
if
(
PQstatus
(
conn
)
==
CONNECTION_BAD
)
if
(
PQstatus
(
conn
)
!=
CONNECTION_OK
)
{
{
fprintf
(
stderr
,
"Connection to database
'%s' failed.
\n
"
,
database
);
fprintf
(
stderr
,
"Connection to database
failed: %s"
,
fprintf
(
stderr
,
"%s"
,
PQerrorMessage
(
conn
));
PQerrorMessage
(
conn
));
exit_nicely
(
conn
);
exit_nicely
(
conn
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment