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