mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Reformat some non-sensical markup.
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ecpg.sgml,v 1.26 2001/10/18 20:43:05 momjian Exp $
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ecpg.sgml,v 1.27 2001/10/31 20:37:39 petere Exp $
|
||||
-->
|
||||
|
||||
<chapter id="ecpg">
|
||||
@ -486,13 +486,9 @@ struct sqlca
|
||||
<sect1 id="ecpg-limitations">
|
||||
<title>Limitations</title>
|
||||
|
||||
<abstract>
|
||||
<para>
|
||||
What will never be included and why it cannot be done.
|
||||
</para>
|
||||
</abstract>
|
||||
What will never be included and why it cannot be done:
|
||||
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>Oracle's single tasking</term>
|
||||
@ -603,29 +599,26 @@ struct sqlca
|
||||
<listitem>
|
||||
<para>
|
||||
The following statements are not implemented thus far:
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><literal>exec sql allocate</></term>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>exec sql allocate</>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><literal>exec sql deallocate</></term>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>exec sql deallocate</></term>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><literal>SQLSTATE</></term>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>SQLSTATE</></term>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@ -682,13 +675,13 @@ exec sql insert select from statement
|
||||
<listitem>
|
||||
<para>
|
||||
<command>Declare</> sections begin with:
|
||||
<programlisting>
|
||||
<programlisting>
|
||||
exec sql begin declare section;
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
and end with:
|
||||
<programlisting>
|
||||
<programlisting>
|
||||
exec sql end declare section;
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
In this section only variable declarations are allowed. Every
|
||||
variable declared within this section is stored in a list
|
||||
of variables indexed by name together with its corresponding
|
||||
@ -710,13 +703,13 @@ exec sql end declare section;
|
||||
<para>
|
||||
The special types <type>VARCHAR</type> and <type>VARCHAR2</type> are converted into a named struct
|
||||
for every variable. A declaration like:
|
||||
<programlisting>
|
||||
<programlisting>
|
||||
VARCHAR var[180];
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
is converted into:
|
||||
<programlisting>
|
||||
<programlisting>
|
||||
struct varchar_var { int len; char arr[180]; } var;
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@ -726,13 +719,13 @@ struct varchar_var { int len; char arr[180]; } var;
|
||||
<listitem>
|
||||
<para>
|
||||
An include statement looks like:
|
||||
<programlisting>
|
||||
<programlisting>
|
||||
exec sql include filename;
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
Note that this is NOT the same as:
|
||||
<programlisting>
|
||||
<programlisting>
|
||||
#include <filename.h>
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
@ -749,78 +742,93 @@ exec sql include filename;
|
||||
<listitem>
|
||||
<para>
|
||||
A connect statement looks like:
|
||||
<programlisting>
|
||||
<programlisting>
|
||||
exec sql connect to <replaceable>connection target</replaceable>;
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
It creates a connection to the specified database.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The <replaceable>connection target</replaceable> can be specified in the
|
||||
following ways:
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>dbname[@server][:port][as <replaceable>connection
|
||||
name</replaceable>][user <replaceable>user name</replaceable>]</term>
|
||||
<listitem><para></para></listitem>
|
||||
</varlistentry>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<literal>dbname[@server][:port][as <replaceable>connection
|
||||
name</replaceable>][user <replaceable>user name</replaceable>]</literal>
|
||||
</simpara>
|
||||
</listitem>
|
||||
|
||||
<varlistentry>
|
||||
<term>tcp:postgresql://server[:port][/dbname][as
|
||||
<replaceable>connection name</replaceable>][user <replaceable>user name</replaceable>]</term>
|
||||
<listitem><para></para></listitem>
|
||||
</varlistentry>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<literal>tcp:postgresql://server[:port][/dbname][as
|
||||
<replaceable>connection name</replaceable>][user <replaceable>user name</replaceable>]</literal>
|
||||
</simpara>
|
||||
</listitem>
|
||||
|
||||
<varlistentry>
|
||||
<term>unix:postgresql://server[:port][/dbname][as
|
||||
<replaceable>connection name</replaceable>][user <replaceable>user name</replaceable>]</term>
|
||||
<listitem><para></para></listitem>
|
||||
</varlistentry>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<literal>unix:postgresql://server[:port][/dbname][as
|
||||
<replaceable>connection name</replaceable>][user <replaceable>user name</replaceable>]</literal>
|
||||
</simpara>
|
||||
</listitem>
|
||||
|
||||
<varlistentry>
|
||||
<term><replaceable>character variable</replaceable>[as
|
||||
<replaceable>connection name</replaceable>][user <replaceable>user name</replaceable>]</term>
|
||||
<listitem><para></para></listitem>
|
||||
</varlistentry>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<literal><replaceable>character variable</replaceable>[as
|
||||
<replaceable>connection name</replaceable>][user <replaceable>user name</replaceable>]</literal>
|
||||
</simpara>
|
||||
</listitem>
|
||||
|
||||
<varlistentry>
|
||||
<term><replaceable>character string</replaceable>[as
|
||||
<replaceable>connection name</replaceable>][<replaceable>user</replaceable>]</term>
|
||||
<listitem><para></para></listitem>
|
||||
</varlistentry>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<literal><replaceable>character string</replaceable>[as
|
||||
<replaceable>connection name</replaceable>][<replaceable>user</replaceable>]</literal>
|
||||
</simpara>
|
||||
</listitem>
|
||||
|
||||
<varlistentry>
|
||||
<term>default</term>
|
||||
<listitem><para></para></listitem>
|
||||
</varlistentry>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<literal>default</literal>
|
||||
</simpara>
|
||||
</listitem>
|
||||
|
||||
<varlistentry>
|
||||
<term>user</term>
|
||||
<listitem><para></para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<literal>user</literal>
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
There are also different ways to specify the user name:
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><replaceable>userid</replaceable></term>
|
||||
<listitem><para></para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><replaceable>userid</replaceable>/<replaceable>password</replaceable></term>
|
||||
<listitem><para></para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><replaceable>userid</replaceable> identified by <replaceable>password</replaceable></term>
|
||||
<listitem><para></para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><replaceable>userid</replaceable> using <replaceable>password</replaceable></term>
|
||||
<listitem><para></para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<literal><replaceable>userid</replaceable></literal>
|
||||
</simpara>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<simpara>
|
||||
<literal><replaceable>userid</replaceable>/<replaceable>password</replaceable></literal>
|
||||
</simpara>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<simpara>
|
||||
<literal><replaceable>userid</replaceable> identified by <replaceable>password</replaceable></literal>
|
||||
</simpara>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<simpara>
|
||||
<literal><replaceable>userid</replaceable> using <replaceable>password</replaceable></literal>
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
@ -844,24 +852,32 @@ exec sql disconnect [<replaceable>connection target</replaceable>];
|
||||
<para>
|
||||
The <replaceable>connection target</replaceable> can be specified in the
|
||||
following ways:
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><replaceable>connection name</replaceable></term>
|
||||
<listitem><para></para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>default</term>
|
||||
<listitem><para></para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>current</term>
|
||||
<listitem><para></para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<literal><replaceable>connection name</replaceable></literal>
|
||||
</simpara>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<simpara>
|
||||
<literal>default</literal>
|
||||
</simpara>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<simpara>
|
||||
<literal>current</literal>
|
||||
</simpara>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<simpara>
|
||||
<term>all</term>
|
||||
<listitem><para></para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@ -871,9 +887,9 @@ exec sql disconnect [<replaceable>connection target</replaceable>];
|
||||
<listitem>
|
||||
<para>
|
||||
An open cursor statement looks like:
|
||||
<programlisting>
|
||||
<programlisting>
|
||||
exec sql open <replaceable>cursor</replaceable>;
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
and is not copied to the output. Instead, the cursor's
|
||||
<command>DECLARE</> command is used because it opens the cursor
|
||||
as well.
|
||||
@ -886,9 +902,9 @@ exec sql open <replaceable>cursor</replaceable>;
|
||||
<listitem>
|
||||
<para>
|
||||
A commit statement looks like:
|
||||
<programlisting>
|
||||
<programlisting>
|
||||
exec sql commit;
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@ -898,9 +914,9 @@ exec sql commit;
|
||||
<listitem>
|
||||
<para>
|
||||
A rollback statement looks like:
|
||||
<programlisting>
|
||||
<programlisting>
|
||||
exec sql rollback;
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@ -929,19 +945,68 @@ exec sql rollback;
|
||||
For every variable that is part of the <acronym>SQL</acronym>
|
||||
query, the function gets other arguments:
|
||||
|
||||
<simplelist>
|
||||
<member>The type as a special symbol.</member>
|
||||
<member>A pointer to the value or a pointer to the pointer.</member>
|
||||
<member>The size of the variable if it is a <type>char</type> or <type>varchar</type>.</member>
|
||||
<member>The number of elements in the array (for array fetches).</member>
|
||||
<member>The offset to the next element in the array (for array fetches).</member>
|
||||
<member>The type of the indicator variable as a special symbol.</member>
|
||||
<member>A pointer to the value of the indicator variable or a pointer to the pointer of the indicator variable.</member>
|
||||
<member>0.</member>
|
||||
<member>Number of elements in the indicator array (for array fetches).</member>
|
||||
<member>The offset to the next element in the indicator array
|
||||
(for array fetches).</member>
|
||||
</simplelist>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
The type as a special symbol.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
A pointer to the value or a pointer to the pointer.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
The size of the variable if it is a <type>char</type> or <type>varchar</type>.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
The number of elements in the array (for array fetches).
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
The offset to the next element in the array (for array fetches).
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
The type of the indicator variable as a special symbol.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
A pointer to the value of the indicator variable or a pointer to the pointer of the indicator variable.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
0.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Number of elements in the indicator array (for array fetches).
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
The offset to the next element in the indicator array (for
|
||||
array fetches).
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
</listitem>
|
||||
@ -956,16 +1021,16 @@ exec sql rollback;
|
||||
<para>
|
||||
Here is a complete example describing the output of the preprocessor of a
|
||||
file <filename>foo.pgc</filename>:
|
||||
<programlisting>
|
||||
<programlisting>
|
||||
exec sql begin declare section;
|
||||
int index;
|
||||
int result;
|
||||
exec sql end declare section;
|
||||
...
|
||||
exec sql select res into :result from mytable where index = :index;
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
is translated into:
|
||||
<programlisting>
|
||||
<programlisting>
|
||||
/* Processed by ecpg (2.6.0) */
|
||||
/* These two include files are added by the preprocessor */
|
||||
#include <ecpgtype.h>;
|
||||
@ -985,7 +1050,7 @@ ECPGdo(__LINE__, NULL, "select res from mytable where index = ? ",
|
||||
ECPGt_int,&(result),1L,1L,sizeof(int),
|
||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
|
||||
#line 147 "foo.pgc"
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
(The indentation in this manual is added for readability and not
|
||||
something the preprocessor does.)
|
||||
</para>
|
||||
|
Reference in New Issue
Block a user