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
6428074e
Commit
6428074e
authored
Oct 01, 1998
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update libpq to store an error message in PGresult, per pgsq-interfaces discussion of 21-Sep.
parent
502769d0
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
205 additions
and
79 deletions
+205
-79
src/interfaces/libpq/fe-connect.c
src/interfaces/libpq/fe-connect.c
+2
-2
src/interfaces/libpq/fe-exec.c
src/interfaces/libpq/fe-exec.c
+132
-43
src/interfaces/libpq/fe-lobj.c
src/interfaces/libpq/fe-lobj.c
+25
-1
src/interfaces/libpq/libpq-fe.h
src/interfaces/libpq/libpq-fe.h
+33
-26
src/interfaces/libpq/libpq-int.h
src/interfaces/libpq/libpq-int.h
+12
-7
src/interfaces/libpq/libpqdll.def
src/interfaces/libpq/libpqdll.def
+1
-0
No files found.
src/interfaces/libpq/fe-connect.c
View file @
6428074e
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.8
3 1998/09/20 04:51:10 momjian
Exp $
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.8
4 1998/10/01 01:40:19 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -822,8 +822,8 @@ PQsetenv(PGconn *conn)
sprintf
(
envbuf
,
"%s=%s"
,
envname
,
encoding
);
putenv
(
envbuf
);
}
PQclear
(
rtn
);
}
PQclear
(
rtn
);
if
(
!
encoding
)
{
/* this should not happen */
sprintf
(
envbuf
,
"%s=%s"
,
envname
,
pg_encoding_to_char
(
MULTIBYTE
));
...
...
src/interfaces/libpq/fe-exec.c
View file @
6428074e
This diff is collapsed.
Click to expand it.
src/interfaces/libpq/fe-lobj.c
View file @
6428074e
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-lobj.c,v 1.1
6 1998/09/01 04:40:07 momjian
Exp $
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-lobj.c,v 1.1
7 1998/10/01 01:40:22 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -76,7 +76,10 @@ lo_open(PGconn *conn, Oid lobjId, int mode)
return
fd
;
}
else
{
PQclear
(
res
);
return
-
1
;
}
}
/*
...
...
@@ -111,7 +114,10 @@ lo_close(PGconn *conn, int fd)
return
retval
;
}
else
{
PQclear
(
res
);
return
-
1
;
}
}
/*
...
...
@@ -151,7 +157,10 @@ lo_read(PGconn *conn, int fd, char *buf, int len)
return
result_len
;
}
else
{
PQclear
(
res
);
return
-
1
;
}
}
/*
...
...
@@ -192,7 +201,10 @@ lo_write(PGconn *conn, int fd, char *buf, int len)
return
retval
;
}
else
{
PQclear
(
res
);
return
-
1
;
}
}
/*
...
...
@@ -236,7 +248,10 @@ lo_lseek(PGconn *conn, int fd, int offset, int whence)
return
retval
;
}
else
{
PQclear
(
res
);
return
-
1
;
}
}
/*
...
...
@@ -273,7 +288,10 @@ lo_creat(PGconn *conn, int mode)
return
(
Oid
)
retval
;
}
else
{
PQclear
(
res
);
return
InvalidOid
;
}
}
...
...
@@ -309,7 +327,10 @@ lo_tell(PGconn *conn, int fd)
return
retval
;
}
else
{
PQclear
(
res
);
return
-
1
;
}
}
/*
...
...
@@ -344,7 +365,10 @@ lo_unlink(PGconn *conn, Oid lobjId)
return
retval
;
}
else
{
PQclear
(
res
);
return
-
1
;
}
}
/*
...
...
src/interfaces/libpq/libpq-fe.h
View file @
6428074e
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: libpq-fe.h,v 1.4
3 1998/09/18 16:46:06 momjian
Exp $
* $Id: libpq-fe.h,v 1.4
4 1998/10/01 01:40:23 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -67,6 +67,8 @@ extern "C"
/* PGnotify represents the occurrence of a NOTIFY message.
* Ideally this would be an opaque typedef, but it's so simple that it's
* unlikely to change.
* NOTE: in Postgres 6.4 and later, the be_pid is the notifying backend's,
* whereas in earlier versions it was always your own backend's PID.
*/
typedef
struct
pgNotify
{
...
...
@@ -78,7 +80,7 @@ extern "C"
/* PQnoticeProcessor is the function type for the notice-message callback.
*/
typedef
void
(
*
PQnoticeProcessor
)
(
void
*
arg
,
const
char
*
message
);
typedef
void
(
*
PQnoticeProcessor
)
(
void
*
arg
,
const
char
*
message
);
/* Print options for PQprint() */
...
...
@@ -228,6 +230,7 @@ typedef void (*PQnoticeProcessor) (void * arg, const char * message);
/* Accessor functions for PGresult objects */
extern
ExecStatusType
PQresultStatus
(
PGresult
*
res
);
extern
const
char
*
PQresultErrorMessage
(
PGresult
*
res
);
extern
int
PQntuples
(
PGresult
*
res
);
extern
int
PQnfields
(
PGresult
*
res
);
extern
int
PQbinaryTuples
(
PGresult
*
res
);
...
...
@@ -246,7 +249,10 @@ typedef void (*PQnoticeProcessor) (void * arg, const char * message);
/* Delete a PGresult */
extern
void
PQclear
(
PGresult
*
res
);
/* Make an empty PGresult with given status (some apps find this useful) */
/* Make an empty PGresult with given status (some apps find this useful).
* If conn is not NULL and status indicates an error, the conn's
* errorMessage is copied.
*/
extern
PGresult
*
PQmakeEmptyPGresult
(
PGconn
*
conn
,
ExecStatusType
status
);
/* === in fe-print.c === */
...
...
@@ -267,6 +273,7 @@ typedef void (*PQnoticeProcessor) (void * arg, const char * message);
const
char
*
fieldSep
,
/* field separator */
int
printHeader
,
/* display headers? */
int
quiet
);
extern
void
PQprintTuples
(
PGresult
*
res
,
FILE
*
fout
,
/* output stream */
int
printAttName
,
/* print attribute names
...
...
src/interfaces/libpq/libpq-int.h
View file @
6428074e
...
...
@@ -11,7 +11,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: libpq-int.h,v 1.
3 1998/09/03 02:10:53 momjian
Exp $
* $Id: libpq-int.h,v 1.
4 1998/10/01 01:40:25 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -91,7 +91,15 @@
* last insert query */
int
binary
;
/* binary tuple values if binary == 1,
* otherwise ASCII */
/* NOTE: conn is kept here only for the temporary convenience of
* applications that rely on it being here. It will go away in a
* future release, because relying on it is a bad idea --- what if
* the PGresult has outlived the PGconn? About the only thing it was
* really good for was fetching the errorMessage, and we stash that
* here now anyway.
*/
PGconn
*
conn
;
/* connection we did the query on */
char
*
errMsg
;
/* error message, or NULL if no error */
};
/* PGAsyncStatusType defines the state of the query-execution state machine */
...
...
@@ -174,12 +182,8 @@
PGresult
*
result
;
/* result being constructed */
PGresAttValue
*
curTuple
;
/* tuple currently being read */
/* Message space. Placed last for code-size reasons.
* errorMessage is the message last returned to the application.
* When asyncStatus=READY, asyncErrorMessage is the pending message
* that will be put in errorMessage by PQgetResult. */
/* Message space. Placed last for code-size reasons. */
char
errorMessage
[
ERROR_MSG_LENGTH
];
char
asyncErrorMessage
[
ERROR_MSG_LENGTH
];
};
/* ----------------
...
...
@@ -197,6 +201,7 @@ extern int pqPacketSend(PGconn *conn, const char *buf, size_t len);
/* === in fe-exec.c === */
extern
void
pqSetResultError
(
PGresult
*
res
,
const
char
*
msg
);
extern
void
pqClearAsyncResult
(
PGconn
*
conn
);
/* === in fe-misc.c === */
...
...
src/interfaces/libpq/libpqdll.def
View file @
6428074e
...
...
@@ -63,3 +63,4 @@ EXPORTS
lo_unlink @ 60
lo_import @ 61
lo_export @ 62
PQresultErrorMessage @ 63
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