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
e39bc695
Commit
e39bc695
authored
Aug 08, 2003
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Be a little bit more careful about using sqlstate, in case libpq returned
NULL for it.
parent
0bf70870
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
8 deletions
+22
-8
src/interfaces/ecpg/ecpglib/connect.c
src/interfaces/ecpg/ecpglib/connect.c
+4
-1
src/interfaces/ecpg/ecpglib/error.c
src/interfaces/ecpg/ecpglib/error.c
+18
-7
No files found.
src/interfaces/ecpg/ecpglib/connect.c
View file @
e39bc695
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.1
5 2003/08/04 00:43:32 momjian
Exp $ */
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.1
6 2003/08/08 13:16:20 petere
Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
...
...
@@ -164,6 +164,9 @@ ECPGnoticeReceiver(void *arg, const PGresult *result)
int
sqlcode
;
if
(
sqlstate
==
NULL
)
sqlstate
=
ECPG_SQLSTATE_ECPG_INTERNAL_ERROR
;
/* these are not warnings */
if
(
strncmp
(
sqlstate
,
"00"
,
2
)
==
0
)
return
;
...
...
src/interfaces/ecpg/ecpglib/error.c
View file @
e39bc695
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/error.c,v 1.
6 2003/08/04 00:43:32 momjian
Exp $ */
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/error.c,v 1.
7 2003/08/08 13:16:20 petere
Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
...
...
@@ -159,18 +159,29 @@ void
ECPGraise_backend
(
int
line
,
PGresult
*
result
,
PGconn
*
conn
,
int
compat
)
{
struct
sqlca_t
*
sqlca
=
ECPGget_sqlca
();
char
*
sqlstate
;
char
*
message
;
if
(
result
)
{
sqlstate
=
PQresultErrorField
(
result
,
'C'
);
if
(
sqlstate
==
NULL
)
sqlstate
=
ECPG_SQLSTATE_ECPG_INTERNAL_ERROR
;
message
=
PQresultErrorField
(
result
,
'M'
);
}
else
{
sqlstate
=
ECPG_SQLSTATE_ECPG_INTERNAL_ERROR
;
message
=
PQerrorMessage
(
conn
);
}
/* copy error message */
snprintf
(
sqlca
->
sqlerrm
.
sqlerrmc
,
sizeof
(
sqlca
->
sqlerrm
.
sqlerrmc
),
"'%s' in line %d."
,
result
?
PQresultErrorField
(
result
,
'M'
)
:
PQerrorMessage
(
conn
),
line
);
"'%s' in line %d."
,
message
,
line
);
sqlca
->
sqlerrm
.
sqlerrml
=
strlen
(
sqlca
->
sqlerrm
.
sqlerrmc
);
/* copy SQLSTATE */
strncpy
(
sqlca
->
sqlstate
,
result
?
PQresultErrorField
(
result
,
'C'
)
:
ECPG_SQLSTATE_ECPG_INTERNAL_ERROR
,
sizeof
(
sqlca
->
sqlstate
));
strncpy
(
sqlca
->
sqlstate
,
sqlstate
,
sizeof
(
sqlca
->
sqlstate
));
/* assign SQLCODE for backward compatibility */
if
(
strncmp
(
sqlca
->
sqlstate
,
"23505"
,
sizeof
(
sqlca
->
sqlstate
))
==
0
)
...
...
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