gooderp18绿色标准版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 satır
9.7KB

  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2. <!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 V1.79.1" /><link rel="prev" href="app-dropuser.html" title="dropuser" /><link rel="next" href="app-pgbasebackup.html" title="pg_basebackup" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center"><span xmlns="http://www.w3.org/1999/xhtml" class="application">ecpg</span></th></tr><tr><td width="10%" align="left"><a accesskey="p" href="app-dropuser.html" title="dropuser">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="reference-client.html" title="PostgreSQL Client Applications">Up</a></td><th width="60%" align="center">PostgreSQL Client Applications</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 12.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="app-pgbasebackup.html" title="pg_basebackup">Next</a></td></tr></table><hr></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> — embedded SQL C preprocessor</p></div><div class="refsynopsisdiv"><h2>Synopsis</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>Description</h2><p>
  3. <code class="command">ecpg</code> is the embedded SQL preprocessor for C
  4. programs. It converts C programs with embedded SQL statements to
  5. normal C code by replacing the SQL invocations with special
  6. function calls. The output files can then be processed with any C
  7. compiler tool chain.
  8. </p><p>
  9. <code class="command">ecpg</code> will convert each input file given on the
  10. command line to the corresponding C output file. If an input file
  11. name does not have any extension, <code class="filename">.pgc</code> is
  12. assumed. The file's extension will be replaced
  13. by <code class="filename">.c</code> to construct the output file name.
  14. But the output file name can be overridden using the
  15. <code class="option">-o</code> option.
  16. </p><p>
  17. If an input file name is just <code class="literal">-</code>,
  18. <code class="command">ecpg</code> reads the program from standard input
  19. (and writes to standard output, unless that is overridden
  20. with <code class="option">-o</code>).
  21. </p><p>
  22. This reference page does not describe the embedded SQL language.
  23. See <a class="xref" href="ecpg.html" title="Chapter 35. ECPG - Embedded SQL in C">Chapter 35</a> for more information on that topic.
  24. </p></div><div class="refsect1" id="id-1.9.4.8.6"><h2>Options</h2><p>
  25. <code class="command">ecpg</code> accepts the following command-line
  26. arguments:
  27. </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">-c</code></span></dt><dd><p>
  28. Automatically generate certain C code from SQL code. Currently, this
  29. works for <code class="literal">EXEC SQL TYPE</code>.
  30. </p></dd><dt><span class="term"><code class="option">-C <em class="replaceable"><code>mode</code></em></code></span></dt><dd><p>
  31. Set a compatibility mode. <em class="replaceable"><code>mode</code></em> can
  32. be <code class="literal">INFORMIX</code>,
  33. <code class="literal">INFORMIX_SE</code>, or <code class="literal">ORACLE</code>.
  34. </p></dd><dt><span class="term"><code class="option">-D <em class="replaceable"><code>symbol</code></em></code></span></dt><dd><p>
  35. Define a C preprocessor symbol.
  36. </p></dd><dt><span class="term"><code class="option">-h</code></span></dt><dd><p>
  37. Process header files. When this option is specified, the output file
  38. extension becomes <code class="literal">.h</code> not <code class="literal">.c</code>,
  39. and the default input file extension is <code class="literal">.pgh</code>
  40. not <code class="literal">.pgc</code>. Also, the <code class="option">-c</code> option is
  41. forced on.
  42. </p></dd><dt><span class="term"><code class="option">-i</code></span></dt><dd><p>
  43. Parse system include files as well.
  44. </p></dd><dt><span class="term"><code class="option">-I <em class="replaceable"><code>directory</code></em></code></span></dt><dd><p>
  45. Specify an additional include path, used to find files included
  46. via <code class="literal">EXEC SQL INCLUDE</code>. Defaults are
  47. <code class="filename">.</code> (current directory),
  48. <code class="filename">/usr/local/include</code>, the
  49. <span class="productname">PostgreSQL</span> include directory which
  50. is defined at compile time (default:
  51. <code class="filename">/usr/local/pgsql/include</code>), and
  52. <code class="filename">/usr/include</code>, in that order.
  53. </p></dd><dt><span class="term"><code class="option">-o <em class="replaceable"><code>filename</code></em></code></span></dt><dd><p>
  54. Specifies that <code class="command">ecpg</code> should write all
  55. its output to the given <em class="replaceable"><code>filename</code></em>.
  56. Write <code class="literal">-o -</code> to send all output to standard output.
  57. </p></dd><dt><span class="term"><code class="option">-r <em class="replaceable"><code>option</code></em></code></span></dt><dd><p>
  58. Selects run-time behavior. <em class="replaceable"><code>Option</code></em> can be
  59. one of the following:
  60. </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">no_indicator</code></span></dt><dd><p>
  61. Do not use indicators but instead use special values to represent
  62. null values. Historically there have been databases using this approach.
  63. </p></dd><dt><span class="term"><code class="option">prepare</code></span></dt><dd><p>
  64. Prepare all statements before using them. Libecpg will keep a cache of
  65. prepared statements and reuse a statement if it gets executed again. If the
  66. cache runs full, libecpg will free the least used statement.
  67. </p></dd><dt><span class="term"><code class="option">questionmarks</code></span></dt><dd><p>
  68. Allow question mark as placeholder for compatibility reasons.
  69. This used to be the default long ago.
  70. </p></dd></dl></div></dd><dt><span class="term"><code class="option">-t</code></span></dt><dd><p>
  71. Turn on autocommit of transactions. In this mode, each SQL command is
  72. automatically committed unless it is inside an explicit
  73. transaction block. In the default mode, commands are committed
  74. only when <code class="command">EXEC SQL COMMIT</code> is issued.
  75. </p></dd><dt><span class="term"><code class="option">-v</code></span></dt><dd><p>
  76. Print additional information including the version and the
  77. "include" path.
  78. </p></dd><dt><span class="term"><code class="option">--version</code></span></dt><dd><p>
  79. Print the <span class="application">ecpg</span> version and exit.
  80. </p></dd><dt><span class="term"><code class="option">-?</code><br /></span><span class="term"><code class="option">--help</code></span></dt><dd><p>
  81. Show help about <span class="application">ecpg</span> command line
  82. arguments, and exit.
  83. </p></dd></dl></div><p>
  84. </p></div><div class="refsect1" id="id-1.9.4.8.7"><h2>Notes</h2><p>
  85. When compiling the preprocessed C code files, the compiler needs to
  86. be able to find the <span class="application">ECPG</span> header files in the
  87. <span class="productname">PostgreSQL</span> include directory. Therefore, you might
  88. have to use the <code class="option">-I</code> option when invoking the compiler
  89. (e.g., <code class="literal">-I/usr/local/pgsql/include</code>).
  90. </p><p>
  91. Programs using C code with embedded SQL have to be linked against
  92. the <code class="filename">libecpg</code> library, for example using the
  93. linker options <code class="literal">-L/usr/local/pgsql/lib -lecpg</code>.
  94. </p><p>
  95. The value of either of these directories that is appropriate for
  96. the installation can be found out using <a class="xref" href="app-pgconfig.html" title="pg_config"><span class="refentrytitle">pg_config</span></a>.
  97. </p></div><div class="refsect1" id="id-1.9.4.8.8"><h2>Examples</h2><p>
  98. If you have an embedded SQL C source file named
  99. <code class="filename">prog1.pgc</code>, you can create an executable
  100. program using the following sequence of commands:
  101. </p><pre class="programlisting">
  102. ecpg prog1.pgc
  103. cc -I/usr/local/pgsql/include -c prog1.c
  104. cc -o prog1 prog1.o -L/usr/local/pgsql/lib -lecpg
  105. </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">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="reference-client.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="app-pgbasebackup.html">Next</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">Home</a></td><td width="40%" align="right" valign="top"> pg_basebackup</td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1