File: app-ecpg.html

package info (click to toggle)
pgadmin3 1.4.3-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 29,796 kB
  • ctags: 10,758
  • sloc: cpp: 55,356; sh: 6,164; ansic: 1,520; makefile: 576; sql: 482; xml: 100; perl: 18
file content (136 lines) | stat: -rw-r--r-- 7,134 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>ecpg</title>
<link rel="stylesheet" href="stylesheet.css" type="text/css">
<link rev="made" href="pgsql-docs@postgresql.org">
<meta name="generator" content="DocBook XSL Stylesheets V1.70.0">
<link rel="start" href="index.html" title="PostgreSQL 8.1.4 Documentation">
<link rel="up" href="reference-client.html" title="PostgreSQL Client Applications">
<link rel="prev" href="app-dropuser.html" title="dropuser">
<link rel="next" href="app-pgconfig.html" title="pg_config">
<link rel="copyright" href="ln-legalnotice.html" title="Legal Notice">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en">
<a name="app-ecpg"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2>Name</h2>
<p><span class="application">ecpg</span> &#8212; embedded SQL C preprocessor</p>
</div>
<a name="id795327"></a><div class="refsynopsisdiv">
<h2>Synopsis</h2>
<div class="cmdsynopsis"><p><code class="command">ecpg</code> [<em class="replaceable"><code>option</code></em>...]  <em class="replaceable"><code>file</code></em>... </p></div>
</div>
<div class="refsect1" lang="en">
<a name="app-ecpg-description"></a><h2>Description</h2>
<p>   <code class="command">ecpg</code> is the embedded SQL preprocessor for C
   programs.  It converts C programs with embedded SQL statements to
   normal C code by replacing the SQL invocations with special
   function calls.  The output files can then be processed with any C
   compiler tool chain.
  </p>
<p>   <code class="command">ecpg</code> will convert each input file given on the
   command line to the corresponding C output file.  Input files
   preferably have the extension <code class="filename">.pgc</code>, in which
   case the extension will be replaced by <code class="filename">.c</code> to
   determine the output file name.  If the extension of the input file
   is not <code class="filename">.pgc</code>, then the output file name is
   computed by appending <code class="literal">.c</code> to the full file name.
   The output file name can also be overridden using the
   <code class="option">-o</code> option.
  </p>
<p>   This reference page does not describe the embedded SQL language.
   See <a href="ecpg.html" title="Chapter30.ECPG - Embedded SQL in C">Chapter30, <i><span class="application">ECPG</span> - Embedded <acronym class="acronym">SQL</acronym> in C</i></a> for more information on that topic.
  </p>
</div>
<div class="refsect1" lang="en">
<a name="id795442"></a><h2>Options</h2>
<p>   <code class="command">ecpg</code> accepts the following command-line
   arguments:

   </p>
<div class="variablelist"><dl>
<dt><span class="term"><code class="option">-c</code></span></dt>
<dd><p>       Automatically generate certain C code from SQL code.  Currently, this
       works for <code class="literal">EXEC SQL TYPE</code>.
      </p></dd>
<dt><span class="term"><code class="option">-C <em class="replaceable"><code>mode</code></em></code></span></dt>
<dd><p>       Set a compatibility mode.  <em class="replaceable"><code>mode</code></em> may
       be <code class="literal">INFORMIX</code> or
       <code class="literal">INFORMIX_SE</code>.
      </p></dd>
<dt><span class="term"><code class="option">-D <em class="replaceable"><code>symbol</code></em></code></span></dt>
<dd><p>       Define a C preprocessor symbol.
      </p></dd>
<dt><span class="term"><code class="option">-i</code></span></dt>
<dd><p>       Parse system include files as well.
      </p></dd>
<dt><span class="term"><code class="option">-I <em class="replaceable"><code>directory</code></em></code></span></dt>
<dd><p>       Specify an additional include path, used to find files included
       via <code class="literal">EXEC SQL INCLUDE</code>.  Defaults are
       <code class="filename">.</code> (current directory),
       <code class="filename">/usr/local/include</code>, the
       <span class="productname">PostgreSQL</span> include directory which
       is defined at compile time (default:
       <code class="filename">/usr/local/pgsql/include</code>), and
       <code class="filename">/usr/include</code>, in that order.
      </p></dd>
<dt><span class="term"><code class="option">-o <em class="replaceable"><code>filename</code></em></code></span></dt>
<dd><p>       Specifies that <code class="command">ecpg</code> should write all
       its output to the given <em class="replaceable"><code>filename</code></em>.
      </p></dd>
<dt><span class="term"><code class="option">-r <em class="replaceable"><code>option</code></em></code></span></dt>
<dd><p>       Selects a run-time behavior.  Currently,
       <em class="replaceable"><code>option</code></em> can only be
       <code class="literal">no_indicator</code>.
      </p></dd>
<dt><span class="term"><code class="option">-t</code></span></dt>
<dd><p>       Turn on autocommit of transactions. In this mode, each SQL command is
       automatically committed unless it is inside an explicit
       transaction block. In the default mode, commands are committed
       only when <code class="command">EXEC SQL COMMIT</code> is issued.
      </p></dd>
<dt><span class="term"><code class="option">-v</code></span></dt>
<dd><p>       Print additional information including the version and the
       include path.
      </p></dd>
<dt><span class="term"><code class="option">--help</code></span></dt>
<dd><p>       Show a brief summary of the command usage, then exit.
      </p></dd>
<dt><span class="term"><code class="option">--version</code></span></dt>
<dd><p>       Output version information, then exit.
      </p></dd>
</dl></div>
<p>
  </p>
</div>
<div class="refsect1" lang="en">
<a name="id795680"></a><h2>Notes</h2>
<p>   When compiling the preprocessed C code files, the compiler needs to
   be able to find the <span class="application">ECPG</span> header files in the
   <span class="productname">PostgreSQL</span> include directory.  Therefore, one might
   have to use the <code class="option">-I</code> option when invoking the compiler
   (e.g., <code class="literal">-I/usr/local/pgsql/include</code>).
  </p>
<p>   Programs using C code with embedded SQL have to be linked against
   the <code class="filename">libecpg</code> library, for example using the
   linker options <code class="literal">-L/usr/local/pgsql/lib -lecpg</code>.
  </p>
<p>   The value of either of these directories that is appropriate for
   the installation can be found out using <a href="app-pgconfig.html" title="pg_config"><span class="refentrytitle"><a name="app-pgconfig-title"></a>pg_config</span></a>.
  </p>
</div>
<div class="refsect1" lang="en">
<a name="id795746"></a><h2>Examples</h2>
<p>   If you have an embedded SQL C source file named
   <code class="filename">prog1.pgc</code>, you can create an executable
   program using the following sequence of commands:
</p>
<pre class="programlisting">ecpg prog1.pgc
cc -I/usr/local/pgsql/include -c prog1.c
cc -o prog1 prog1.o -L/usr/local/pgsql/lib -lecpg</pre>
<p>
  </p>
</div>
</div></body>
</html>