Re: [HACKERS] ECPG ignores SAVEPOINT if first statement of a transaction

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: [HACKERS] ECPG ignores SAVEPOINT if first statement of a transaction
Дата
Msg-id 20050813150145.GA87926@winnie.fuhr.org
обсуждение исходный текст
Ответ на Re: [HACKERS] ECPG ignores SAVEPOINT if first statement of a transaction  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы Re: [HACKERS] ECPG ignores SAVEPOINT if first statement of a transaction  (Michael Meskes <meskes@postgresql.org>)
Re: [HACKERS] ECPG ignores SAVEPOINT if first statement of a transaction  (Michael Meskes <meskes@postgresql.org>)
Список pgsql-interfaces
On Fri, Aug 12, 2005 at 10:22:32PM -0400, Bruce Momjian wrote:
> Michael Fuhr wrote:
> > ECPG ignores SAVEPOINT if it's the first statement of a transaction:

ECPGtrans() ignores the statement because of this check:

  /*
   * if we are not in autocommit mode, already have committed the
   * transaction and get another commit, just ignore it
   */
  if (!con->committed || con->autocommit)
  {
          if ((res = PQexec(con->connection, transaction)) == NULL)
          {
                  ECPGraise(lineno, ECPG_TRANS, ECPG_SQLSTATE_TRANSACTION_RESOLUTION_UNKNOWN, NULL);
                  return FALSE;
          }
          PQclear(res);
  }

If no statements have been executed in this transaction then committed
is true, so ECPGtrans() ignores the current statement.  It looks
like the code should make an extra consideration for SAVEPOINT in
case it's the first statement.

I'm also wondering if the check for a NULL return value from PQexec()
is sufficient.  Shouldn't it also check for a non-NULL result that's
anything other than PGRES_COMMAND_OK?

--
Michael Fuhr

В списке pgsql-interfaces по дате отправления:

Предыдущее
От: jtv@xs4all.nl
Дата:
Сообщение: Re: Getting oid with libpq
Следующее
От: jing han
Дата:
Сообщение: problems about updating a table and cluster this table at the same time