-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp-ecpg.html
More file actions
214 lines (213 loc) · 18 KB
/
app-ecpg.html
File metadata and controls
214 lines (213 loc) · 18 KB
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>ecpg</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="app-dropuser.html" title="dropuser" /><link rel="next" href="app-pgamcheck.html" title="pg_amcheck" /><meta name="viewport" content="width=device-width,initial-scale=1.0" /></head><body id="docContent" class="container-fluid col-10"><div class="other_version"><a href="https://www.postgresql.jp/document/">バージョンごとのドキュメント一覧</a></div><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="4" align="center"><a accesskey="h" href="index.html">PostgreSQL 18.3文書</a></th></tr><tr><td width="10%" align="left"></td><td width="10%" align="left"></td><td width="60%" align="center"><a href="reference-client.html" title="PostgreSQLクライアントアプリケーション">PostgreSQLクライアントアプリケーション</a></td><td width="20%" align="right"><div class="actions"><a class="issue" title="github" href="https://github.com/pgsql-jp/jpug-doc/issues/new?template=bug_report.yml&what-happened=version 18.3 : app-ecpg.html">誤訳等の報告
</a></div></td></tr><tr><td width="10%" align="left"><a accesskey="p" href="app-dropuser.html" title="dropuser">前へ</a> </td><td width="10%" align="left"><a accesskey="u" href="reference-client.html" title="PostgreSQLクライアントアプリケーション">上へ</a></td><td width="60%" align="center"><span class="application">ecpg</span></td><td width="20%" align="right"> <a accesskey="n" href="app-pgamcheck.html" title="pg_amcheck">次へ</a></td></tr></table><hr /></div><div class="refentry" id="APP-ECPG"><div class="titlepage"></div><a id="id-1.9.4.8.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle"><span class="application">ecpg</span></span></h2><p><span class="application">ecpg</span><span class="original">
<refpurpose>embedded SQL C preprocessor</refpurpose>
</span> — 埋め込みSQL用Cプリプロセッサ</p></div><div class="refsynopsisdiv"><h2>概要</h2><div class="cmdsynopsis"><p id="id-1.9.4.8.4.1"><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" id="APP-ECPG-DESCRIPTION"><h2>説明</h2><span class="original">
<title>Description</title>
</span><p>
<span class="original">
<command>ecpg</command> 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.
</span>
<code class="command">ecpg</code>は、Cプログラム用の埋め込みSQLプリプロセッサです。
SQL呼び出しを特別な関数呼び出しに置き換えることによって、埋め込みSQL文を含むCプログラムを、通常のCコードに変換します。
これにより、出力ファイルは、任意のCコンパイラツールを使用して処理することができます。
</p><p>
<span class="original">
<command>ecpg</command> will convert each input file given on the
command line to the corresponding C output file. If an input file
name does not have any extension, <filename>.pgc</filename> is
assumed. The file's extension will be replaced
by <filename>.c</filename> to construct the output file name.
But the output file name can be overridden using the
<option>-o</option> option.
</span>
<code class="command">ecpg</code>は、コマンドラインで指定される各入力ファイルを対応するCの出力ファイルに変換します。
入力ファイル名に拡張子がなければ、<code class="filename">.pgc</code>を仮定します。
出力ファイル名を構成するために、拡張子が<code class="filename">.c</code>に置き換えられます。
しかし、出力ファイル名は<code class="option">-o</code>オプションによって指定でき、こちらが優先します。
</p><p>
<span class="original">
If an input file name is just <literal>-</literal>,
<command>ecpg</command> reads the program from standard input
(and writes to standard output, unless that is overridden
with <option>-o</option>).
</span>
入力ファイルが<code class="literal">-</code>だけであれば、<code class="command">ecpg</code>はプログラムを標準入力から読み込み(<code class="option">-o</code>で上書きされていなければ、標準出力へ書き出し)ます。
</p><p>
<span class="original">
This reference page does not describe the embedded SQL language.
See <xref linkend="ecpg"/> for more information on that topic.
</span>
このリファレンスページでは埋め込みSQL言語については説明しません。
<a class="xref" href="ecpg.html" title="第34章 ECPG — C言語による埋め込みSQL">第34章</a>を参照してください。
</p></div><div class="refsect1" id="id-1.9.4.8.6"><h2>オプション</h2><span class="original">
<title>Options</title>
</span><p>
<span class="original">
<command>ecpg</command> accepts the following command-line
arguments:
</span>
<code class="command">ecpg</code>は、以下のコマンドライン引数を受け付けます。
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">-c</code></span></dt><dd><p>
<span class="original">
Automatically generate certain C code from SQL code. Currently, this
works for <literal>EXEC SQL TYPE</literal>.
</span>
SQLコードから有効なCコードを自動的に生成します。
現在、このオプションは<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>
<span class="original">
Set a compatibility mode. <replaceable>mode</replaceable> can
be <literal>INFORMIX</literal>,
<literal>INFORMIX_SE</literal>, or <literal>ORACLE</literal>.
</span>
互換モードを設定します。
<em class="replaceable"><code>mode</code></em>は<code class="literal">INFORMIX</code>、<code class="literal">INFORMIX_SE</code>、<code class="literal">ORACLE</code>のどれかを取ることができます。
</p></dd><dt><span class="term"><code class="option">-D <em class="replaceable"><code>symbol</code></em>[=<em class="replaceable"><code>value</code></em>]</code></span></dt><dd><p>
<span class="original">
Define a preprocessor symbol, equivalently to the <command>EXEC SQL
DEFINE</command> directive. If no <replaceable>value</replaceable> is
specified, the symbol is defined with the value <literal>1</literal>.
</span>
プリプロセッサシンボルを定義します。これは<code class="command">EXEC SQL DEFINE</code>指示子と同じです。
<em class="replaceable"><code>value</code></em>が指定されない場合、シンボルは値<code class="literal">1</code>で定義されます。
</p></dd><dt><span class="term"><code class="option">-h</code></span></dt><dd><p>
<span class="original">
Process header files. When this option is specified, the output file
extension becomes <literal>.h</literal> not <literal>.c</literal>,
and the default input file extension is <literal>.pgh</literal>
not <literal>.pgc</literal>. Also, the <option>-c</option> option is
forced on.
</span>
ヘッダファイルを処理します。
このオプションが指定されると、出力ファイルの拡張子は<code class="literal">.c</code>ではなく<code class="literal">.h</code>になり、デフォルトの入力ファイルの拡張子は<code class="literal">.pgc</code>ではなく<code class="literal">.pgh</code>になります。
また、<code class="option">-c</code>オプションが強制的に有効になります。
</p></dd><dt><span class="term"><code class="option">-i</code></span></dt><dd><p>
<span class="original">
Parse system include files as well.
</span>
同様にシステムインクルードファイルも解析します。
</p></dd><dt><span class="term"><code class="option">-I <em class="replaceable"><code>directory</code></em></code></span></dt><dd><p>
<span class="original">
Specify an additional include path, used to find files included
via <literal>EXEC SQL INCLUDE</literal>. Defaults are
<filename>.</filename> (current directory),
<filename>/usr/local/include</filename>, the
<productname>PostgreSQL</productname> include directory which
is defined at compile time (default:
<filename>/usr/local/pgsql/include</filename>), and
<filename>/usr/include</filename>, in that order.
</span>
追加のインクルード用パスを指定します。
これは、<code class="literal">EXEC SQL INCLUDE</code>を使用してインクルードされるファイルを検索する際に使用されます。
デフォルトでは順に、<code class="filename">.</code>(カレントディレクトリ)、<code class="filename">/usr/local/include</code>、コンパイル時に定義される<span class="productname">PostgreSQL</span>のインクルードディレクトリ(デフォルトでは<code class="filename">/usr/local/pgsql/include</code>)、<code class="filename">/usr/include</code>です。
</p></dd><dt><span class="term"><code class="option">-o <em class="replaceable"><code>filename</code></em></code></span></dt><dd><p>
<span class="original">
Specifies that <command>ecpg</command> should write all
its output to the given <replaceable>filename</replaceable>.
Write <literal>-o -</literal> to send all output to standard output.
</span>
<code class="command">ecpg</code>が全ての出力を<em class="replaceable"><code>filename</code></em>に書き込むことを指定します。
出力をすべて標準出力に送るには<code class="literal">-o -</code>と書いてください。
</p></dd><dt><span class="term"><code class="option">-r <em class="replaceable"><code>option</code></em></code></span></dt><dd><p>
<span class="original">
Selects run-time behavior. <replaceable>Option</replaceable> can be
one of the following:
</span>
実行時の動作を選択します。
以下のいずれかを<em class="replaceable"><code>option</code></em>として取ることができます。
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">no_indicator</code></span></dt><dd><p>
<span class="original">
Do not use indicators but instead use special values to represent
null values. Historically there have been databases using this approach.
</span>
指示子を使用せずにNULL値を表す特殊な値を使用します。
歴史的にこの方式を使用したデータベースが存在します。
</p></dd><dt><span class="term"><code class="option">prepare</code></span></dt><dd><p>
<span class="original">
Prepare all statements before using them. Libecpg will keep a cache of
prepared statements and reuse a statement if it gets executed again. If the
cache runs full, libecpg will free the least used statement.
</span>
すべての文を使用する前に準備(プリペア)します。
libecpgはプリペアド文のキャッシュを保持し、再実行される場合に文を再利用します。
キャッシュが満杯になった場合、libecpgは最も使用されていない文を解放します。
</p></dd><dt><span class="term"><code class="option">questionmarks</code></span></dt><dd><p>
<span class="original">
Allow question mark as placeholder for compatibility reasons.
This used to be the default long ago.
</span>
互換性のために疑問符をプレースホルダとして許します。
これは大昔にデフォルトでした。
</p></dd></dl></div></dd><dt><span class="term"><code class="option">-t</code></span></dt><dd><p>
<span class="original">
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 <command>EXEC SQL COMMIT</command> is issued.
</span>
トランザクションの自動コミットを有効にします。
このモードでは、各SQLコマンドは明示的なトランザクションブロックの内部にない限り、自動的にコミットされます。
デフォルトのモードでは、<code class="command">EXEC SQL COMMIT</code>が発行された時にのみコマンドがコミットされます。
</p></dd><dt><span class="term"><code class="option">-v</code></span></dt><dd><p>
<span class="original">
Print additional information including the version and the
"include" path.
</span>
バージョンやインクルード用パスなどの補足情報を表示します。
</p></dd><dt><span class="term"><code class="option">--version</code></span></dt><dd><p>
<span class="original">
Print the <application>ecpg</application> version and exit.
</span>
<span class="application">ecpg</span>のバージョンを表示し、終了します。
</p></dd><dt><span class="term"><code class="option">-?</code><br /></span><span class="term"><code class="option">--help</code></span></dt><dd><p>
<span class="original">
Show help about <application>ecpg</application> command line
arguments, and exit.
</span>
<span class="application">ecpg</span>のコマンドライン引数の使用方法を表示し、終了します。
</p></dd></dl></div><p>
</p></div><div class="refsect1" id="id-1.9.4.8.7"><h2>注釈</h2><span class="original">
<title>Notes</title>
</span><p>
<span class="original">
When compiling the preprocessed C code files, the compiler needs to
be able to find the <application>ECPG</application> header files in the
<productname>PostgreSQL</productname> include directory. Therefore, you might
have to use the <option>-I</option> option when invoking the compiler
(e.g., <literal>-I/usr/local/pgsql/include</literal>).
</span>
前処理されたCコードファイルをコンパイルする際、コンパイラが<span class="productname">PostgreSQL</span>のインクルードディレクトリ内にある<span class="application">ECPG</span>ヘッダファイルを検索できるようにしなければなりません。
そのため、コンパイラの呼び出し時に、<code class="option">-I</code>オプションを使用しなければならない可能性があります(例:<code class="literal">-I/usr/local/pgsql/include</code>)。
</p><p>
<span class="original">
Programs using C code with embedded SQL have to be linked against
the <filename>libecpg</filename> library, for example using the
linker options <literal>-L/usr/local/pgsql/lib -lecpg</literal>.
</span>
SQLが埋め込まれたCプログラムには、リンカオプション<code class="literal">-L/usr/local/pgsql/lib -lecpg</code>を使用するなどして、<code class="filename">libecpg</code>ライブラリをリンクする必要があります。
</p><p>
<span class="original">
The value of either of these directories that is appropriate for
the installation can be found out using <xref
linkend="app-pgconfig"/>.
</span>
使用するシステムにおいて上記の2つに対応するディレクトリを調べるには、<a class="xref" href="app-pgconfig.html" title="pg_config"><span class="refentrytitle"><span class="application">pg_config</span></span></a>を使用します。
</p></div><div class="refsect1" id="id-1.9.4.8.8"><h2>例</h2><span class="original">
<title>Examples</title>
</span><p>
<span class="original">
If you have an embedded SQL C source file named
<filename>prog1.pgc</filename>, you can create an executable
program using the following sequence of commands:
</span>
埋め込みSQLを使用した<code class="filename">prog1.pgc</code>というCソースファイルがある場合、次のコマンドを順番に実行すれば、実行可能プログラムを作成することができます。
</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></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="app-dropuser.html" title="dropuser">前へ</a> </td><td width="20%" align="center"><a accesskey="u" href="reference-client.html" title="PostgreSQLクライアントアプリケーション">上へ</a></td><td width="40%" align="right"> <a accesskey="n" href="app-pgamcheck.html" title="pg_amcheck">次へ</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="application">dropuser</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.3文書">ホーム</a></td><td width="40%" align="right" valign="top"> <span class="application">pg_amcheck</span></td></tr></table></div></body></html>