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
d4dbfdb4
Commit
d4dbfdb4
authored
Dec 28, 1996
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch for copy from stdin.
parent
15526ff0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
28 deletions
+24
-28
src/interfaces/libpq/fe-exec.c
src/interfaces/libpq/fe-exec.c
+24
-28
No files found.
src/interfaces/libpq/fe-exec.c
View file @
d4dbfdb4
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.2
4 1996/12/26 22:08:21
momjian Exp $
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.2
5 1996/12/28 01:57:13
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -370,8 +370,9 @@ PQexec(PGconn* conn, const char* query)
...
@@ -370,8 +370,9 @@ PQexec(PGconn* conn, const char* query)
char
pname
[
MAX_MESSAGE_LEN
];
/* portal name */
char
pname
[
MAX_MESSAGE_LEN
];
/* portal name */
PGnotify
*
newNotify
;
PGnotify
*
newNotify
;
FILE
*
pfin
,
*
pfout
,
*
pfdebug
;
FILE
*
pfin
,
*
pfout
,
*
pfdebug
;
int
emptiesSent
=
0
;
static
int
emptiesPending
=
0
;
bool
emptySent
=
false
;
pname
[
0
]
=
'\0'
;
pname
[
0
]
=
'\0'
;
if
(
!
conn
)
return
NULL
;
if
(
!
conn
)
return
NULL
;
...
@@ -457,12 +458,13 @@ PQexec(PGconn* conn, const char* query)
...
@@ -457,12 +458,13 @@ PQexec(PGconn* conn, const char* query)
// send an empty query down, and keep reading out of the pipe
// send an empty query down, and keep reading out of the pipe
// until an 'I' is received.
// until an 'I' is received.
*/
*/
pqPuts
(
"Q
"
,
pfout
,
pfdebug
);
/* send an empty query */
pqPuts
(
"Q"
,
pfout
,
pfdebug
);
/* send an empty query */
/*
/*
* Increment a flag and process messages in the usual way because
* Increment a flag and process messages in the usual way because
* there may be async notifications pending. DZ - 31-8-1996
* there may be async notifications pending. DZ - 31-8-1996
*/
*/
emptiesSent
++
;
emptiesPending
++
;
emptySent
=
true
;
}
}
break
;
break
;
case
'E'
:
/* error return */
case
'E'
:
/* error return */
...
@@ -480,8 +482,8 @@ PQexec(PGconn* conn, const char* query)
...
@@ -480,8 +482,8 @@ PQexec(PGconn* conn, const char* query)
if
((
c
=
pqGetc
(
pfin
,
pfdebug
))
!=
'\0'
)
{
if
((
c
=
pqGetc
(
pfin
,
pfdebug
))
!=
'\0'
)
{
fprintf
(
stderr
,
"error!, unexpected character %c following 'I'
\n
"
,
c
);
fprintf
(
stderr
,
"error!, unexpected character %c following 'I'
\n
"
,
c
);
}
}
if
(
empties
Sent
)
{
if
(
empties
Pending
)
{
if
(
--
empties
Sent
==
0
)
{
/* is this the last one? */
if
(
--
empties
Pending
==
0
&&
emptySent
)
{
/* is this the last one? */
/*
/*
* If this is the result of a portal query command set the
* If this is the result of a portal query command set the
* command status and message accordingly. DZ - 31-8-1996
* command status and message accordingly. DZ - 31-8-1996
...
@@ -621,42 +623,36 @@ PQputline(PGconn *conn, const char *s)
...
@@ -621,42 +623,36 @@ PQputline(PGconn *conn, const char *s)
* to a "copy".
* to a "copy".
*
*
* RETURNS:
* RETURNS:
* 0 on
failure
* 0 on
success
* 1 on
success
* 1 on
failure
*/
*/
int
int
PQendcopy
(
PGconn
*
conn
)
PQendcopy
(
PGconn
*
conn
)
{
{
char
id
;
FILE
*
pfin
,
*
pfdebug
;
FILE
*
pfin
,
*
pfdebug
;
bool
valid
=
true
;
if
(
!
conn
)
return
(
int
)
NULL
;
if
(
!
conn
)
return
(
int
)
NULL
;
pfin
=
conn
->
Pfin
;
pfin
=
conn
->
Pfin
;
pfdebug
=
conn
->
Pfdebug
;
pfdebug
=
conn
->
Pfdebug
;
if
(
(
id
=
pqGetc
(
pfin
,
pfdebug
))
>
0
)
if
(
pqGetc
(
pfin
,
pfdebug
)
==
'C'
)
return
(
0
);
{
switch
(
id
)
{
char
command
[
MAX_MESSAGE_LEN
];
case
'Z'
:
/* backend finished the copy */
pqGets
(
command
,
MAX_MESSAGE_LEN
,
pfin
,
pfdebug
);
/* read command tag */
return
(
1
);
}
case
'E'
:
else
valid
=
false
;
case
'N'
:
if
(
pqGets
(
conn
->
errorMessage
,
ERROR_MSG_LENGTH
,
pfin
,
pfdebug
)
==
1
)
{
if
(
valid
)
sprintf
(
conn
->
errorMessage
,
return
(
0
);
else
{
sprintf
(
conn
->
errorMessage
,
"Error return detected from backend, "
"Error return detected from backend, "
"but attempt to read the message failed."
);
"but attempt to read the message failed."
);
}
return
(
0
);
break
;
default:
(
void
)
sprintf
(
conn
->
errorMessage
,
"FATAL: PQendcopy: protocol error: id=%x
\n
"
,
id
);
fputs
(
conn
->
errorMessage
,
stderr
);
fprintf
(
stderr
,
"resetting connection
\n
"
);
fprintf
(
stderr
,
"resetting connection
\n
"
);
PQreset
(
conn
);
PQreset
(
conn
);
return
(
0
);
return
(
1
);
}
}
}
}
...
...
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