mirror of
https://github.com/postgres/postgres.git
synced 2025-04-25 21:42:33 +03:00
Added patch by Bernd Helmle <bernd.helmle@credativ.de> that adds a low level
function that returns the current transaction status.
This commit is contained in:
parent
20f7f019f9
commit
dacaeff5ae
@ -1,4 +1,4 @@
|
|||||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/ecpg.sgml,v 1.90 2009/07/11 21:15:32 petere Exp $ -->
|
<!-- $PostgreSQL: pgsql/doc/src/sgml/ecpg.sgml,v 1.91 2009/09/18 13:13:32 meskes Exp $ -->
|
||||||
|
|
||||||
<chapter id="ecpg">
|
<chapter id="ecpg">
|
||||||
<title><application>ECPG</application> - Embedded <acronym>SQL</acronym> in C</title>
|
<title><application>ECPG</application> - Embedded <acronym>SQL</acronym> in C</title>
|
||||||
@ -4753,6 +4753,31 @@ ECPG = ecpg
|
|||||||
</note>
|
</note>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
<function>ECPGget_PGconn(const char *<replaceable>connection_name</replaceable>)
|
||||||
|
</function> returns the library database connection handle identified by the given name.
|
||||||
|
If <replaceable>connection_name</replaceable> is set to <literal>NULL</literal>, the current
|
||||||
|
connection handle is returned. If no connection handle can be identified, the function returns
|
||||||
|
<literal>NULL</literal>. The returned connection handle can be used to call any other functions
|
||||||
|
from <application>libpq</application>, if necessary.
|
||||||
|
</para>
|
||||||
|
<note>
|
||||||
|
<para>
|
||||||
|
It is a bad idea to manipulate database connection handles made from <application>ecpg</application> directly
|
||||||
|
with <application>libpq</application> routines.
|
||||||
|
</para>
|
||||||
|
</note>
|
||||||
|
</listitem>
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
<function>ECPGtransactionStatus(const char *<replaceable>connection_name</replaceable>)</function>
|
||||||
|
returns the current transaction status of the given connection identified by <replaceable>connection_name</replaceable>.
|
||||||
|
See <xref linkend="libpq-status"> and libpq's <function>PQtransactionStatus()</function> for details about the returned status codes.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
<function>ECPGstatus(int <replaceable>lineno</replaceable>,
|
<function>ECPGstatus(int <replaceable>lineno</replaceable>,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/exports.txt,v 1.5 2008/03/25 12:45:25 meskes Exp $
|
# $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/exports.txt,v 1.6 2009/09/18 13:13:32 meskes Exp $
|
||||||
# Functions to be exported by ecpglib DLL
|
# Functions to be exported by ecpglib DLL
|
||||||
ECPGallocate_desc 1
|
ECPGallocate_desc 1
|
||||||
ECPGconnect 2
|
ECPGconnect 2
|
||||||
@ -26,3 +26,4 @@ ECPGstatus 23
|
|||||||
ECPGtrans 24
|
ECPGtrans 24
|
||||||
sqlprint 25
|
sqlprint 25
|
||||||
ECPGget_PGconn 26
|
ECPGget_PGconn 26
|
||||||
|
ECPGtransactionStatus 27
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.51 2009/09/03 09:09:01 meskes Exp $ */
|
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.52 2009/09/18 13:13:32 meskes Exp $ */
|
||||||
|
|
||||||
#define POSTGRES_ECPG_INTERNAL
|
#define POSTGRES_ECPG_INTERNAL
|
||||||
#include "postgres_fe.h"
|
#include "postgres_fe.h"
|
||||||
@ -170,6 +170,21 @@ ECPGstatus(int lineno, const char *connection_name)
|
|||||||
return (true);
|
return (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PGTransactionStatusType
|
||||||
|
ECPGtransactionStatus(const char *connection_name)
|
||||||
|
{
|
||||||
|
const struct connection *con;
|
||||||
|
|
||||||
|
con = ecpg_get_connection(connection_name);
|
||||||
|
if (con == NULL) {
|
||||||
|
/* transaction status is unknown */
|
||||||
|
return PQTRANS_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return PQtransactionStatus(con->connection);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ECPGtrans(int lineno, const char *connection_name, const char *transaction)
|
ECPGtrans(int lineno, const char *connection_name, const char *transaction)
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* this is a small part of c.h since we don't want to leak all postgres
|
* this is a small part of c.h since we don't want to leak all postgres
|
||||||
* definitions into ecpg programs
|
* definitions into ecpg programs
|
||||||
* $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpglib.h,v 1.79 2009/06/11 14:49:13 momjian Exp $
|
* $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpglib.h,v 1.80 2009/09/18 13:13:32 meskes Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _ECPGLIB_H
|
#ifndef _ECPGLIB_H
|
||||||
@ -59,7 +59,7 @@ bool ECPGdeallocate(int, int, const char *, const char *);
|
|||||||
bool ECPGdeallocate_all(int, int, const char *);
|
bool ECPGdeallocate_all(int, int, const char *);
|
||||||
char *ECPGprepared_statement(const char *, const char *, int);
|
char *ECPGprepared_statement(const char *, const char *, int);
|
||||||
PGconn *ECPGget_PGconn(const char *);
|
PGconn *ECPGget_PGconn(const char *);
|
||||||
|
PGTransactionStatusType ECPGtransactionStatus(const char *);
|
||||||
|
|
||||||
char *ECPGerrmsg(void);
|
char *ECPGerrmsg(void);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user