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
5f27ac6b
Commit
5f27ac6b
authored
Oct 17, 1998
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor documentation improvements and markup fixes.
parent
71a5da47
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
184 additions
and
163 deletions
+184
-163
doc/src/sgml/dfunc.sgml
doc/src/sgml/dfunc.sgml
+8
-8
doc/src/sgml/libpgtcl.sgml
doc/src/sgml/libpgtcl.sgml
+28
-27
doc/src/sgml/libpq.sgml
doc/src/sgml/libpq.sgml
+102
-88
doc/src/sgml/lobj.sgml
doc/src/sgml/lobj.sgml
+17
-17
doc/src/sgml/protocol.sgml
doc/src/sgml/protocol.sgml
+22
-16
doc/src/sgml/ref/notify.sgml
doc/src/sgml/ref/notify.sgml
+3
-3
doc/src/sgml/ref/unlisten.sgml
doc/src/sgml/ref/unlisten.sgml
+1
-1
doc/src/sgml/start.sgml
doc/src/sgml/start.sgml
+1
-1
doc/src/sgml/xtypes.sgml
doc/src/sgml/xtypes.sgml
+2
-2
No files found.
doc/src/sgml/dfunc.sgml
View file @
5f27ac6b
...
@@ -208,8 +208,8 @@ If the file you specify is
...
@@ -208,8 +208,8 @@ If the file you specify is
very simple, since the commands to do it are just:
very simple, since the commands to do it are just:
<ProgramListing>
<ProgramListing>
# simple HP-UX example
# simple HP-UX example
%
cc +z +u -c foo.c
%
cc +z +u -c foo.c
%
ld -b -o foo.sl foo.o
%
ld -b -o foo.sl foo.o
</ProgramListing>
</ProgramListing>
</Para>
</Para>
...
@@ -221,21 +221,21 @@ If the file you specify is
...
@@ -221,21 +221,21 @@ If the file you specify is
Under SunOS 4.x, the commands look like:
Under SunOS 4.x, the commands look like:
<ProgramListing>
<ProgramListing>
# simple SunOS 4.x example
# simple SunOS 4.x example
%
cc -PIC -c foo.c
%
cc -PIC -c foo.c
%
ld -dc -dp -Bdynamic -o foo.so foo.o
%
ld -dc -dp -Bdynamic -o foo.so foo.o
</ProgramListing>
</ProgramListing>
and the equivalent lines under Solaris 2.x are:
and the equivalent lines under Solaris 2.x are:
<ProgramListing>
<ProgramListing>
# simple Solaris 2.x example
# simple Solaris 2.x example
%
cc -K PIC -c foo.c
%
cc -K PIC -c foo.c
%
ld -G -Bdynamic -o foo.so foo.o
%
ld -G -Bdynamic -o foo.so foo.o
</ProgramListing>
</ProgramListing>
or
or
<ProgramListing>
<ProgramListing>
# simple Solaris 2.x example
# simple Solaris 2.x example
%
gcc -fPIC -c foo.c
%
gcc -fPIC -c foo.c
%
ld -G -Bdynamic -o foo.so foo.o
%
ld -G -Bdynamic -o foo.so foo.o
</ProgramListing>
</ProgramListing>
</Para>
</Para>
...
...
doc/src/sgml/libpgtcl.sgml
View file @
5f27ac6b
...
@@ -47,7 +47,7 @@ This package was originally written by Jolly Chen.
...
@@ -47,7 +47,7 @@ This package was originally written by Jolly Chen.
</ROW>
</ROW>
<ROW>
<ROW>
<ENTRY>pg_select</ENTRY>
<ENTRY>pg_select</ENTRY>
<ENTRY>loop over the result of a
select
statement</ENTRY>
<ENTRY>loop over the result of a
SELECT
statement</ENTRY>
</ROW>
</ROW>
<ROW>
<ROW>
<ENTRY>pg_listen</ENTRY>
<ENTRY>pg_listen</ENTRY>
...
@@ -76,7 +76,7 @@ This package was originally written by Jolly Chen.
...
@@ -76,7 +76,7 @@ This package was originally written by Jolly Chen.
</ROW>
</ROW>
<ROW>
<ROW>
<ENTRY>pg_lo_lseek</ENTRY>
<ENTRY>pg_lo_lseek</ENTRY>
<ENTRY>seek to a position
o
n a large object</ENTRY>
<ENTRY>seek to a position
i
n a large object</ENTRY>
</ROW>
</ROW>
<ROW>
<ROW>
<ENTRY>pg_lo_tell</ENTRY>
<ENTRY>pg_lo_tell</ENTRY>
...
@@ -168,14 +168,33 @@ proc getDBs { {host "localhost"} {port "5432"} } {
...
@@ -168,14 +168,33 @@ proc getDBs { {host "localhost"} {port "5432"} } {
pg_connect -conninfo <REPLACEABLE CLASS="PARAMETER">connectOptions</REPLACEABLE>
pg_connect -conninfo <REPLACEABLE CLASS="PARAMETER">connectOptions</REPLACEABLE>
pg_connect <REPLACEABLE CLASS="PARAMETER">dbName</REPLACEABLE> <OPTIONAL>-host <REPLACEABLE CLASS="PARAMETER">hostName</REPLACEABLE></OPTIONAL>
pg_connect <REPLACEABLE CLASS="PARAMETER">dbName</REPLACEABLE> <OPTIONAL>-host <REPLACEABLE CLASS="PARAMETER">hostName</REPLACEABLE></OPTIONAL>
<OPTIONAL>-port <REPLACEABLE
<OPTIONAL>-port <REPLACEABLE
CLASS="PARAMETER">portNumber</REPLACEABLE></OPTIONAL> <OPTIONAL>-tty
CLASS="PARAMETER">portNumber</REPLACEABLE></OPTIONAL> <OPTIONAL>-tty
<REPLACEABLE
<REPLACEABLE
CLASS="PARAMETER">pqtty</REPLACEABLE></OPTIONAL>
CLASS="PARAMETER">pqtty</REPLACEABLE></OPTIONAL>
<OPTIONAL>-options <REPLACEABLE
<OPTIONAL>-options <REPLACEABLE
CLASS="PARAMETER">optionalBackendArgs</REPLACEABLE></OPTIONAL>
CLASS="PARAMETER">optionalBackendArgs</REPLACEABLE></OPTIONAL>
</SYNOPSIS>
</SYNOPSIS>
<REFSECT2 ID="R2-PGTCL-PGCONNECT-1">
<REFSECT2 ID="R2-PGTCL-PGCONNECT-1">
<REFSECT2INFO>
<REFSECT2INFO>
<DATE>1998-10-07</DATE>
</REFSECT2INFO>
<TITLE>Inputs (new style)
</TITLE>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">connectOptions</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>A string of connection options, each written in the form keyword = value.
</PARA>
</LISTITEM>
</VARLISTENTRY>
</VARIABLELIST>
</REFSECT2>
<REFSECT2 ID="R2-PGTCL-PGCONNECT-2">
<REFSECT2INFO>
<DATE>1997-12-24</DATE>
<DATE>1997-12-24</DATE>
</REFSECT2INFO>
</REFSECT2INFO>
<TITLE>Inputs (old style)
<TITLE>Inputs (old style)
...
@@ -213,7 +232,7 @@ pg_connect <REPLACEABLE CLASS="PARAMETER">dbName</REPLACEABLE> <OPTIONAL>-host <
...
@@ -213,7 +232,7 @@ pg_connect <REPLACEABLE CLASS="PARAMETER">dbName</REPLACEABLE> <OPTIONAL>-host <
<OPTIONAL>-tty <REPLACEABLE CLASS="PARAMETER">pqtty</REPLACEABLE></OPTIONAL>
<OPTIONAL>-tty <REPLACEABLE CLASS="PARAMETER">pqtty</REPLACEABLE></OPTIONAL>
</TERM>
</TERM>
<LISTITEM>
<LISTITEM>
<PARA>
(need information thomas 1997-12-24)
<PARA>
Specifies file or tty for optional debug output from backend.
</PARA>
</PARA>
</LISTITEM>
</LISTITEM>
</VARLISTENTRY>
</VARLISTENTRY>
...
@@ -229,25 +248,6 @@ pg_connect <REPLACEABLE CLASS="PARAMETER">dbName</REPLACEABLE> <OPTIONAL>-host <
...
@@ -229,25 +248,6 @@ pg_connect <REPLACEABLE CLASS="PARAMETER">dbName</REPLACEABLE> <OPTIONAL>-host <
</VARIABLELIST>
</VARIABLELIST>
</REFSECT2>
</REFSECT2>
<REFSECT2 ID="R2-PGTCL-PGCONNECT-2">
<REFSECT2INFO>
<DATE>1998-10-07</DATE>
</REFSECT2INFO>
<TITLE>Inputs (new style)
</TITLE>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">connectOptions</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>A string of connection options, each written in the form keyword = value.
</PARA>
</LISTITEM>
</VARLISTENTRY>
</VARIABLELIST>
</REFSECT2>
<REFSECT2 ID="R2-PGTCL-PGCONNECT-3">
<REFSECT2 ID="R2-PGTCL-PGCONNECT-3">
<REFSECT2INFO>
<REFSECT2INFO>
<DATE>1997-12-24</DATE>
<DATE>1997-12-24</DATE>
...
@@ -423,7 +423,8 @@ Each entry in the list is a sublist of the format:
...
@@ -423,7 +423,8 @@ Each entry in the list is a sublist of the format:
<para>
<para>
{optname label dispchar dispsize value}
{optname label dispchar dispsize value}
<Para>
<Para>
where the optname is usable as an option in pg_connect -conninfo.
where the optname is usable as an option in
<FUNCTION>pg_connect -conninfo</FUNCTION>.
</PARA>
</PARA>
</LISTITEM>
</LISTITEM>
</VARLISTENTRY>
</VARLISTENTRY>
...
@@ -785,7 +786,7 @@ created too many query result objects.
...
@@ -785,7 +786,7 @@ created too many query result objects.
<REFNAME>pg_select
<REFNAME>pg_select
</REFNAME>
</REFNAME>
<REFPURPOSE>
<REFPURPOSE>
loop over the result of a
select
statement
loop over the result of a
SELECT
statement
</REFPURPOSE>
</REFPURPOSE>
<INDEXTERM ID="IX-PGTCL-PGSELECT-1"><PRIMARY>pgtcl</PRIMARY><SECONDARY>connecting</SECONDARY></INDEXTERM>
<INDEXTERM ID="IX-PGTCL-PGSELECT-1"><PRIMARY>pgtcl</PRIMARY><SECONDARY>connecting</SECONDARY></INDEXTERM>
<INDEXTERM ID="IX-PGTCL-PGSELECT-2"><PRIMARY>pg_connect</PRIMARY></INDEXTERM>
<INDEXTERM ID="IX-PGTCL-PGSELECT-2"><PRIMARY>pg_connect</PRIMARY></INDEXTERM>
...
@@ -1500,7 +1501,7 @@ the actual string to write, not a variable name.
...
@@ -1500,7 +1501,7 @@ the actual string to write, not a variable name.
<REFNAMEDIV>
<REFNAMEDIV>
<REFNAME>pg_lo_lseek
<REFNAME>pg_lo_lseek
</REFNAME>
</REFNAME>
<REFPURPOSE>seek to a position
o
n a large object
<REFPURPOSE>seek to a position
i
n a large object
</REFPURPOSE>
</REFPURPOSE>
<INDEXTERM ID="IX-PGTCL-PGLOLSEEK-1"><PRIMARY>pgtcl</PRIMARY><SECONDARY>positioning</SECONDARY></INDEXTERM>
<INDEXTERM ID="IX-PGTCL-PGLOLSEEK-1"><PRIMARY>pgtcl</PRIMARY><SECONDARY>positioning</SECONDARY></INDEXTERM>
<INDEXTERM ID="IX-PGTCL-PGLOLSEEK-2"><PRIMARY>pg_lo_lseek</PRIMARY></INDEXTERM>
<INDEXTERM ID="IX-PGTCL-PGLOLSEEK-2"><PRIMARY>pg_lo_lseek</PRIMARY></INDEXTERM>
...
...
doc/src/sgml/libpq.sgml
View file @
5f27ac6b
...
@@ -149,7 +149,7 @@ accepts and ignores this keyword for backward compatibility.)
...
@@ -149,7 +149,7 @@ accepts and ignores this keyword for backward compatibility.)
</ListItem>
</ListItem>
<ListItem>
<ListItem>
<Para>
<Para>
<Acronym>tty</Acronym> -- file or tty for optional debug output.
<Acronym>tty</Acronym> -- file or tty for optional debug output
from backend
.
</Para>
</Para>
</ListItem>
</ListItem>
</ItemizedList>
</ItemizedList>
...
@@ -170,7 +170,7 @@ struct PQconninfoOption
...
@@ -170,7 +170,7 @@ struct PQconninfoOption
char *keyword; /* The keyword of the option */
char *keyword; /* The keyword of the option */
char *envvar; /* Fallback environment variable name */
char *envvar; /* Fallback environment variable name */
char *compiled; /* Fallback compiled in default value */
char *compiled; /* Fallback compiled in default value */
char *val; /* Option
s value */
char *val; /* Option'
s value */
char *label; /* Label for field in connect dialog */
char *label; /* Label for field in connect dialog */
char *dispchar; /* Character to display for this field
char *dispchar; /* Character to display for this field
in a connect dialog. Values are:
in a connect dialog. Values are:
...
@@ -420,7 +420,7 @@ PGRES_FATAL_ERROR
...
@@ -420,7 +420,7 @@ PGRES_FATAL_ERROR
If the result status is PGRES_TUPLES_OK, then the
If the result status is PGRES_TUPLES_OK, then the
routines described below can be used to retrieve the
routines described below can be used to retrieve the
tuples returned by the query. Note that a SELECT that
tuples returned by the query. Note that a SELECT that
happens to retrieve zero tuples still shows PGRES_TUPLES_OK
;
happens to retrieve zero tuples still shows PGRES_TUPLES_OK
.
PGRES_COMMAND_OK is for commands that can never return tuples.
PGRES_COMMAND_OK is for commands that can never return tuples.
</Para>
</Para>
</ListItem>
</ListItem>
...
@@ -522,13 +522,15 @@ Oid PQftype(PGresult *res,
...
@@ -522,13 +522,15 @@ Oid PQftype(PGresult *res,
<Para>
<Para>
<Function>PQfsize</Function>
<Function>PQfsize</Function>
Returns the size in bytes of the field
Returns the size in bytes of the field
associated with the given field index. If the size
associated with the given field index.
returned is -1, the field is a variable length
Field indices start at 0.
field. Field indices start at 0.
<synopsis>
<synopsis>
int PQfsize(PGresult *res,
int PQfsize(PGresult *res,
int field_index);
int field_index);
</synopsis>
</synopsis>
PQfsize returns the space allocated for this field in a database
tuple, in other words the size of the server's binary representation
of the data type. -1 is returned if the field is variable size.
</Para>
</Para>
</ListItem>
</ListItem>
...
@@ -558,11 +560,12 @@ char* PQgetvalue(PGresult *res,
...
@@ -558,11 +560,12 @@ char* PQgetvalue(PGresult *res,
</synopsis>
</synopsis>
For most queries, the value returned by PQgetvalue
For most queries, the value returned by PQgetvalue
is a null-terminated ASCII string representation
is a null-terminated ASCII string representation
of the attribute value.
If the query extracted data from
of the attribute value.
But if PQbinaryTuples() is TRUE,
a <Acronym>BINARY</Acronym> cursor, then
the value returned by
the value returned by
PQgetvalue is the binary representation of the
PQgetvalue is the binary representation of the
type in the internal format of the backend server.
type in the internal format of the backend server
It is the programmer's responsibility to cast and
(but not including the size word, if the field is variable-length).
It is then the programmer's responsibility to cast and
convert the data to the correct C type. The pointer
convert the data to the correct C type. The pointer
returned by PQgetvalue points to storage that is
returned by PQgetvalue points to storage that is
part of the PGresult structure. One should not modify it,
part of the PGresult structure. One should not modify it,
...
@@ -574,39 +577,34 @@ char* PQgetvalue(PGresult *res,
...
@@ -574,39 +577,34 @@ char* PQgetvalue(PGresult *res,
<ListItem>
<ListItem>
<Para>
<Para>
<Function>PQget
isnull
</Function>
<Function>PQget
length
</Function>
Tests a field for a NULL entry
.
Returns the length of a field (attribute) in bytes
.
Tuple and field indices start at 0.
Tuple and field indices start at 0.
<synopsis>
<synopsis>
int PQget
isnull
(PGresult *res,
int PQget
length
(PGresult *res,
int tup_num,
int tup_num,
int field_num);
int field_num);
</synopsis>
</synopsis>
This function returns 1 if the field contains a NULL, 0 if
This is the actual data length for the particular data value, that is the
it contains a non-null value. (Note that PQgetvalue
size of the object pointed to by PQgetvalue. Note that for ASCII-represented
will return an empty string, not a null pointer, for a NULL
values, this size has little to do with the binary size reported by PQfsize.
field.)
</Para>
</Para>
</ListItem>
</ListItem>
<ListItem>
<ListItem>
<Para>
<Para>
<Function>PQgetlength</Function>
<Function>PQgetisnull</Function>
Returns the length of a field
Tests a field for a NULL entry.
(attribute) in bytes.
Tuple and field indices start at 0.
Tuple and field indices start at 0.
<synopsis>
<synopsis>
int PQget
length
(PGresult *res,
int PQget
isnull
(PGresult *res,
int tup_num,
int tup_num,
int field_num);
int field_num);
</synopsis>
</synopsis>
This is the actual data length for the particular data value,
This function returns 1 if the field contains a NULL, 0 if
whereas PQfsize shows the allocated space for all entries in
it contains a non-null value. (Note that PQgetvalue
this column.
will return an empty string, not a null pointer, for a NULL
If the field is a struct
field.)
varlena, the length returned here does not include
the size field of the varlena, i.e., it is 4 bytes
less.
</Para>
</Para>
</ListItem>
</ListItem>
...
@@ -855,8 +853,8 @@ was actually collected. After calling PQconsumeInput,
...
@@ -855,8 +853,8 @@ was actually collected. After calling PQconsumeInput,
the application may check PQisBusy and/or PQnotifies to see if their state
the application may check PQisBusy and/or PQnotifies to see if their state
has changed.
has changed.
PQconsumeInput may be called even if the application is not
PQconsumeInput may be called even if the application is not
prepared to deal with a result or notification just yet.
prepared to deal with a result or notification just yet.
The
It
will read available data and save it in a buffer, thereby
routine
will read available data and save it in a buffer, thereby
causing a select(2) read-ready indication to go away. The
causing a select(2) read-ready indication to go away. The
application can thus use PQconsumeInput to clear the select
application can thus use PQconsumeInput to clear the select
condition immediately, and then examine the results at leisure.
condition immediately, and then examine the results at leisure.
...
@@ -958,14 +956,17 @@ or the backend is not currently processing a query.
...
@@ -958,14 +956,17 @@ or the backend is not currently processing a query.
<Sect1>
<Sect1>
<Title>Fast Path</Title>
<Title>Fast Path</Title>
<Para>
<ProductName>Postgres</ProductName> provides a fast path interface to send
function calls to the backend. This is a trapdoor into system internals and
can be a potential security hole. Most users will not need this feature.
<Para>
<Para>
<ItemizedList>
<ItemizedList>
<ListItem>
<ListItem>
<Para>
<Para>
<ProductName>Postgres</ProductName> provides a fast path interface to send function
<Function>PQfn</Function>
calls to the backend. This is a trapdoor into
Request execution of a backend function via the fast path interface.
system internals and can be a potential security hole.
Most users will not need this feature.
<synopsis>
<synopsis>
PGresult* PQfn(PGconn* conn,
PGresult* PQfn(PGconn* conn,
int fnid,
int fnid,
...
@@ -979,12 +980,15 @@ PGresult* PQfn(PGconn* conn,
...
@@ -979,12 +980,15 @@ PGresult* PQfn(PGconn* conn,
executed.
executed.
result_buf is the buffer in which
result_buf is the buffer in which
to place the return value. The caller must have allocated
to place the return value. The caller must have allocated
sufficient space to store the return value. The
sufficient space to store the return value (there is no check!).
result length will be returned in the storage pointed
The actual result length will be returned in the integer pointed
to by result_len. If the result is to be an integer
to by result_len. If a 4-byte integer result is expected, set
value, than result_is_int should be set to 1; otherwise
result_is_int to 1; otherwise set it to 0. (Setting result_is_int to 1
it should be set to 0. args and nargs specify the
tells libpq to byte-swap the value if necessary, so that it is
arguments to the function.
delivered as a proper int value for the client machine. When
result_is_int is 0, the byte string sent by the backend is returned
unmodified.)
args and nargs specify the arguments to be passed to the function.
<synopsis>
<synopsis>
typedef struct {
typedef struct {
int len;
int len;
...
@@ -1037,9 +1041,19 @@ messages can be detected by calling PQnotifies().
...
@@ -1037,9 +1041,19 @@ messages can be detected by calling PQnotifies().
removed from the list of notifications.
removed from the list of notifications.
<synopsis>
<synopsis>
PGnotify* PQnotifies(PGconn *conn);
PGnotify* PQnotifies(PGconn *conn);
typedef struct pgNotify
{
char relname[NAMEDATALEN]; /* name of relation
* containing data */
int be_pid; /* process id of backend */
} PGnotify;
</synopsis>
</synopsis>
After processing a PGnotify object returned by PQnotifies,
After processing a PGnotify object returned by PQnotifies,
be sure to free it with free() to avoid a memory leak.
be sure to free it with free() to avoid a memory leak.
NOTE: in <productname>Postgres</productname> 6.4 and later,
the be_pid is the notifying backend's, whereas in earlier versions
it was always your own backend's PID.
</Para>
</Para>
</ListItem>
</ListItem>
</ItemizedList>
</ItemizedList>
...
@@ -1307,7 +1321,7 @@ defaultNoticeProcessor(void * arg, const char * message)
...
@@ -1307,7 +1321,7 @@ defaultNoticeProcessor(void * arg, const char * message)
<Para>
<Para>
To use a special notice processor, call <function>PQsetNoticeProcessor</function> just after
To use a special notice processor, call <function>PQsetNoticeProcessor</function> just after
any
creation of a new PGconn object.
creation of a new PGconn object.
</Sect1>
</Sect1>
...
@@ -1565,8 +1579,8 @@ main()
...
@@ -1565,8 +1579,8 @@ main()
*/
*/
if (PQstatus(conn) == CONNECTION_BAD)
if (PQstatus(conn) == CONNECTION_BAD)
{
{
fprintf(stderr, "Connection to database '
%
s' failed.\n", dbName);
fprintf(stderr, "Connection to database '
%
s' failed.\n", dbName);
fprintf(stderr, "
%
s", PQerrorMessage(conn));
fprintf(stderr, "
%
s", PQerrorMessage(conn));
exit_nicely(conn);
exit_nicely(conn);
}
}
...
@@ -1612,14 +1626,14 @@ main()
...
@@ -1612,14 +1626,14 @@ main()
/* first, print out the attribute names */
/* first, print out the attribute names */
nFields = PQnfields(res);
nFields = PQnfields(res);
for (i = 0; i < nFields; i++)
for (i = 0; i < nFields; i++)
printf("
%
-15s", PQfname(res, i));
printf("
%
-15s", PQfname(res, i));
printf("\n\n");
printf("\n\n");
/* next, print out the instances */
/* next, print out the instances */
for (i = 0; i < PQntuples(res); i++)
for (i = 0; i < PQntuples(res); i++)
{
{
for (j = 0; j < nFields; j++)
for (j = 0; j < nFields; j++)
printf("
%
-15s", PQgetvalue(res, i, j));
printf("
%
-15s", PQgetvalue(res, i, j));
printf("\n");
printf("\n");
}
}
...
@@ -1713,8 +1727,8 @@ main()
...
@@ -1713,8 +1727,8 @@ main()
*/
*/
if (PQstatus(conn) == CONNECTION_BAD)
if (PQstatus(conn) == CONNECTION_BAD)
{
{
fprintf(stderr, "Connection to database '
%
s' failed.\n", dbName);
fprintf(stderr, "Connection to database '
%
s' failed.\n", dbName);
fprintf(stderr, "
%
s", PQerrorMessage(conn));
fprintf(stderr, "
%
s", PQerrorMessage(conn));
exit_nicely(conn);
exit_nicely(conn);
}
}
...
@@ -1746,7 +1760,7 @@ main()
...
@@ -1746,7 +1760,7 @@ main()
while ((notify = PQnotifies(conn)) != NULL)
while ((notify = PQnotifies(conn)) != NULL)
{
{
fprintf(stderr,
fprintf(stderr,
"ASYNC NOTIFY of '
%s' from backend pid '%
d' received\n",
"ASYNC NOTIFY of '
%s' from backend pid '%
d' received\n",
notify->relname, notify->be_pid);
notify->relname, notify->be_pid);
free(notify);
free(notify);
}
}
...
@@ -1841,8 +1855,8 @@ main()
...
@@ -1841,8 +1855,8 @@ main()
*/
*/
if (PQstatus(conn) == CONNECTION_BAD)
if (PQstatus(conn) == CONNECTION_BAD)
{
{
fprintf(stderr, "Connection to database '
%
s' failed.\n", dbName);
fprintf(stderr, "Connection to database '
%
s' failed.\n", dbName);
fprintf(stderr, "
%
s", PQerrorMessage(conn));
fprintf(stderr, "
%
s", PQerrorMessage(conn));
exit_nicely(conn);
exit_nicely(conn);
}
}
...
@@ -1888,7 +1902,7 @@ main()
...
@@ -1888,7 +1902,7 @@ main()
for (i = 0; i < 3; i++)
for (i = 0; i < 3; i++)
{
{
printf("type[
%d] = %d, size[%d] = %
d\n",
printf("type[
%d] = %d, size[%d] = %
d\n",
i, PQftype(res, i),
i, PQftype(res, i),
i, PQfsize(res, i));
i, PQfsize(res, i));
}
}
...
@@ -1910,13 +1924,13 @@ main()
...
@@ -1910,13 +1924,13 @@ main()
*/
*/
pval = (POLYGON *) malloc(plen + VARHDRSZ);
pval = (POLYGON *) malloc(plen + VARHDRSZ);
pval->size = plen;
pval->size = plen;
memmove((char *) &pval->npts, PQgetvalue(res, i, p_fnum), plen);
memmove((char *) &
amp;
pval->npts, PQgetvalue(res, i, p_fnum), plen);
printf("tuple
%
d: got\n", i);
printf("tuple
%
d: got\n", i);
printf(" i = (
%d bytes) %
d,\n",
printf(" i = (
%d bytes) %
d,\n",
PQgetlength(res, i, i_fnum), *ival);
PQgetlength(res, i, i_fnum), *ival);
printf(" d = (
%d bytes) %
f,\n",
printf(" d = (
%d bytes) %
f,\n",
PQgetlength(res, i, d_fnum), *dval);
PQgetlength(res, i, d_fnum), *dval);
printf(" p = (
%d bytes) %d points \tboundbox = (hi=%f/%f, lo = %f,%
f)\n",
printf(" p = (
%d bytes) %d points \tboundbox = (hi=%f/%f, lo = %f,%
f)\n",
PQgetlength(res, i, d_fnum),
PQgetlength(res, i, d_fnum),
pval->npts,
pval->npts,
pval->boundbox.xh,
pval->boundbox.xh,
...
...
doc/src/sgml/lobj.sgml
View file @
5f27ac6b
...
@@ -284,7 +284,7 @@ SELECT lo_export(image.raster, "/tmp/motd") from image
...
@@ -284,7 +284,7 @@ SELECT lo_export(image.raster, "/tmp/motd") from image
*/
*/
fd = open(filename, O_RDONLY, 0666);
fd = open(filename, O_RDONLY, 0666);
if (fd < 0) { /* error */
if (fd < 0) { /* error */
fprintf(stderr, "can't open unix file
fprintf(stderr, "can't open unix file
%s\n", filename);
}
}
/*
/*
...
@@ -292,7 +292,7 @@ SELECT lo_export(image.raster, "/tmp/motd") from image
...
@@ -292,7 +292,7 @@ SELECT lo_export(image.raster, "/tmp/motd") from image
*/
*/
lobjId = lo_creat(conn, INV_READ|INV_WRITE);
lobjId = lo_creat(conn, INV_READ|INV_WRITE);
if (lobjId == 0) {
if (lobjId == 0) {
fprintf(stderr, "can't create large object");
fprintf(stderr, "can't create large object
\n
");
}
}
lobj_fd = lo_open(conn, lobjId, INV_WRITE);
lobj_fd = lo_open(conn, lobjId, INV_WRITE);
...
@@ -302,7 +302,7 @@ SELECT lo_export(image.raster, "/tmp/motd") from image
...
@@ -302,7 +302,7 @@ SELECT lo_export(image.raster, "/tmp/motd") from image
while ((nbytes = read(fd, buf, BUFSIZE)) > 0) {
while ((nbytes = read(fd, buf, BUFSIZE)) > 0) {
tmp = lo_write(conn, lobj_fd, buf, nbytes);
tmp = lo_write(conn, lobj_fd, buf, nbytes);
if (tmp < nbytes) {
if (tmp < nbytes) {
fprintf(stderr, "error while reading
fprintf(stderr, "error while reading
large object\n");
}
}
}
}
...
@@ -321,7 +321,7 @@ SELECT lo_export(image.raster, "/tmp/motd") from image
...
@@ -321,7 +321,7 @@ SELECT lo_export(image.raster, "/tmp/motd") from image
lobj_fd = lo_open(conn, lobjId, INV_READ);
lobj_fd = lo_open(conn, lobjId, INV_READ);
if (lobj_fd < 0) {
if (lobj_fd < 0) {
fprintf(stderr,"can't open large object %d",
fprintf(stderr,"can't open large object %d
\n
",
lobjId);
lobjId);
}
}
...
@@ -335,7 +335,7 @@ SELECT lo_export(image.raster, "/tmp/motd") from image
...
@@ -335,7 +335,7 @@ SELECT lo_export(image.raster, "/tmp/motd") from image
fprintf(stderr,">>> %s", buf);
fprintf(stderr,">>> %s", buf);
nread += nbytes;
nread += nbytes;
}
}
fprintf(stderr,"
0
);
fprintf(stderr,"
\n"
);
lo_close(conn, lobj_fd);
lo_close(conn, lobj_fd);
}
}
...
@@ -349,7 +349,7 @@ SELECT lo_export(image.raster, "/tmp/motd") from image
...
@@ -349,7 +349,7 @@ SELECT lo_export(image.raster, "/tmp/motd") from image
lobj_fd = lo_open(conn, lobjId, INV_READ);
lobj_fd = lo_open(conn, lobjId, INV_READ);
if (lobj_fd < 0) {
if (lobj_fd < 0) {
fprintf(stderr,"can't open large object %d",
fprintf(stderr,"can't open large object %d
\n
",
lobjId);
lobjId);
}
}
...
@@ -365,7 +365,7 @@ SELECT lo_export(image.raster, "/tmp/motd") from image
...
@@ -365,7 +365,7 @@ SELECT lo_export(image.raster, "/tmp/motd") from image
nbytes = lo_write(conn, lobj_fd, buf + nwritten, len - nwritten);
nbytes = lo_write(conn, lobj_fd, buf + nwritten, len - nwritten);
nwritten += nbytes;
nwritten += nbytes;
}
}
fprintf(stderr,"
0
);
fprintf(stderr,"
\n"
);
lo_close(conn, lobj_fd);
lo_close(conn, lobj_fd);
}
}
...
@@ -385,7 +385,7 @@ SELECT lo_export(image.raster, "/tmp/motd") from image
...
@@ -385,7 +385,7 @@ SELECT lo_export(image.raster, "/tmp/motd") from image
*/
*/
lobj_fd = lo_open(conn, lobjId, INV_READ);
lobj_fd = lo_open(conn, lobjId, INV_READ);
if (lobj_fd < 0) {
if (lobj_fd < 0) {
fprintf(stderr,"can't open large object %d",
fprintf(stderr,"can't open large object %d
\n
",
lobjId);
lobjId);
}
}
...
@@ -394,7 +394,7 @@ SELECT lo_export(image.raster, "/tmp/motd") from image
...
@@ -394,7 +394,7 @@ SELECT lo_export(image.raster, "/tmp/motd") from image
*/
*/
fd = open(filename, O_CREAT|O_WRONLY, 0666);
fd = open(filename, O_CREAT|O_WRONLY, 0666);
if (fd < 0) { /* error */
if (fd < 0) { /* error */
fprintf(stderr, "can't open unix file
fprintf(stderr, "can't open unix file
%s\n",
filename);
filename);
}
}
...
@@ -404,7 +404,7 @@ SELECT lo_export(image.raster, "/tmp/motd") from image
...
@@ -404,7 +404,7 @@ SELECT lo_export(image.raster, "/tmp/motd") from image
while ((nbytes = lo_read(conn, lobj_fd, buf, BUFSIZE)) > 0) {
while ((nbytes = lo_read(conn, lobj_fd, buf, BUFSIZE)) > 0) {
tmp = write(fd, buf, nbytes);
tmp = write(fd, buf, nbytes);
if (tmp < nbytes) {
if (tmp < nbytes) {
fprintf(stderr,"error while writing
fprintf(stderr,"error while writing
%s\n",
filename);
filename);
}
}
}
}
...
@@ -432,7 +432,7 @@ SELECT lo_export(image.raster, "/tmp/motd") from image
...
@@ -432,7 +432,7 @@ SELECT lo_export(image.raster, "/tmp/motd") from image
PGresult *res;
PGresult *res;
if (argc != 4) {
if (argc != 4) {
fprintf(stderr, "Usage: %s database_name in_filename out_filename
0
,
fprintf(stderr, "Usage: %s database_name in_filename out_filename
\n"
,
argv[0]);
argv[0]);
exit(1);
exit(1);
}
}
...
@@ -448,7 +448,7 @@ SELECT lo_export(image.raster, "/tmp/motd") from image
...
@@ -448,7 +448,7 @@ SELECT lo_export(image.raster, "/tmp/motd") from image
/* check to see that the backend connection was successfully made */
/* check to see that the backend connection was successfully made */
if (PQstatus(conn) == CONNECTION_BAD) {
if (PQstatus(conn) == CONNECTION_BAD) {
fprintf(stderr,"Connection to database '%s' failed.
0
, database);
fprintf(stderr,"Connection to database '%s' failed.
\n"
, database);
fprintf(stderr,"%s",PQerrorMessage(conn));
fprintf(stderr,"%s",PQerrorMessage(conn));
exit_nicely(conn);
exit_nicely(conn);
}
}
...
@@ -456,20 +456,20 @@ SELECT lo_export(image.raster, "/tmp/motd") from image
...
@@ -456,20 +456,20 @@ SELECT lo_export(image.raster, "/tmp/motd") from image
res = PQexec(conn, "begin");
res = PQexec(conn, "begin");
PQclear(res);
PQclear(res);
printf("importing file
printf("importing file
%s\n", in_filename);
/* lobjOid = importFile(conn, in_filename); */
/* lobjOid = importFile(conn, in_filename); */
lobjOid = lo_import(conn, in_filename);
lobjOid = lo_import(conn, in_filename);
/*
/*
printf("as large object %d.
0
, lobjOid);
printf("as large object %d.
\n"
, lobjOid);
printf("picking out bytes 1000-2000 of the large object
0
);
printf("picking out bytes 1000-2000 of the large object
\n"
);
pickout(conn, lobjOid, 1000, 1000);
pickout(conn, lobjOid, 1000, 1000);
printf("overwriting bytes 1000-2000 of the large object with X's
0
);
printf("overwriting bytes 1000-2000 of the large object with X's
\n"
);
overwrite(conn, lobjOid, 1000, 1000);
overwrite(conn, lobjOid, 1000, 1000);
*/
*/
printf("exporting large object to file
printf("exporting large object to file
%s\n", out_filename);
/* exportFile(conn, lobjOid, out_filename); */
/* exportFile(conn, lobjOid, out_filename); */
lo_export(conn, lobjOid,out_filename);
lo_export(conn, lobjOid,out_filename);
...
...
doc/src/sgml/protocol.sgml
View file @
5f27ac6b
...
@@ -691,13 +691,14 @@ AsciiRow (B)
...
@@ -691,13 +691,14 @@ AsciiRow (B)
</Term>
</Term>
<ListItem>
<ListItem>
<Para>
<Para>
A bit map with one bit for each field in the row. The 1st
A bit map with one bit for each field in the row. The 1st
field corresponds to bit 7 of the 1st byte, the 2nd field
field corresponds to bit 7 (MSB) of the 1st byte, the 2nd
corresponds to bit 6 of the 1st byte, the 8th field corresponds
field corresponds to bit 6 of the 1st byte, the 8th field
to bit 0 of the 1st byte, the 9th field corresponds to bit 8 of
corresponds to bit 0 (LSB) of the 1st byte, the 9th field
the 2nd byte, and so on. The bit is set if the value of the
corresponds to bit 7 of the 2nd byte, and so on. Each bit
corresponding field is not NULL.
is set if the value of the corresponding field is not NULL.
If the number of fields is not a multiple of 8, the remainder
of the last byte in the bit map is wasted.
</Para>
</Para>
<Para>
<Para>
Then, for each field with a non-NULL value, there is the following:
Then, for each field with a non-NULL value, there is the following:
...
@@ -720,7 +721,10 @@ AsciiRow (B)
...
@@ -720,7 +721,10 @@ AsciiRow (B)
<ListItem>
<ListItem>
<Para>
<Para>
Specifies the value of the field itself in <Acronym>ASCII</Acronym>
Specifies the value of the field itself in <Acronym>ASCII</Acronym>
characters. <Replaceable>n</Replaceable> is the above size minus 4.
characters. <Replaceable>n</Replaceable> is the above
size minus 4.
There is no trailing '\0' in the field data; the front
end must add one if it wants one.
</Para>
</Para>
</ListItem>
</ListItem>
</VarListEntry>
</VarListEntry>
...
@@ -985,11 +989,13 @@ BinaryRow (B)
...
@@ -985,11 +989,13 @@ BinaryRow (B)
<ListItem>
<ListItem>
<Para>
<Para>
A bit map with one bit for each field in the row. The 1st
A bit map with one bit for each field in the row. The 1st
field corresponds to bit 7 of the 1st byte, the 2nd field
field corresponds to bit 7 (MSB) of the 1st byte, the 2nd
corresponds to bit 6 of the 1st byte, the 8th field corresponds
field corresponds to bit 6 of the 1st byte, the 8th field
to bit 0 of the 1st byte, the 9th field corresponds to bit 8 of
corresponds to bit 0 (LSB) of the 1st byte, the 9th field
the 2nd byte, and so on. The bit is set if the value of the
corresponds to bit 7 of the 2nd byte, and so on. Each bit
corresponding field is not NULL.
is set if the value of the corresponding field is not NULL.
If the number of fields is not a multiple of 8, the remainder
of the last byte in the bit map is wasted.
</Para>
</Para>
<Para>
<Para>
Then, for each field with a non-NULL value, there is the following:
Then, for each field with a non-NULL value, there is the following:
...
@@ -1561,7 +1567,7 @@ NotificationResponse (B)
...
@@ -1561,7 +1567,7 @@ NotificationResponse (B)
</Term>
</Term>
<ListItem>
<ListItem>
<Para>
<Para>
The process ID of the backend process.
The process ID of the
notifying
backend process.
</Para>
</Para>
</ListItem>
</ListItem>
</VarListEntry>
</VarListEntry>
...
@@ -1571,7 +1577,7 @@ NotificationResponse (B)
...
@@ -1571,7 +1577,7 @@ NotificationResponse (B)
</Term>
</Term>
<ListItem>
<ListItem>
<Para>
<Para>
The name of the
rela
tion that the notify has been raised on.
The name of the
condi
tion that the notify has been raised on.
</Para>
</Para>
</ListItem>
</ListItem>
</VarListEntry>
</VarListEntry>
...
@@ -1664,7 +1670,7 @@ RowDescription (B)
...
@@ -1664,7 +1670,7 @@ RowDescription (B)
</Term>
</Term>
<ListItem>
<ListItem>
<Para>
<Para>
Specifies the number of fields in a row (
and
may be zero).
Specifies the number of fields in a row (may be zero).
</Para>
</Para>
<Para>
<Para>
Then, for each field, there is the following:
Then, for each field, there is the following:
...
@@ -1756,7 +1762,7 @@ StartupPacket (F)
...
@@ -1756,7 +1762,7 @@ StartupPacket (F)
</Term>
</Term>
<ListItem>
<ListItem>
<Para>
<Para>
The database name, defaults to the user name if
omitted
.
The database name, defaults to the user name if
empty
.
</Para>
</Para>
</ListItem>
</ListItem>
</VarListEntry>
</VarListEntry>
...
...
doc/src/sgml/ref/notify.sgml
View file @
5f27ac6b
...
@@ -73,6 +73,9 @@ Acknowledgement that notify command has executed.
...
@@ -73,6 +73,9 @@ Acknowledgement that notify command has executed.
</PARA>
</PARA>
</LISTITEM>
</LISTITEM>
</VARLISTENTRY>
</VARLISTENTRY>
</variablelist>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<TERM>
Notify events
Notify events
...
@@ -84,9 +87,6 @@ application reacts depends on its programming.
...
@@ -84,9 +87,6 @@ application reacts depends on its programming.
</PARA>
</PARA>
</LISTITEM>
</LISTITEM>
</VARLISTENTRY>
</VARLISTENTRY>
</variablelist>
</LISTITEM>
</VARLISTENTRY>
</VARIABLELIST>
</VARIABLELIST>
</REFSECT2>
</REFSECT2>
</REFSYNOPSISDIV>
</REFSYNOPSISDIV>
...
...
doc/src/sgml/ref/unlisten.sgml
View file @
5f27ac6b
...
@@ -104,7 +104,7 @@ The backend does not complain if you UNLISTEN something you were not
...
@@ -104,7 +104,7 @@ The backend does not complain if you UNLISTEN something you were not
listening for.
listening for.
<para>
<para>
Each backend will automatically execute <command>UNLISTEN
"*"
</command> when
Each backend will automatically execute <command>UNLISTEN
*
</command> when
exiting.
exiting.
<para>
<para>
...
...
doc/src/sgml/start.sgml
View file @
5f27ac6b
...
@@ -27,7 +27,7 @@ to this guide when the installation is complete.
...
@@ -27,7 +27,7 @@ to this guide when the installation is complete.
<Para>
<Para>
Throughout this manual, any examples that begin with
Throughout this manual, any examples that begin with
the character <Quote>
&percnt
</Quote> are commands that should be typed
the character <Quote>
%
</Quote> are commands that should be typed
at the UNIX shell prompt. Examples that begin with the
at the UNIX shell prompt. Examples that begin with the
character <Quote>*</Quote> are commands in the Postgres query
character <Quote>*</Quote> are commands in the Postgres query
language, Postgres <Acronym>SQL</Acronym>.
language, Postgres <Acronym>SQL</Acronym>.
...
...
doc/src/sgml/xtypes.sgml
View file @
5f27ac6b
...
@@ -51,7 +51,7 @@
...
@@ -51,7 +51,7 @@
{
{
double x, y;
double x, y;
Complex *result;
Complex *result;
if (sscanf(str, " (
%lf , %
lf )", &x, &y) != 2) {
if (sscanf(str, " (
%lf , %
lf )", &x, &y) != 2) {
elog(WARN, "complex_in: error in parsing
elog(WARN, "complex_in: error in parsing
return NULL;
return NULL;
}
}
...
@@ -71,7 +71,7 @@
...
@@ -71,7 +71,7 @@
if (complex == NULL)
if (complex == NULL)
return(NULL);
return(NULL);
result = (char *) palloc(60);
result = (char *) palloc(60);
sprintf(result, "(
%g,%
g)", complex->x, complex->y);
sprintf(result, "(
%g,%
g)", complex->x, complex->y);
return(result);
return(result);
}
}
</ProgramListing>
</ProgramListing>
...
...
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