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
f03b75e4
Commit
f03b75e4
authored
Sep 16, 1997
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed un-needed signal suff from pginterface.
parent
604ce32e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
0 additions
and
57 deletions
+0
-57
contrib/pginterface/README
contrib/pginterface/README
+0
-8
contrib/pginterface/pginsert.c
contrib/pginterface/pginsert.c
+0
-2
contrib/pginterface/pginterface.c
contrib/pginterface/pginterface.c
+0
-43
contrib/pginterface/pgnulltest.c
contrib/pginterface/pgnulltest.c
+0
-2
contrib/pginterface/pgwordcount.c
contrib/pginterface/pgwordcount.c
+0
-2
No files found.
contrib/pginterface/README
View file @
f03b75e4
...
...
@@ -22,14 +22,6 @@ useful if you are running the query engine on a system with a different
architecture than the database server. If you pass a NULL pointer, the
column is skipped, and you can use libpq to handle it as you wish.
I have used sigprocmask() to block the reception of certain signals
while the program is executing SQL queries. This prevents a user
pressing Control-C from stopping all the back ends. It blocks SIGHUP,
SIGINT, and SIGTERM, but does not block SIGQUIT or obviously kill -9.
If your platform does not support sigprocmask(), you can remove those
function calls. ( Am I correct that abnormal termination can cause
shared memory resynchronization?)
There is a demo program called pginsert that demonstrates how the
library can be used.
...
...
contrib/pginterface/pginsert.c
View file @
f03b75e4
...
...
@@ -4,8 +4,6 @@
*/
#include <stdio.h>
#include <signal.h>
#include <time.h>
#include <libpq-fe.h>
#include "halt.h"
#include "pginterface.h"
...
...
contrib/pginterface/pginterface.c
View file @
f03b75e4
...
...
@@ -4,7 +4,6 @@
*/
#include <stdio.h>
#include <signal.h>
#include <string.h>
#include <stdarg.h>
...
...
@@ -12,9 +11,6 @@
#include "halt.h"
#include "pginterface.h"
static
void
sig_disconnect
();
static
void
set_signals
();
#define NUL '\0'
/* GLOBAL VARIABLES */
...
...
@@ -27,8 +23,6 @@ static PGresult *res = NULL;
static
int
on_error_state
=
ON_ERROR_STOP
;
/* LOCAL VARIABLES */
static
sigset_t
block_sigs
,
unblock_sigs
;
static
int
tuple
;
/*
...
...
@@ -48,7 +42,6 @@ connectdb(char *dbName,
if
(
PQstatus
(
conn
)
==
CONNECTION_BAD
)
halt
(
"Connection to database '%s' failed.
\n
%s
\n
"
,
dbName
,
PQerrorMessage
(
conn
));
set_signals
();
return
conn
;
}
...
...
@@ -74,9 +67,7 @@ doquery(char *query)
if
(
res
!=
NULL
)
PQclear
(
res
);
sigprocmask
(
SIG_SETMASK
,
&
block_sigs
,
NULL
);
res
=
PQexec
(
conn
,
query
);
sigprocmask
(
SIG_SETMASK
,
&
unblock_sigs
,
NULL
);
if
(
on_error_state
==
ON_ERROR_STOP
&&
(
res
==
NULL
||
...
...
@@ -196,37 +187,3 @@ on_error_continue()
{
on_error_state
=
ON_ERROR_CONTINUE
;
}
/*
**
** sig_disconnect
**
*/
static
void
sig_disconnect
()
{
fprintf
(
stderr
,
"exiting...
\n
"
);
PQfinish
(
conn
);
exit
(
1
);
}
/*
**
** set_signals
**
*/
static
void
set_signals
()
{
sigemptyset
(
&
block_sigs
);
sigemptyset
(
&
unblock_sigs
);
sigaddset
(
&
block_sigs
,
SIGTERM
);
sigaddset
(
&
block_sigs
,
SIGHUP
);
sigaddset
(
&
block_sigs
,
SIGINT
);
/* sigaddset(&block_sigs,SIGQUIT); no block */
sigprocmask
(
SIG_SETMASK
,
&
unblock_sigs
,
NULL
);
signal
(
SIGTERM
,
sig_disconnect
);
signal
(
SIGHUP
,
sig_disconnect
);
signal
(
SIGINT
,
sig_disconnect
);
signal
(
SIGQUIT
,
sig_disconnect
);
}
contrib/pginterface/pgnulltest.c
View file @
f03b75e4
...
...
@@ -6,8 +6,6 @@
#define TEST_NON_NULLS
#include <stdio.h>
#include <signal.h>
#include <time.h>
#include <halt.h>
#include <libpq-fe.h>
#include <pginterface.h>
...
...
contrib/pginterface/pgwordcount.c
View file @
f03b75e4
...
...
@@ -4,8 +4,6 @@
*/
#include <stdio.h>
#include <signal.h>
#include <time.h>
#include "halt.h"
#include <libpq-fe.h>
#include "pginterface.h"
...
...
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