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
1456c5b5
Commit
1456c5b5
authored
Nov 10, 2006
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve formatting of PQexecParams argument descriptions, per
Theo Kramer.
parent
2c2faa17
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
103 additions
and
28 deletions
+103
-28
doc/src/sgml/libpq.sgml
doc/src/sgml/libpq.sgml
+103
-28
No files found.
doc/src/sgml/libpq.sgml
View file @
1456c5b5
<!-- $PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.2
19 2006/10/23 18:10:31 petere
Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.2
20 2006/11/10 22:15:26 tgl
Exp $ -->
<chapter id="libpq">
<chapter id="libpq">
<title><application>libpq</application> - C Library</title>
<title><application>libpq</application> - C Library</title>
...
@@ -956,7 +956,7 @@ Applications may use this to determine the version of the database server they
...
@@ -956,7 +956,7 @@ Applications may use this to determine the version of the database server they
are connected to. The number is formed by converting the major, minor, and
are connected to. The number is formed by converting the major, minor, and
revision numbers into two-decimal-digit numbers and appending them
revision numbers into two-decimal-digit numbers and appending them
together. For example, version 8.1.5 will be returned as 80105, and version
together. For example, version 8.1.5 will be returned as 80105, and version
8.
1 will be returned as 801
00 (leading zeroes are not shown). Zero is
8.
2 will be returned as 802
00 (leading zeroes are not shown). Zero is
returned if the connection is bad.
returned if the connection is bad.
</para>
</para>
</listitem>
</listitem>
...
@@ -1138,41 +1138,116 @@ connections; it will fail when using protocol 2.0.
...
@@ -1138,41 +1138,116 @@ connections; it will fail when using protocol 2.0.
</para>
</para>
<para>
<para>
If parameters are used, they are referred to in the command string
The function arguments are:
as <literal>$1</>, <literal>$2</>, etc.
<parameter>nParams</> is the number of parameters supplied; it is the length
<variablelist>
of the arrays <parameter>paramTypes[]</>, <parameter>paramValues[]</>,
<varlistentry>
<parameter>paramLengths[]</>, and <parameter>paramFormats[]</>. (The
<term><parameter>conn</parameter></term>
array pointers may be <symbol>NULL</symbol> when <parameter>nParams</> is zero.)
<listitem>
<parameter>paramTypes[]</> specifies, by OID, the data types to be assigned to
<para>
the parameter symbols. If <parameter>paramTypes</> is <symbol>NULL</symbol>, or any particular
The connection object to send the command through.
element in the array is zero, the server assigns a data type to the parameter
</para>
symbol in the same way it would do for an untyped literal string.
</listitem>
<parameter>paramValues[]</> specifies the actual values of the parameters.
</varlistentry>
A null pointer in this array means the corresponding parameter is null;
otherwise the pointer points to a zero-terminated text string (for text
<varlistentry>
format) or binary data in the format expected by the server (for binary
<term><parameter>command</parameter></term>
format).
<listitem>
<parameter>paramLengths[]</> specifies the actual data lengths of
<para>
binary-format parameters. It is ignored for null parameters and text-format
The SQL command string to be executed. If parameters are used, they are
parameters. The array pointer may be null when there are no binary
referred to in the command string as <literal>$1</>, <literal>$2</>,
parameters.
etc.
<parameter>paramFormats[]</> specifies whether parameters are text (put a zero
</para>
in the array) or binary (put a one in the array). If the array pointer is
</listitem>
null then all parameters are presumed to be text.
</varlistentry>
<parameter>resultFormat</> is zero to obtain results in text format, or one to
obtain results in binary format. (There is not currently a provision to
<varlistentry>
obtain different result columns in different formats, although that is
<term><parameter>nParams</parameter></term>
possible in the underlying protocol.)
<listitem>
<para>
The number of parameters supplied; it is the length of the arrays
<parameter>paramTypes[]</>, <parameter>paramValues[]</>,
<parameter>paramLengths[]</>, and <parameter>paramFormats[]</>. (The
array pointers may be <symbol>NULL</symbol> when <parameter>nParams</>
is zero.)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>paramTypes[]</parameter></term>
<listitem>
<para>
Specifies, by OID, the data types to be assigned to the parameter
symbols. If <parameter>paramTypes</> is <symbol>NULL</symbol>, or any
particular element in the array is zero, the server infers a data type
for the parameter symbol in the same way it would do for an untyped
literal string.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>paramValues[]</parameter></term>
<listitem>
<para>
Specifies the actual values of the parameters.
A null pointer in this array means the corresponding parameter is null;
otherwise the pointer points to a zero-terminated text string (for text
format) or binary data in the format expected by the server (for binary
format).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>paramLengths[]</parameter></term>
<listitem>
<para>
Specifies the actual data lengths of binary-format parameters.
It is ignored for null parameters and text-format parameters.
The array pointer may be null when there are no binary parameters.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>paramFormats[]</parameter></term>
<listitem>
<para>
Specifies whether parameters are text (put a zero in the array entry for
the corresponding parameter) or binary (put a one in the array entry for
the corresponding parameter). If the array pointer is null then all
parameters are presumed to be text strings.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>resultFormat</parameter></term>
<listitem>
<para>
Specify zero to obtain results in text format, or one to obtain results
in binary format. (There is not currently a provision to obtain
different result columns in different formats, although that is
possible in the underlying protocol.)
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</para>
</listitem>
</listitem>
</varlistentry>
</varlistentry>
</variablelist>
</variablelist>
</para>
<para>
The primary advantage of <function>PQexecParams</> over <function>PQexec</>
The primary advantage of <function>PQexecParams</> over <function>PQexec</>
is that parameter values may be separated from the command string, thus
is that parameter values may be separated from the command string, thus
avoiding the need for tedious and error-prone quoting and escaping.
avoiding the need for tedious and error-prone quoting and escaping.
</para>
<para>
Unlike <function>PQexec</>, <function>PQexecParams</> allows at most one SQL
Unlike <function>PQexec</>, <function>PQexecParams</> allows at most one SQL
command in the given string. (There can be semicolons in it, but not more
command in the given string. (There can be semicolons in it, but not more
than one nonempty command.) This is a limitation of the underlying protocol,
than one nonempty command.) This is a limitation of the underlying protocol,
...
...
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