Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdacaeff

Browse files
author
Michael Meskes
committed
Added patch by Bernd Helmle <bernd.helmle@credativ.de> that adds a low level
function that returns the current transaction status.
1 parent20f7f01 commitdacaeff

File tree

4 files changed

+46
-5
lines changed

4 files changed

+46
-5
lines changed

‎doc/src/sgml/ecpg.sgml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/ecpg.sgml,v 1.90 2009/07/11 21:15:32petere Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/ecpg.sgml,v 1.91 2009/09/18 13:13:32meskes Exp $ -->
22

33
<chapter id="ecpg">
44
<title><application>ECPG</application> - Embedded <acronym>SQL</acronym> in C</title>
@@ -4753,6 +4753,31 @@ ECPG = ecpg
47534753
</note>
47544754
</listitem>
47554755

4756+
<listitem>
4757+
<para>
4758+
<function>ECPGget_PGconn(const char *<replaceable>connection_name</replaceable>)
4759+
</function> returns the library database connection handle identified by the given name.
4760+
If <replaceable>connection_name</replaceable> is set to <literal>NULL</literal>, the current
4761+
connection handle is returned. If no connection handle can be identified, the function returns
4762+
<literal>NULL</literal>. The returned connection handle can be used to call any other functions
4763+
from <application>libpq</application>, if necessary.
4764+
</para>
4765+
<note>
4766+
<para>
4767+
It is a bad idea to manipulate database connection handles made from <application>ecpg</application> directly
4768+
with <application>libpq</application> routines.
4769+
</para>
4770+
</note>
4771+
</listitem>
4772+
4773+
<listitem>
4774+
<para>
4775+
<function>ECPGtransactionStatus(const char *<replaceable>connection_name</replaceable>)</function>
4776+
returns the current transaction status of the given connection identified by <replaceable>connection_name</replaceable>.
4777+
See <xref linkend="libpq-status"> and libpq's <function>PQtransactionStatus()</function> for details about the returned status codes.
4778+
</para>
4779+
</listitem>
4780+
47564781
<listitem>
47574782
<para>
47584783
<function>ECPGstatus(int <replaceable>lineno</replaceable>,

‎src/interfaces/ecpg/ecpglib/exports.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/exports.txt,v 1.5 2008/03/25 12:45:25 meskes Exp $
1+
# $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/exports.txt,v 1.6 2009/09/18 13:13:32 meskes Exp $
22
# Functions to be exported by ecpglib DLL
33
ECPGallocate_desc 1
44
ECPGconnect 2
@@ -26,3 +26,4 @@ ECPGstatus 23
2626
ECPGtrans 24
2727
sqlprint 25
2828
ECPGget_PGconn 26
29+
ECPGtransactionStatus 27

‎src/interfaces/ecpg/ecpglib/misc.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.51 2009/09/03 09:09:01 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.52 2009/09/18 13:13:32 meskes Exp $ */
22

33
#definePOSTGRES_ECPG_INTERNAL
44
#include"postgres_fe.h"
@@ -170,6 +170,21 @@ ECPGstatus(int lineno, const char *connection_name)
170170
return (true);
171171
}
172172

173+
PGTransactionStatusType
174+
ECPGtransactionStatus(constchar*connection_name)
175+
{
176+
conststructconnection*con;
177+
178+
con=ecpg_get_connection(connection_name);
179+
if (con==NULL) {
180+
/* transaction status is unknown */
181+
returnPQTRANS_UNKNOWN;
182+
}
183+
184+
returnPQtransactionStatus(con->connection);
185+
186+
}
187+
173188
bool
174189
ECPGtrans(intlineno,constchar*connection_name,constchar*transaction)
175190
{

‎src/interfaces/ecpg/include/ecpglib.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* this is a small part of c.h since we don't want to leak all postgres
33
* definitions into ecpg programs
4-
* $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpglib.h,v 1.79 2009/06/11 14:49:13 momjian Exp $
4+
* $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpglib.h,v 1.80 2009/09/18 13:13:32 meskes Exp $
55
*/
66

77
#ifndef_ECPGLIB_H
@@ -59,7 +59,7 @@ boolECPGdeallocate(int, int, const char *, const char *);
5959
boolECPGdeallocate_all(int,int,constchar*);
6060
char*ECPGprepared_statement(constchar*,constchar*,int);
6161
PGconn*ECPGget_PGconn(constchar*);
62-
62+
PGTransactionStatusTypeECPGtransactionStatus(constchar*);
6363

6464
char*ECPGerrmsg(void);
6565

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp