Sophie

Sophie

distrib > Mageia > 7 > i586 > by-pkgid > 9b6cc37ce608401d44f6535a0c7cb777 > files > 245

postgresql11-docs-11.5-1.mga7.noarch.rpm

<?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>36.11. Library Functions</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="ecpg-process.html" title="36.10. Processing Embedded SQL Programs" /><link rel="next" href="ecpg-lo.html" title="36.12. Large Objects" /></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">36.11. Library Functions</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="ecpg-process.html" title="36.10. Processing Embedded SQL Programs">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="ecpg.html" title="Chapter 36. ECPG - Embedded SQL in C">Up</a></td><th width="60%" align="center">Chapter 36. <span xmlns="http://www.w3.org/1999/xhtml" class="application">ECPG</span> - Embedded <acronym xmlns="http://www.w3.org/1999/xhtml" class="acronym">SQL</acronym> in C</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 11.5 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="ecpg-lo.html" title="36.12. Large Objects">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="ECPG-LIBRARY"><div class="titlepage"><div><div><h2 class="title" style="clear: both">36.11. Library Functions</h2></div></div></div><p>
   The <code class="filename">libecpg</code> library primarily contains
   <span class="quote">“<span class="quote">hidden</span>”</span> functions that are used to implement the
   functionality expressed by the embedded SQL commands.  But there
   are some functions that can usefully be called directly.  Note that
   this makes your code unportable.
  </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
     <code class="function">ECPGdebug(int <em class="replaceable"><code>on</code></em>, FILE
     *<em class="replaceable"><code>stream</code></em>)</code> turns on debug
     logging if called with the first argument non-zero. Debug logging
     is done on <em class="replaceable"><code>stream</code></em>.  The log contains
     all <acronym class="acronym">SQL</acronym> statements with all the input
     variables inserted, and the results from the
     <span class="productname">PostgreSQL</span> server. This can be very
     useful when searching for errors in your <acronym class="acronym">SQL</acronym>
     statements.
    </p><div class="note"><h3 class="title">Note</h3><p>
    On Windows, if the <span class="application">ecpg</span> libraries and an application are
    compiled with different flags, this function call will crash the
    application because the internal representation of the
    <code class="literal">FILE</code> pointers differ.  Specifically,
    multithreaded/single-threaded, release/debug, and static/dynamic
    flags should be the same for the library and all applications using
    that library.
    </p></div></li><li class="listitem"><p>
       <code class="function">ECPGget_PGconn(const char *<em class="replaceable"><code>connection_name</code></em>)
       </code> returns the library database connection handle identified by the given name.
       If <em class="replaceable"><code>connection_name</code></em> is set to <code class="literal">NULL</code>, the current
       connection handle is returned. If no connection handle can be identified, the function returns
       <code class="literal">NULL</code>. The returned connection handle can be used to call any other functions
       from <span class="application">libpq</span>, if necessary.
     </p><div class="note"><h3 class="title">Note</h3><p>
       It is a bad idea to manipulate database connection handles made from <span class="application">ecpg</span> directly
       with <span class="application">libpq</span> routines.
     </p></div></li><li class="listitem"><p>
       <code class="function">ECPGtransactionStatus(const char *<em class="replaceable"><code>connection_name</code></em>)</code>
       returns the current transaction status of the given connection identified by <em class="replaceable"><code>connection_name</code></em>.
       See <a class="xref" href="libpq-status.html" title="34.2. Connection Status Functions">Section 34.2</a> and libpq's <code class="function">PQtransactionStatus()</code> for details about the returned status codes.
     </p></li><li class="listitem"><p>
     <code class="function">ECPGstatus(int <em class="replaceable"><code>lineno</code></em>,
     const char* <em class="replaceable"><code>connection_name</code></em>)</code>
     returns true if you are connected to a database and false if not.
     <em class="replaceable"><code>connection_name</code></em> can be <code class="literal">NULL</code>
     if a single connection is being used.
    </p></li></ul></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ecpg-process.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ecpg.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ecpg-lo.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">36.10. Processing Embedded SQL Programs </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 36.12. Large Objects</td></tr></table></div></body></html>