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
c8009959
Commit
c8009959
authored
Feb 21, 2000
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed psql's Control-C handling when COPY in progress
parent
fc8e6c77
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
7 deletions
+27
-7
src/bin/psql/common.c
src/bin/psql/common.c
+12
-3
src/bin/psql/copy.c
src/bin/psql/copy.c
+12
-3
src/bin/psql/copy.h
src/bin/psql/copy.h
+3
-1
No files found.
src/bin/psql/common.c
View file @
c8009959
...
...
@@ -3,7 +3,7 @@
*
* Copyright 2000 by PostgreSQL Global Development Group
*
* $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.1
6 2000/02/20 14:28:20
petere Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.1
7 2000/02/21 19:40:41
petere Exp $
*/
#include "postgres.h"
#include "common.h"
...
...
@@ -246,6 +246,11 @@ volatile bool cancel_pressed;
void
handle_sigint
(
SIGNAL_ARGS
)
{
cancel_pressed
=
true
;
if
(
copy_state
)
return
;
if
(
cancelConn
==
NULL
)
#ifndef WIN32
siglongjmp
(
main_loop_jmp
,
1
);
...
...
@@ -253,8 +258,6 @@ handle_sigint(SIGNAL_ARGS)
return
;
#endif
cancel_pressed
=
true
;
/* Try to send cancel request */
if
(
PQrequestCancel
(
cancelConn
))
write_stderr
(
"
\n
Cancel request sent
\n
"
);
...
...
@@ -297,6 +300,9 @@ PSQLexec(const char *query)
cancelConn
=
pset
.
db
;
res
=
PQexec
(
pset
.
db
,
query
);
if
(
PQresultStatus
(
res
)
==
PGRES_COPY_IN
||
PQresultStatus
(
res
)
==
PGRES_COPY_OUT
)
copy_state
=
true
;
cancelConn
=
NULL
;
if
(
PQstatus
(
pset
.
db
)
==
CONNECTION_BAD
)
...
...
@@ -388,6 +394,9 @@ SendQuery(const char *query)
cancelConn
=
pset
.
db
;
results
=
PQexec
(
pset
.
db
,
query
);
if
(
PQresultStatus
(
results
)
==
PGRES_COPY_IN
||
PQresultStatus
(
results
)
==
PGRES_COPY_OUT
)
copy_state
=
true
;
cancelConn
=
NULL
;
if
(
results
==
NULL
)
...
...
src/bin/psql/copy.c
View file @
c8009959
...
...
@@ -3,13 +3,14 @@
*
* Copyright 2000 by PostgreSQL Global Development Group
*
* $Header: /cvsroot/pgsql/src/bin/psql/copy.c,v 1.1
0 2000/02/16 13:15:26 momjian
Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/copy.c,v 1.1
1 2000/02/21 19:40:41 petere
Exp $
*/
#include "postgres.h"
#include "copy.h"
#include <errno.h>
#include <assert.h>
#include <signal.h>
#ifndef WIN32
#include <unistd.h>
/* for isatty */
#else
...
...
@@ -17,6 +18,7 @@
#endif
#include "libpq-fe.h"
#include "pqsignal.h"
#include "settings.h"
#include "common.h"
...
...
@@ -26,6 +28,8 @@
#define strcasecmp(x,y) stricmp(x,y)
#endif
bool
copy_state
;
/*
* parse_slash_copy
* -- parses \copy command line
...
...
@@ -358,7 +362,9 @@ handleCopyOut(PGconn *conn, FILE *copystream)
}
}
fflush
(
copystream
);
return
!
PQendcopy
(
conn
);
ret
=
!
PQendcopy
(
conn
);
copy_state
=
false
;
return
ret
;
}
...
...
@@ -386,6 +392,7 @@ handleCopyIn(PGconn *conn, FILE *copystream, const char *prompt)
char
*
s
;
int
bufleft
;
int
c
=
0
;
int
ret
;
if
(
prompt
)
/* disable prompt if not interactive */
{
...
...
@@ -435,5 +442,7 @@ handleCopyIn(PGconn *conn, FILE *copystream, const char *prompt)
}
PQputline
(
conn
,
"
\n
"
);
}
return
!
PQendcopy
(
conn
);
ret
=
!
PQendcopy
(
conn
);
copy_state
=
false
;
return
ret
;
}
src/bin/psql/copy.h
View file @
c8009959
...
...
@@ -3,13 +3,15 @@
*
* Copyright 2000 by PostgreSQL Global Development Group
*
* $Header: /cvsroot/pgsql/src/bin/psql/copy.h,v 1.
7 2000/02/16 13:15:26 momjian
Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/copy.h,v 1.
8 2000/02/21 19:40:42 petere
Exp $
*/
#ifndef COPY_H
#define COPY_H
#include "libpq-fe.h"
extern
bool
copy_state
;
/* handler for \copy */
bool
do_copy
(
const
char
*
args
);
...
...
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