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.

40 lines
4.5KB

  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>DISCONNECT</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="ecpg-sql-describe.html" title="DESCRIBE" /><link rel="next" href="ecpg-sql-execute-immediate.html" title="EXECUTE IMMEDIATE" /></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">DISCONNECT</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="ecpg-sql-describe.html" title="DESCRIBE">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="ecpg-sql-commands.html" title="35.14. Embedded SQL Commands">Up</a></td><th width="60%" align="center">35.14. Embedded SQL Commands</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="ecpg-sql-execute-immediate.html" title="EXECUTE IMMEDIATE">Next</a></td></tr></table><hr></hr></div><div class="refentry" id="ECPG-SQL-DISCONNECT"><div class="titlepage"></div><div class="refnamediv"><h2>DISCONNECT</h2><p>DISCONNECT — terminate a database connection</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
  3. DISCONNECT <em class="replaceable"><code>connection_name</code></em>
  4. DISCONNECT [ CURRENT ]
  5. DISCONNECT DEFAULT
  6. DISCONNECT ALL
  7. </pre></div><div class="refsect1" id="id-1.7.5.20.8.3"><h2>Description</h2><p>
  8. <code class="command">DISCONNECT</code> closes a connection (or all
  9. connections) to the database.
  10. </p></div><div class="refsect1" id="id-1.7.5.20.8.4"><h2>Parameters</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>connection_name</code></em></span></dt><dd><p>
  11. A database connection name established by
  12. the <code class="command">CONNECT</code> command.
  13. </p></dd><dt><span class="term"><code class="literal">CURRENT</code></span></dt><dd><p>
  14. Close the <span class="quote">“<span class="quote">current</span>”</span> connection, which is either
  15. the most recently opened connection, or the connection set by
  16. the <code class="command">SET CONNECTION</code> command. This is also
  17. the default if no argument is given to
  18. the <code class="command">DISCONNECT</code> command.
  19. </p></dd><dt><span class="term"><code class="literal">DEFAULT</code></span></dt><dd><p>
  20. Close the default connection.
  21. </p></dd><dt><span class="term"><code class="literal">ALL</code></span></dt><dd><p>
  22. Close all open connections.
  23. </p></dd></dl></div></div><div class="refsect1" id="id-1.7.5.20.8.5"><h2>Examples</h2><pre class="programlisting">
  24. int
  25. main(void)
  26. {
  27. EXEC SQL CONNECT TO testdb AS DEFAULT USER testuser;
  28. EXEC SQL CONNECT TO testdb AS con1 USER testuser;
  29. EXEC SQL CONNECT TO testdb AS con2 USER testuser;
  30. EXEC SQL CONNECT TO testdb AS con3 USER testuser;
  31. EXEC SQL DISCONNECT CURRENT; /* close con3 */
  32. EXEC SQL DISCONNECT DEFAULT; /* close DEFAULT */
  33. EXEC SQL DISCONNECT ALL; /* close con2 and con1 */
  34. return 0;
  35. }
  36. </pre></div><div class="refsect1" id="id-1.7.5.20.8.6"><h2>Compatibility</h2><p>
  37. <code class="command">DISCONNECT</code> is specified in the SQL standard.
  38. </p></div><div class="refsect1" id="id-1.7.5.20.8.7"><h2>See Also</h2><span class="simplelist"><a class="xref" href="ecpg-sql-connect.html" title="CONNECT">CONNECT</a>, <a class="xref" href="ecpg-sql-set-connection.html" title="SET CONNECTION">SET CONNECTION</a></span></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ecpg-sql-describe.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ecpg-sql-commands.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ecpg-sql-execute-immediate.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">DESCRIBE </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> EXECUTE IMMEDIATE</td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1