Skip to content

Commit

Permalink
ECPG: Start tracking subtransactions and cursors in the runtime
Browse files Browse the repository at this point in the history
library to reduce network turnaround.

For this purpose, the arguments to ECPGtrans() have changed and
4 new public functions were introduced: ECPGopen(), ECPGfetch(),
ECPGcursor_dml() and ECPGclose(). The previously exposed ecpg_do()
is used to drive all these functions. The library version was
changed to 7.0 from 6.6 because of the ECPGtrans change.

New error handling is added to mimic the server behaviour if a
previous function checking the savepoint or cursor name failed.

A new regression test was added to exercise certain aspects of
the client-side tracking of cursors and subtransactions.
  • Loading branch information
Böszörményi Zoltán committed Nov 28, 2013
1 parent 55325d3 commit b405a21
Show file tree
Hide file tree
Showing 54 changed files with 2,166 additions and 209 deletions.
23 changes: 23 additions & 0 deletions doc/src/sgml/ecpg.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -5273,6 +5273,16 @@ while (1)
</listitem>
</varlistentry>

<varlistentry>
<term>-231 (<symbol>ECPG_INVALID_CURSOR</symbol>)</term>
<listitem>
<para>
The cursor name you are trying to use is invalid.
(SQLSTATE 34000)
</para>
</listitem>
</varlistentry>

<varlistentry>
<term>-239 (<symbol>ECPG_INFORMIX_DUPLICATE_KEY</symbol>)</term>
<listitem>
Expand Down Expand Up @@ -5359,11 +5369,24 @@ while (1)
<varlistentry>
<term>-401 (<symbol>ECPG_TRANS</symbol>)</term>
<listitem>
<para>
This error code may occur in the following conditions.
</para>
<para>
The <productname>PostgreSQL</productname> server signaled that
we cannot start, commit, or rollback the transaction.
(SQLSTATE 08007)
</para>
<para>
While processing a previous command, a client side error happened:
invalid savepoint name or invalid cursor name. The actual command
was not sent to the server because of this error. To mimic the
server behaviour, all subsequent commands return the error for
an aborted transaction. (SQLSTATE 25P02)
</para>
<para>
The savepoint name you are trying to use is invalid. (SQLSTATE 3B001)
</para>
</listitem>
</varlistentry>

Expand Down
6 changes: 3 additions & 3 deletions src/interfaces/ecpg/ecpglib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ top_builddir = ../../../..
include $(top_builddir)/src/Makefile.global

NAME= ecpg
SO_MAJOR_VERSION= 6
SO_MINOR_VERSION= 6
SO_MAJOR_VERSION= 7
SO_MINOR_VERSION= 0

override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \
-I$(libpq_srcdir) -I$(top_builddir)/src/port $(CPPFLAGS)
Expand All @@ -25,7 +25,7 @@ override CFLAGS += $(PTHREAD_CFLAGS)
LIBS := $(filter-out -lpgport, $(LIBS))

OBJS= execute.o typename.o descriptor.o sqlda.o data.o error.o prepare.o memory.o \
connect.o misc.o path.o pgstrcasecmp.o \
connect.o misc.o path.o cursor.o pgstrcasecmp.o \
$(filter snprintf.o strlcpy.o win32setlocale.o isinf.o, $(LIBOBJS))

# thread.c is needed only for non-WIN32 implementation of path.c
Expand Down
3 changes: 3 additions & 0 deletions src/interfaces/ecpg/ecpglib/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,9 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p

this->cache_head = NULL;
this->prep_stmts = NULL;
this->subxact_desc = NULL;
this->cursor_desc = NULL;
this->client_side_error = false;

if (all_connections == NULL)
this->next = NULL;
Expand Down
Loading

0 comments on commit b405a21

Please sign in to comment.