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
4540a8bd
Commit
4540a8bd
authored
Dec 20, 1996
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix multiple "C" from backend.
parent
a952d672
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
46 deletions
+20
-46
src/interfaces/libpq/fe-exec.c
src/interfaces/libpq/fe-exec.c
+20
-46
No files found.
src/interfaces/libpq/fe-exec.c
View file @
4540a8bd
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.2
1 1996/12/15 09:05:53 bryanh
Exp $
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.2
2 1996/12/20 20:34:38 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -362,16 +362,13 @@ PGresult*
PQexec
(
PGconn
*
conn
,
const
char
*
query
)
{
PGresult
*
result
;
int
id
,
clear
,
error
;
int
id
;
char
buffer
[
MAX_MESSAGE_LEN
];
char
cmdStatus
[
MAX_MESSAGE_LEN
];
char
pname
[
MAX_MESSAGE_LEN
];
/* portal name */
PGnotify
*
newNotify
;
FILE
*
pfin
,
*
pfout
,
*
pfdebug
;
#ifdef PQ_NOTIFY_PATCH
int
isCommand
=
0
;
/* DZ - 31-8-1996 */
#endif
int
emptiesSent
=
0
;
pname
[
0
]
=
'\0'
;
...
...
@@ -412,7 +409,7 @@ PQexec(PGconn* conn, const char* query)
"-- fprintf to Pfout failed: errno=%d
\n
%s
\n
"
,
query
,
errno
,
strerror
(
errno
));
return
NULL
;
}
}
/* loop forever because multiple messages, especially NOTICES,
can come back from the backend
...
...
@@ -458,38 +455,12 @@ PQexec(PGconn* conn, const char* query)
// send an empty query down, and keep reading out of the pipe
// until an 'I' is received.
*/
clear
=
0
;
error
=
0
;
pqPuts
(
"Q "
,
pfout
,
pfdebug
);
/* send an empty query */
#ifdef PQ_NOTIFY_PATCH
/*
*
Se
t a flag and process messages in the usual way because
*
Incremen
t a flag and process messages in the usual way because
* there may be async notifications pending. DZ - 31-8-1996
*/
isCommand
=
1
;
#else
while
(
!
clear
)
{
if
(
pqGets
(
buffer
,
ERROR_MSG_LENGTH
,
pfin
,
pfdebug
)
==
1
)
clear
=
1
;
/*
// Rules can create error messages while we are waiting
// for the 'I'.
*/
if
(
buffer
[
0
]
==
'E'
)
{
strcpy
(
conn
->
errorMessage
,
&
buffer
[
1
]);
error
++
;
}
clear
=
(
buffer
[
0
]
==
'I'
);
}
if
(
error
)
{
return
(
PGresult
*
)
NULL
;
}
result
=
makeEmptyPGresult
(
conn
,
PGRES_COMMAND_OK
);
strncpy
(
result
->
cmdStatus
,
cmdStatus
,
CMDSTATUS_LEN
-
1
);
return
result
;
#endif
emptiesSent
++
;
}
break
;
case
'E'
:
/* error return */
...
...
@@ -507,17 +478,21 @@ PQexec(PGconn* conn, const char* query)
if
((
c
=
pqGetc
(
pfin
,
pfdebug
))
!=
'\0'
)
{
fprintf
(
stderr
,
"error!, unexpected character %c following 'I'
\n
"
,
c
);
}
if
(
isCommand
)
{
/*
* If this is the result of a portal query command set the
* command status and message accordingly. DZ - 31-8-1996
*/
result
=
makeEmptyPGresult
(
conn
,
PGRES_COMMAND_OK
);
strncpy
(
result
->
cmdStatus
,
cmdStatus
,
CMDSTATUS_LEN
-
1
);
if
(
emptiesSent
)
{
if
(
--
emptiesSent
==
0
)
{
/* is this the last one? */
/*
* If this is the result of a portal query command set the
* command status and message accordingly. DZ - 31-8-1996
*/
result
=
makeEmptyPGresult
(
conn
,
PGRES_COMMAND_OK
);
strncpy
(
result
->
cmdStatus
,
cmdStatus
,
CMDSTATUS_LEN
-
1
);
return
result
;
}
}
else
{
result
=
makeEmptyPGresult
(
conn
,
PGRES_EMPTY_QUERY
);
return
result
;
}
result
=
makeEmptyPGresult
(
conn
,
PGRES_EMPTY_QUERY
);
return
result
;
}
break
;
case
'N'
:
/* notices from the backend */
...
...
@@ -548,8 +523,7 @@ PQexec(PGconn* conn, const char* query)
id
);
return
(
PGresult
*
)
NULL
;
}
/* switch */
}
/* while (1)*/
}
/* while (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